1. ML in builder terms
4 min
The core idea
Machine learning is code that learns a pattern from examples, then uses that pattern on new inputs.
In a project repo, your job is to make this learning process visible: data source, inputs, target, model, test result, and run steps.
Builder translation
Normal code follows rules you write. ML code finds a rule from data you give it.
Example: for a UPI spend tracker, normal code can total expenses. ML could learn from past labelled spends and predict if a new transaction is food, travel, shopping, or bills.
What a model is
A model is a saved pattern. It is trained on examples with known answers, then tested on examples it has not seen.
In scikit-learn, training usually means calling fit(). Predicting usually means calling predict().
Tiny ML shape
This is not your final repo. It shows the basic shape you will see again in this track: examples in, model trained, predictions out, score printed.
from sklearn.tree import DecisionTreeClassifier
# Inputs: hours studied, classes attended
X = [
[1, 3],
[2, 4],
[6, 8],
[7, 9]
]
# Labels: 0 = needs help, 1 = likely okay
y = [0, 0, 1, 1]
model = DecisionTreeClassifier(random_state=42)
model.fit(X, y)
new_student = [[3, 5]]
prediction = model.predict(new_student)
print("Prediction:", prediction[0])