Classifying with scikit-learn

Python is an excellent language for machine learning because of its excellent libraries. In particular, scikit-learn has become the standard library for many machine learning tasks, including classification. We are going to use its implementation of decision trees in this section and in other classifiers. Fortunately, classifiers in scikit-learn follow the same API, thus making it easy to change from one to another. These objects have the following two essential methods:

  • fit(features, labels): This is the learning step and fits the parameters of the model. It takes a list-like object with features and another with labels as arguments.
  • predict(features): This method can only be called after fit and returns a prediction for one or more inputs.
..................Content has been hidden....................

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