Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Scikit-learn Concepts | Preprocessing Data with Scikit-learn
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Machine Learning with Python

bookScikit-learn Concepts

The scikit-learn (sklearn) library provides tools for preprocessing and modeling. Its main object types are estimator, transformer, predictor, and model.

Estimator

Any class with .fit() is an estimator β€” it learns from data.

estimator.fit(X, y)     # supervised  
estimator.fit(X)        # unsupervised

Transformer

A transformer has .fit() and .transform(), plus .fit_transform() to do both at once.

Note
Note

Transformers are usually used to transform the X array. However, as we will see in the example of LabelEncoder, some transformers are made for the y array.

nan values shown in the training set in the picture indicate missing data in Python.

Predictor

A predictor is an estimator with .predict() for generating outputs.

predictor.fit(X, y)
predictor.predict(X_new)

Model

A model is a predictor with .score(), which evaluates performance.

model.fit(X, y)
model.score(X, y)

As mentioned in the previous chapter, accuracy is a metric representing the percentage of correct predictions.

The preprocessing stage involves working with transformers, and we work with predictors (more specifically with models) at the modeling stage.

question mark

Select all correct statements.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 1

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain the difference between a transformer and a predictor?

What are some examples of estimators in scikit-learn?

How is the .score() method used to evaluate a model?

bookScikit-learn Concepts

Swipe to show menu

The scikit-learn (sklearn) library provides tools for preprocessing and modeling. Its main object types are estimator, transformer, predictor, and model.

Estimator

Any class with .fit() is an estimator β€” it learns from data.

estimator.fit(X, y)     # supervised  
estimator.fit(X)        # unsupervised

Transformer

A transformer has .fit() and .transform(), plus .fit_transform() to do both at once.

Note
Note

Transformers are usually used to transform the X array. However, as we will see in the example of LabelEncoder, some transformers are made for the y array.

nan values shown in the training set in the picture indicate missing data in Python.

Predictor

A predictor is an estimator with .predict() for generating outputs.

predictor.fit(X, y)
predictor.predict(X_new)

Model

A model is a predictor with .score(), which evaluates performance.

model.fit(X, y)
model.score(X, y)

As mentioned in the previous chapter, accuracy is a metric representing the percentage of correct predictions.

The preprocessing stage involves working with transformers, and we work with predictors (more specifically with models) at the modeling stage.

question mark

Select all correct statements.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 1
some-alt