Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Evaluating the Model with Cross-Validation | Modeling
ML Introduction with scikit-learn
course content

Contenuti del Corso

ML Introduction with scikit-learn

ML Introduction with scikit-learn

1. Machine Learning Concepts
2. Preprocessing Data with Scikit-learn
3. Pipelines
4. Modeling

book
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:

Compito

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.

  1. Initialize a KNeighborsClassifier with 4 neighbors.
  2. 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.
  3. Use a suitable function to split X, y.
  4. Train the model using the training set.
  5. Evaluate the model using the test set.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 5
toggle bottom row

book
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:

Compito

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.

  1. Initialize a KNeighborsClassifier with 4 neighbors.
  2. 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.
  3. Use a suitable function to split X, y.
  4. Train the model using the training set.
  5. Evaluate the model using the test set.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 5
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt