Skip to main content

7 posts tagged with "scikit-learn"

scikit-learn, the Python Library for Machine Learning Models, Data Splits and Metrics

View All Tags

MLflow Tutorial for Machine Learning in Python — Part 1: Install MLflow and Track Your First Experiment

· 41 min read
Jagdish Kumawat
Founder @ Dewiride

Every time you train a model, you change something: the number of trees, a setting, the data. A week later nobody remembers which change gave the best result. MLflow remembers it for you. In this first part you install MLflow, start your own tracking server, and log your first machine learning experiment from Python.

How to Plot Predicted vs Actual Values with Matplotlib

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A single error score tells you how much a regression model misses on average. A predicted vs actual chart shows where it misses: which values it gets right, which it underestimates, and where the data itself is odd. This guide draws the chart with Matplotlib, saves it as a PNG, and reads a real one from a scikit-learn model.

How to Calculate MAE, RMSE and R² in scikit-learn

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A regression model predicts numbers, so you measure it by how far its numbers are from the real ones. Three scores do most of the work: MAE, RMSE and R². This guide calculates all three with scikit-learn for a real house price model, compares them against a model that always guesses the average, and explains what each number says in plain words.

How to Train a Random Forest Regression Model with scikit-learn

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A random forest is one of the most dependable models for tables of numbers. It trains many decision trees on random slices of the data and averages their answers, so one odd tree can't throw it off. This guide trains scikit-learn's RandomForestRegressor to predict house values, explains its main settings, and shows which features it relied on, with real output.

How to Split Data into Training and Test Sets with scikit-learn

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A model always looks good on the data it learned from. To know how it does on new data, you hold some rows back and never show them to it during training: the test set. scikit-learn's train_test_split does that in one line. This guide splits the California Housing data, and shows what test_size and random_state really control, with real output.

How to Load the California Housing Dataset in Python with scikit-learn

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

The California Housing dataset is the classic dataset for learning regression: 20,640 districts, 8 numbers about each, and a house value to predict. scikit-learn downloads it for you with one function. This guide loads it as a pandas table, explains every column, shows where the download is kept, and points out the $500,000 cap that surprises people.

Fixed: "TypeError: got an unexpected keyword argument 'squared'" in scikit-learn mean_squared_error

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

mean_squared_error(y_true, y_pred, squared=False) is how many tutorials calculate RMSE. In scikit-learn 1.9.1 it fails with TypeError: got an unexpected keyword argument 'squared': the argument was deprecated in scikit-learn 1.4 and has since been removed. root_mean_squared_error() does the same calculation.