Search this site
Embedded Files
AIMD GPDS Courses
  • Home
  • Courses
  • Contact
AIMD GPDS Courses
  • Home
  • Courses
  • Contact
  • More
    • Home
    • Courses
    • Contact

日本語  ❯

Lesson 5    ❮    Lesson List    ❮    Top Page

❯  5.1  Preprocessing with sklearn

5.2  Linear Regression

5.3  Logistic Regression

5.4  Classification Methods

5.5  Clustering Methods

⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
EXPECTED COMPLETION TIME
❲▹❳  Video   7m 40s
☷  Interactive readings   5m

Standardizing the data

The main objective of data standardization is to bring the mean to 0 and the variance to 1. 

In order to normalize the data, we can use StandardScaler.

  1. First,  we need to create a transformer (an object) for the scaler.

  2. The transformer then need to be "fitted"  to the data. The fit() function takes only arrays so we need .values to convert it.

  3. We transform the data using transform

Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

Scaling the Data to a Range

If we would like to set a condition on the maximum and minimum values within a data set, we can use scaling to a range. 

Scaling to a range, unlike standardization, will preserve 0 values that exist in the data.

The structure of the command is the same as for StandardScaler. MinMaxScaler or MaxAbsScaler are used instead.

©2023. All rights reserved.  Samy Baladram,
Graduate Program in Data Science - GSIS - Tohoku University
Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse