Introduction to Sklearn


SKLEARN

1. Preprocessing

it is used for the pre processing task such as data normalizing , scaling the features we also use it for converting the categorical variable into number called as encoding
command :-
from sklearn.preprocessing import MinMaxScaler 
 

2. Model selection :- sklearn have another module called as model selection

use to create the Train-testing data by use of Train-test split
it is also use for creating the validation set performing the parameter selection and so on
commands :-
from sklearn.model_selection import train_test_split

3. Building a model :-

it is also used for the model building sklearn have module for
Linear Models
Ensemble models
Clustering
commands:-
from sklearn.linear_model import LinearRegression

4. Model Evaluation :-

it is used for the model evaluation by using Metric
command:-
from sklearn.metrics import accuracy_score


which ever the module we want to use we need to follow some step mentioned below
  1. Import the class from sklearn module
  2. create a class instance
  3. Assign the inputs and required parameters to the class

Preparing Data for Sklearn

  • impute missing value first of all we need to impute all the missing value because our sklearn not gonna handle our missing value we can impute by mean or mode or some other cleaver technique using some other existing column in the data
  • Remove Categorical Variables :- also module present in the sklearn not deal with strings and Categorical values so we need to remove both this value
Implementation of KNN algorithm on jypter notebook

Comments

Popular Posts