Regarding Pandas

What is the meaning of “from sklearn.model_selection import train_test_split” this?

In my laptop in jupyter notebook I can’t access the keyword “sklearn”…it’s showing ModuleNotFound error

hey @nirjona12001 ,
sklearn is a python package which contains various different classes and functions to make our code look optimized and modular.

This means that we are importing the model_selection class from sklearn package into our program and more specifically we need the train_test_split function to be used in our code.

You have not installed sklearn in your system, kindly install it using cmd command : pip install sklearn
I hope this would have resolved you doubt.
Thank You and Happy learning :slightly_smiling_face:.

What’s the use of “train_test_split” function?

take an example we have a dataset of 100 records, train_test_split function takes dataset and split size as parameters. So , consider if we take split_size as 0.2 ( 20% ), then it will split dataset into 80:20 ratio .
With this you can use these to check and validate your model performance before actual submitting the results.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.