Sklearn (Cont.)


Use Sklearn in Python (Cont.)
The next step is to make predictions on the test set:

y_pred = lr.predict( x_test )
ypred = k_means.predict( x_test )
y_pred = knn.predict_proba( x_test )

The last step is to determine how the machine learning model performed on the test set. Below are the method provided by the Scikit-learn library to evaluate the performance of machine learning models for the tasks of classification, regression, and clustering:

# Classification
from sklearn.metrics import accuracy_score
accuracy_score( y_test, y_pred )

# Regression
from sklearn.metrics import mean_absolute_error
mean_absolute_error( y_test,y_pred )

# Clustering
from sklearn.metrics import adjusted_rand_score
adjusted_rand_score( y_test,y_pred )

Rather than focusing on loading, manipulating and summarising data, Scikit-learn library is focused on modeling the data. Some of the most popular groups of models provided by Sklearn are as follows:


      She will give you the name of a place to stay—    
      she knows the area like the back of her hand (very well).