liveBook · Manning

Scikit-learn

As explained in Grokking Machine Learning, Second Edition

An open-source Python machine-learning library providing implementations of common algorithms and data-processing utilities.

scikit-learn is a Python machine-learning library that supplies ready-to-use implementations of common algorithms. Instead of coding every model from scratch, you prepare data, create an estimator, fit it, and use it for predictions. section 3.27 section 1.3

Predicting Hyderabad house prices

A housing dataset contains 2,518 rows, 39 features, and a price label. A simple LinearRegression model uses area alone, producing a slope of 9753.94 and an intercept of −6222669.08. A fuller model first removes missing values, scales numerical features, and one-hot encodes categorical features such as location. section 3.27

The same estimator pattern supports several supervised-learning tasks:

  • Train a Perceptron with features and labels, predict labels, and inspect its weights and bias. section 5.21
  • Build a DecisionTreeClassifier by separating features from labels and calling fit; choose Gini index by default or request entropy. section 9.11
decision_tree = DecisionTreeClassifier()
decision_tree.fit(features, labels)

A minimal DecisionTreeClassifier example makes the central create-and-fit workflow immediately runnable. section 9.11

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Demonstrates preprocessing, fitting, prediction, parameter inspection, and tree criteria, but leaves algorithm implementation to the library.
Examples
Uses Hyderabad housing prices, a small perceptron dataset, and a two-feature triangle-and-square decision-tree dataset.
What you can do after
Apply it via estimator classes and fit/predict methods to train models, classify points, predict prices, and inspect learned parameters.
How it connects
Connects linear regression, perceptrons, decision trees, Pandas, feature scaling, and one-hot encoding.

Also explained in

Compare how 6 books explain scikit-learn →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.