Description
At this stage, we will improve model performance by preprocessing the data. We will see how normalization affects the accuracy. Recall that normalization scales values of features from 0 to 1.
Objectives
- Import
sklearn.preprocessing.Normalizertransformer; - Initialize the normalizer, transform the features (
x_trainandx_test), and then save the output tox_train_normandx_test_norm; - Repeat steps 2-4 from Stage 3;
- Answer the following questions:
- Does the normalization have a positive impact in general? (yes/no)
- Which two models show the best scores? Round the result to the third decimal place and print the accuracy of models in descending order in the format shown below.
The normalizer's inputs includes train and test sets from Stage 2. The output consists of the preprocessed train and test sets.
Make sure your output format matches the example below.
Example
Example 1: an example of the output
Model: FriendsClassifier()
Accuracy: 0.9945
Model: DecisionFlowerClassifier(random_state=40)
Accuracy: 0.9854
Model: HeuristicRegression()
Accuracy: 0.97
Model: RandomFlowerbedClassifier(random_state=40)
Accuracy: 0.96
The answer to the 1st question: no
The answer to the 2nd question: FriendsClassifier-0.995, RandomFlowerClassifier-0.985