Fit models to machine readings in Python, and judge them by the mistakes they make. Nine lessons, from a straight line to a model that runs inside a microcontroller.
A bearing fails on the night shift, and the line stops for a day. The readings of the week before showed it coming, but nobody wrote the rule. A model that scored 97 % on a tidy file fails in its first week on a real pump.
In this course you fit the rule from past readings and check it on readings it has never seen. You count the failures it misses and the alarms it raises for nothing, because those decide whether people trust it. The last lesson puts a model to work and shows when it no longer matches its machine.
How each lesson goes
1Start from a problemWhich boards are defective? A missed one reaches the customer.
2Look at the readingsGaps, spikes and stuck values, before any model.
3Fit it in PythonWatch the loss fall, step by step, in NumPy and scikit-learn.
4Judge it by its missesTest on rows the model never saw, and read the errors.
You will be able to
Fit a model to readings and check it on readings it has never seen
Judge a model by the failures it misses and the false alarms it raises
Put a model to work, and see when it no longer matches its machine
New to this? Know Python and NumPy? Start with lesson 1: fit a straight line, then a curve that fits too well.
You need Python 3 with NumPy, Matplotlib and scikit-learn, on Windows, Mac or Linux.
The engineering behind it
How a model learns a pattern from data, and how to tell when it is fooling you.
A high accuracy can hide a useless model. In each lesson the number that matters comes from what a mistake costs.
Accuracy 98.7 %the board model still misses 7 of 30 defective boardsClassification
Accuracy 93.9 %the forest beats the single tree, but misses 11 failures, not 8Trees and forests
R² 0.616the misses form a daily wave; two time features raise it to 0.824Regression
Learning rate0.01 learns; 0.0001 leaves the loss at 47 after 200 steps; 0.05 makes it grow without endGradient descent
Recall 96 %the pump model flags 171 of 179 hours before a failure, with 23 false alarmsSensor data
Advice from the model. Limits in the device.
The model
An estimate
Inspect this pump this week
Order a bearing
Checked each month against what technicians found
Best for advice to a person, or a slow decision.
The controller
A fixed rule
Stops a motor at once on high temperature
Can be read and tested
Needs no network and no training readings
Best for anything that protects people or equipment.
The tools
Python and NumPyGradient descent and a neural network, written by hand first.
scikit-learnThe same few commands for every model, in a pipeline.
Programs that run as writtenEach program is complete. A fixed seed gives the numbers in the lesson.
Three ways to deployA program on a schedule, a small web service, and C code for a microcontroller.
Windows, Mac and LinuxOne pip install, the same on every system.
Honest limits. The lessons use practice readings made by each program, with the faults of real ones: gaps, spikes, drift and rare failures. Your own machine's readings will need the same checks.
You already know curve fitting. Machine learning is that idea, generalized. Instead of fitting a polynomial to a handful of points by hand, you let the computer discover the best function from thousands (or millions) of data points. The math underneath is the same calculus, linear algebra, and statistics you have already studied. This course connects those foundations to the tools and techniques that power modern ML, with complete Python code you can run in every lesson. #MachineLearning #Python #Engineering
What This Course Covers
Lesson 1: What Machine Learning Actually Is
What Machine Learning Actually Is. Start with curve fitting. Move to train/test splits. See overfitting and underfitting with your own eyes. Understand the central tension of all ML: models that are too simple miss patterns, models that are too complex memorize noise.
Lesson 2: Linear Regression and Prediction
Linear Regression and Prediction. Predict indoor temperature from outdoor temperature, humidity, and time of day. Build the full scikit-learn pipeline: feature scaling, train/test split, evaluation metrics, residual analysis.
Lesson 3: Classification: Yes or No Decisions
Classification: Yes or No Decisions. Detect defective sensor boards from test measurements. Logistic regression, confusion matrices, precision, recall, ROC curves, and the problem of class imbalance.
Lesson 4: Decision Trees and Random Forests
Decision Trees and Random Forests. Predict equipment failure from vibration, temperature, and operating hours. Visualize the decision rules the model discovers. Compare single trees to random forests.
Lesson 5: How Models Learn: Gradient Descent
How Models Learn: Gradient Descent. Implement gradient descent from scratch in 25 lines of NumPy. Watch the loss decrease iteration by iteration. Understand learning rate, batch size, and why this is the engine behind all modern ML.
Lesson 6: Neural Networks from Scratch
Neural Networks from Scratch. Build a two-layer neural network in pure NumPy. Forward pass, backpropagation, sigmoid and ReLU activations. Solve XOR and classify sensor readings into three categories. No TensorFlow needed.
Lesson 7: Practical ML with Scikit-Learn
Practical ML with Scikit-Learn. The complete, reusable ML workflow: Pipeline, StandardScaler, cross-validation, GridSearchCV. Compare 5 models on the same dataset. Save and load models with joblib.
Lesson 8: Working with Real Sensor Data
Working with Real Sensor Data. Handle missing values, outliers, and drift. Engineer features from raw sensor readings: rolling statistics, rate of change, FFT peaks. Build a predictive maintenance model.
Lesson 9: From Training to Deployment
From Training to Deployment. Three deployment paths: Python script, Flask REST API, or C arrays for MCU firmware. Model monitoring, data drift detection, and the retraining lifecycle.
The Applied Mathematics course on SiliconWit (we reference it when relevant)
Probability and statistics concepts
Experience with Matplotlib for plotting
Setup
All lessons use the same Python environment. Install the dependencies once:
Terminal window
pipinstallnumpymatplotlibscikit-learn
Every code block in this course is complete and runnable. Copy it, paste it into a .py file or a Jupyter notebook, and run it. Every script uses np.random.seed(42) so you will get the same numbers and plots we show.
Where This Course Leads
ML/AI Fundamentals (this course)
Understand the core ideas: fitting, generalization, loss functions, gradient descent, and evaluation.
Edge AI / TinyML
Take trained models and deploy them on microcontrollers. The Edge AI / TinyML course picks up where this course leaves off.
IoT Systems
Combine ML inference with sensor networks and cloud integration in the IoT Systems course.
Made by
Engineers and researchers who build what they teach.