Training the classifier

scikit-learn library can be used to code machine learning classifier and is the only Python library which has four-step modeling pattern.

Refer to the following link for more information about sckit-learnhttp://www.jmlr.org/papers/volume12/pedregosa11a/pedregosa11a.pdf.

The coding process of implementing the scikit-learn model applies to various classifiers within sklearn, such as decision trees, k-nearest neighbors (KNN), and more. We will look at a few of these classifiers here, using our well logging data.

The first step in using Scikit to build a model is to create training and test datasets and apply scaling, using the following lines of Python code:

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

Now that we have created a training dataset, we can proceed with building our various types of machine learning models using that data. Typically, in a particular machine learning project, you will have some idea as to the type of machine learning algorithm that you'll want to use, but perhaps not. Either way, you want to verify the performance of your selected algorithm(s).

The following sections show the Python commands which with to create models based using the scikit-learn module.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset