HomeAll tracks · pricing · account
Python11 apps · Python, SQL & data
Start free Log in

BitSize Python · Machine Learning

Teach a machine by example.

Every scikit-learn program is one pipeline. Each lesson adds one block.

Part 1 · Foundations · about 12 min · free

knn.fit(X, y)

Track your progress

Save where you are and see what you remember.

Sign up free →

Your pipeline

Every scikit-learn program is these six slots. Each lesson adds a block to your toolbox; pass it and the block lights up.

  1. Dataload, X and y 0 / 3
  2. Splittrain / test 0 / 2
  3. Prepareclean, encode, scale 0 / 14
  4. Modelfit 0 / 46
  5. Evaluatepredict, score 0 / 19
  6. Tunesearch the knobs 0 / 6

Data0 / 3

Split0 / 2

Prepare0 / 14

Model0 / 46

Evaluate0 / 19

Tune0 / 6

Part 1

Foundations

0/6

Your first model, X and y, the kinds of learning, a fair test, over- and underfitting, validation.

  1. 01 Your first modelKNeighborsClassifier · fit · predict Up next
  2. 02 X and yX · y · .shape · features & labels Free account
  3. 03 Kinds of learningLinearRegression · KNeighborsRegressor · KMeans Free account
  4. 04 A fair testtrain_test_split · score 🔒 Subscribe
  5. 05 Too simple, too wigglymake_moons · train vs test score 🔒 Subscribe
  6. 06 Validation and hyperparameterstrain · validation · test · hyperparameters 🔒 Subscribe
Part 2

A project, end to end

0/12

One housing dataset from raw table to tuned, saved model: cleaning, encoding, scaling, pipelines, cross-validation, search.

  1. 07 Frame the problemmean_squared_error · mean_absolute_error · RMSE 🔒 Subscribe
  2. 08 First look at the datainfo · describe · value_counts · hist 🔒 Subscribe
  3. 09 A fair test set, stratifiedpd.cut · stratify 🔒 Subscribe
  4. 10 Explore: maps, correlations, new featurescorr · combined features 🔒 Subscribe
  5. 11 Missing valuesSimpleImputer · fit · transform 🔒 Subscribe
  6. 12 Text categoriesOneHotEncoder · OrdinalEncoder 🔒 Subscribe
  7. 13 Your own transformerFunctionTransformer · BaseEstimator · TransformerMixin 🔒 Subscribe
  8. 14 Feature scalingStandardScaler · MinMaxScaler 🔒 Subscribe
  9. 15 PipelinesPipeline · make_pipeline · ColumnTransformer 🔒 Subscribe
  10. 16 Compare models with cross-validationcross_val_score · DecisionTreeRegressor · RandomForestRegressor 🔒 Subscribe
  11. 17 Tune: grid and randomized searchGridSearchCV · RandomizedSearchCV · best_params_ 🔒 Subscribe
  12. 18 Finish the jobfinal test · joblib · monitoring 🔒 Subscribe
Part 3

Classification

0/9

Binary and many-class classifiers, the confusion matrix, precision and recall, the threshold dial, ROC.

  1. 19 A yes/no classifierload_digits · SGDClassifier · decision_function 🔒 Subscribe
  2. 20 Accuracy can lieDummyClassifier · cross_val_score(scoring="accuracy") 🔒 Subscribe
  3. 21 The confusion matrixconfusion_matrix · cross_val_predict 🔒 Subscribe
  4. 22 Precision, recall, F1precision_score · recall_score · f1_score 🔒 Subscribe
  5. 23 The threshold dialpredict_proba · precision_recall_curve · threshold 🔒 Subscribe
  6. 24 ROC and AUCroc_curve · roc_auc_score 🔒 Subscribe
  7. 25 Many classesOneVsRestClassifier · OneVsOneClassifier · classes_ 🔒 Subscribe
  8. 26 Error analysisconfusion_matrix(normalize=…) · cross_val_predict 🔒 Subscribe
  9. 27 Multilabel and multioutputKNeighborsClassifier (multilabel) · multioutput 🔒 Subscribe
Part 4

Training linear models

0/12

The normal equation, gradient descent, polynomial features, learning curves, Ridge, Lasso, logistic and softmax.

  1. 28 Linear regression, solvedLinearRegression · coef_ · normal equation 🔒 Subscribe
  2. 29 Gradient descentlearning rate · gradient · epochs 🔒 Subscribe
  3. 30 Batch, stochastic, mini-batchSGDRegressor · epochs · partial_fit 🔒 Subscribe
  4. 31 Polynomial regressionPolynomialFeatures · degree 🔒 Subscribe
  5. 32 Learning curveslearning_curve · train_sizes 🔒 Subscribe
  6. 33 RidgeRidge · alpha 🔒 Subscribe
  7. 34 LassoLasso · alpha · coef_ == 0 🔒 Subscribe
  8. 35 Elastic NetElasticNet · l1_ratio 🔒 Subscribe
  9. 36 Early stoppingSGDRegressor · early_stopping · n_iter_no_change 🔒 Subscribe
  10. 37 Logistic regressionLogisticRegression · predict_proba · sigmoid 🔒 Subscribe
  11. 38 Decision boundariesLogisticRegression · C · decision boundary 🔒 Subscribe
  12. 39 Softmax regressionLogisticRegression (multinomial) · softmax · predict_proba 🔒 Subscribe
Part 5

Support vector machines

0/6

The widest street, soft margins, kernels, SVM regression and what happens under the hood.

  1. 40 The widest streetSVC(kernel="linear") · support_ 🔒 Subscribe
  2. 41 Soft marginC · StandardScaler 🔒 Subscribe
  3. 42 Curved boundariesPolynomialFeatures + LinearSVC · SVC(kernel="poly") 🔒 Subscribe
  4. 43 The RBF kernelSVC(kernel="rbf") · gamma · C 🔒 Subscribe
  5. 44 SVM regressionSVR · epsilon · LinearSVR 🔒 Subscribe
  6. 45 SVMs under the hooddecision_function · hinge loss · kernel trick 🔒 Subscribe
Part 6

Decision trees

0/5

Growing and reading a tree, how it splits, reining it in, regression trees, instability.

  1. 46 Grow a treeDecisionTreeClassifier · export_text · plot of the tree 🔒 Subscribe
  2. 47 How a tree decidespredict_proba · gini · CART 🔒 Subscribe
  3. 48 Rein in the treemax_depth · min_samples_leaf · max_leaf_nodes 🔒 Subscribe
  4. 49 Regression treesDecisionTreeRegressor · squared error 🔒 Subscribe
  5. 50 Unstable treesrandom_state · rotation · variance 🔒 Subscribe
Part 7

Ensembles

0/7

Voting, bagging, random forests, feature importance, AdaBoost, gradient boosting, stacking.

  1. 51 VotingVotingClassifier · hard · soft 🔒 Subscribe
  2. 52 Bagging and pastingBaggingClassifier · bootstrap · oob_score 🔒 Subscribe
  3. 53 Random forests and extra-treesRandomForestClassifier · max_features · ExtraTreesClassifier 🔒 Subscribe
  4. 54 Feature importancefeature_importances_ · permutation_importance 🔒 Subscribe
  5. 55 AdaBoostAdaBoostClassifier · learning_rate · stumps · staged_score 🔒 Subscribe
  6. 56 Gradient boostingGradientBoostingRegressor · learning_rate · n_iter_no_change · HistGradientBoostingRegressor 🔒 Subscribe
  7. 57 StackingStackingClassifier · final_estimator · cross_val_predict 🔒 Subscribe
Part 8

Dimensionality reduction

0/6

The curse of dimensionality, PCA and explained variance, compression, kernel PCA, manifold maps.

  1. 58 The curse of dimensionalityNumPy simulation · make_swiss_roll · projection vs manifold 🔒 Subscribe
  2. 59 PCAPCA · components_ · explained_variance_ratio_ 🔒 Subscribe
  3. 60 How many components?explained_variance_ratio_ · cumsum · PCA(n_components=0.95) 🔒 Subscribe
  4. 61 Compress and restoreinverse_transform · reconstruction error · IncrementalPCA · svd_solver="randomized" 🔒 Subscribe
  5. 62 Kernel PCAKernelPCA · kernel · gamma 🔒 Subscribe
  6. 63 Manifold mapsLocallyLinearEmbedding · TSNE 🔒 Subscribe
Part 9

Unsupervised learning

0/10

K-Means, choosing k, DBSCAN, Gaussian mixtures, semi-supervised labels, anomaly detection.

  1. 64 What clustering is forKMeans · labels_ · no y 🔒 Subscribe
  2. 65 K-Means, step by stepKMeans · inertia_ · k-means++ 🔒 Subscribe
  3. 66 Choosing kinertia_ · silhouette_score · elbow 🔒 Subscribe
  4. 67 Where K-Means failsmake_blobs · MiniBatchKMeans 🔒 Subscribe
  5. 68 Clustering at workKMeans on colours · cluster distances as features 🔒 Subscribe
  6. 69 Few labelsLabelPropagation · LabelSpreading · representative points 🔒 Subscribe
  7. 70 DBSCANDBSCAN · eps · min_samples 🔒 Subscribe
  8. 71 Gaussian mixturesGaussianMixture · predict_proba · covariance_type 🔒 Subscribe
  9. 72 Anomalies and model choice with mixturesscore_samples · bic · BayesianGaussianMixture 🔒 Subscribe
  10. 73 Other anomaly findersIsolationForest · LocalOutlierFactor · OneClassSVM 🔒 Subscribe
Part 10

Case files

0/5

Open problems end to end: churn, house prices, customer groups, odd transactions, digits.

  1. 74 Case file: who will cancel?pipeline · cost-based threshold · AUC 🔒 Subscribe
  2. 75 Case file: price the homeColumnTransformer · HistGradientBoosting · RMSE 🔒 Subscribe
  3. 76 Case file: find the customer groupsStandardScaler · KMeans · silhouette · GaussianMixture 🔒 Subscribe
  4. 77 Case file: catch the odd transactionIsolationForest · LocalOutlierFactor · review budget 🔒 Subscribe
  5. 78 Case file: read the digitsPipeline · PCA · SVC · GridSearchCV · confusion matrix 🔒 Subscribe