Challenge: Evaluating the Model with Cross-Validation
In this challenge, you will build and evaluate a model using both train-test evaluation and cross-validation. The data is an already preprocessed penguins dataset.
Here are some of the functions you will use:
Swipe to start coding
Your task is to create a 4-nearest neighbors classifier and first evaluate its performance using the cross-validation score. Then split the data into train-test sets, train the model on the training set, and evaluate its performance on the test set.
- Initialize a
KNeighborsClassifier
with 4 neighbors. - Calculate the cross-validation scores of this model with the number of folds set to 3. You can pass an untrained model to a
cross_val_score()
function. - Use a suitable function to split
X, y
. - Train the model using the training set.
- Evaluate the model using the test set.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Awesome!
Completion rate improved to 3.13Awesome!
Completion rate improved to 3.13
Challenge: Evaluating the Model with Cross-Validation
In this challenge, you will build and evaluate a model using both train-test evaluation and cross-validation. The data is an already preprocessed penguins dataset.
Here are some of the functions you will use:
Swipe to start coding
Your task is to create a 4-nearest neighbors classifier and first evaluate its performance using the cross-validation score. Then split the data into train-test sets, train the model on the training set, and evaluate its performance on the test set.
- Initialize a
KNeighborsClassifier
with 4 neighbors. - Calculate the cross-validation scores of this model with the number of folds set to 3. You can pass an untrained model to a
cross_val_score()
function. - Use a suitable function to split
X, y
. - Train the model using the training set.
- Evaluate the model using the test set.
Lösning
Tack för dina kommentarer!
single
Awesome!
Completion rate improved to 3.13
Challenge: Evaluating the Model with Cross-Validation
Svep för att visa menyn
In this challenge, you will build and evaluate a model using both train-test evaluation and cross-validation. The data is an already preprocessed penguins dataset.
Here are some of the functions you will use:
Swipe to start coding
Your task is to create a 4-nearest neighbors classifier and first evaluate its performance using the cross-validation score. Then split the data into train-test sets, train the model on the training set, and evaluate its performance on the test set.
- Initialize a
KNeighborsClassifier
with 4 neighbors. - Calculate the cross-validation scores of this model with the number of folds set to 3. You can pass an untrained model to a
cross_val_score()
function. - Use a suitable function to split
X, y
. - Train the model using the training set.
- Evaluate the model using the test set.
Lösning
Tack för dina kommentarer!