Scikit-Learn offers a handy module for saving and loading trained models:
from sklearn.externals import joblib
To save model:
joblib.dump(model, "model.pkl")
Let’s say you have a training data set as pandas data frame train_set. Before feeding it to a machine learning algorithm, you need to split it into features and labels (aka answers).
When we split a dataset into test and train sets, we often use different tactics for splitting. Very often methods are based on random records picking and putting them in different sets.