Drop links or images here to add them to the editor.
Continuing on the biopsy dataset.
Questions
- Create a vector
train with all the numbers from 1 to 400
- Create a subset of biopsy with only the response and the rows with
the index not in
train and store it in test.Y
- Create a subset of biopsy with only the predictors and the rows with
the index not in
train and store it in test.X
- Create a Naïve Bayes model to predict
class with
the attributes V1 through V9, use the train vector for the subset parameter,
and store it in nb.fit
- Store the results of the predict method on the test set in
nb.pred. Use the nb.fit model
you created previously
- Create a table that compares the predicted results with the actual diagnosis and store it in
nb.table
- Calculate the accuracy of the model and store in
nb.acc
Assume that:
- The
e1071 and MASS libraries have been loaded
- The
biopsy dataset has been loaded and attached
- The rows with NA values have been dropped
- The
ID column has been dropped