How to Evaluate a Machine Learning Model in Python
Score classification and regression models in Python with scikit-learn, and learn which metric fits your data and the cost of each kind of error.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Score classification and regression models in Python with scikit-learn, and learn which metric fits your data and the cost of each kind of error.
Learn clustering in Python with scikit-learn: scale data, run K-means, DBSCAN and hierarchical clustering, pick parameters and evaluate the results.
Reduce features in Python with PCA and t-SNE using scikit-learn. Learn when to scale, how many components to keep and how to avoid common mistakes.
Build, train, evaluate and save a classification neural network in Python using Keras 3 and TensorFlow, with scaling and early stopping explained.
Train, evaluate and tune a random forest in Python with scikit-learn, including feature importance, out-of-bag score and the regression variant.
Train and tune a support vector machine in Python with scikit-learn: pipelines, kernels, C and gamma, probabilities, LinearSVC and SVR.
Train, visualise and tune a decision tree in Python with scikit-learn, including feature importance, pruning and a regression example.
A step-by-step guide to logistic regression in Python with scikit-learn: preprocessing, training, evaluation, tuning C and interpreting coefficients.
Fit, evaluate and interpret linear regression in Python with scikit-learn, extend it to many features, and see the NumPy version from scratch.
A step-by-step machine learning workflow in Python using scikit-learn pipelines, cross-validation, hyperparameter search and model saving.
Scikit-learn handles classical machine learning on tabular data; TensorFlow handles deep learning at scale. Compare them with code and a decision guide.
Create line, bar, statistical and interactive charts in Python with Matplotlib, Seaborn and Plotly, and learn which library fits which job.
A step-by-step data analysis workflow in Python using pandas: load a CSV, clean it, group and summarise it, then chart the results.
Create, select, filter, group and merge pandas DataFrames, handle missing values and avoid common mistakes such as chained assignment.
Use openpyxl for cell-level work, pandas for DataFrames and XlsxWriter for new styled reports. Handle formulas and xls files carefully.
Use csv.DictReader and csv.DictWriter for lightweight work and pandas read_csv and to_csv for analysis. Set newline and encoding explicitly.
A practical guide to handling data in Python with files, JSON, CSV, NumPy, pandas, dataclasses and sqlite3, including cleaning and large-file tips.
NumPy provides fast n-dimensional arrays, while Pandas builds labelled tables on top of them. Learn how they differ, how they work together and when to pick each.
Learn how to draw and style box plots in Python using Matplotlib and Seaborn, and how to read the median, quartiles, whiskers and outliers.
Draw pie and donut charts in Python with Matplotlib and pandas, label slices with percentages, and learn when to use a bar chart instead.