RPubs will retire in June 2027. Your existing documents will stay accessible through December 31, 2031
and Connect Cloud is the recommended home for new publishing. Read the blog post
gravatar

Abhinands

Abhinands

Recently Published

Plot
Loads the mtcars dataset and normalizes it. Shuffles the normalized dataset. Splits the shuffled data into a training set and a test set. Applies the k-NN algorithm to predict the transmission type (am) of the cars in the test set, using a k value of 3. Prints the model predictions. Creates a scatter plot of miles per gallon (mpg) vs horsepower (hp), colored by transmission type (am). Please note that the am column in the mtcars dataset is a binary variable, where 0 indicates an automatic transmission and 1 indicates a manual transmission.
Plot