Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Scaling the Features | Section
Machine Learning Foundations with Scikit-Learn
Секція 1. Розділ 16
single

single

bookChallenge: Scaling the Features

Свайпніть щоб показати меню

In this challenge, scale the features of the penguins dataset (already encoded and without missing values) using StandardScaler.

12345
import pandas as pd df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a65bbc96-309e-4df9-a790-a1eb8c815a1c/penguins_imputed_encoded.csv') print(df)
copy

Here is a little reminder of the StandardScaler class.

Завдання

Проведіть, щоб почати кодувати

You are given a DataFrame named df that contains encoded and imputed penguin data. Your goal is to standardize all feature values so that each column has a mean of 0 and a variance of 1. This ensures that features are on the same scale before training a machine learning model.

  1. Import the StandardScaler class from sklearn.preprocessing.
  2. Separate the feature matrix X and the target variable y from the DataFrame.
  3. Create a StandardScaler object.
  4. Apply the scaler to the feature matrix X and store the scaled values back into X.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 16
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt