MyMisPal
← Practical AI lessons
Lesson 8 of 11

Real tools and the ML project life cycle

We wrote everything from scratch so you understand what happens inside a model. At work nobody hand-writes k-NN: people use proven libraries. The best known:

pandasRead data from Excel, CSV and databases, then clean and aggregate it. Like SQL and Excel inside Python.
scikit-learnThe go-to library for classic ML: regression, k-NN, k-means, decision trees, all used the same way: fit then predict.
Jupyter / ColabNotebooks where you write code and see results and charts right below it. Google Colab is free and runs in the browser with nothing to install.

Here is the churn model from the k-NN lesson again, with scikit-learn. Notice how short it is. (This code needs Colab or Jupyter; it doesn't run here.)

PYTHON · Colab / Jupyter
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import precision_score, recall_score

df = pd.read_csv("stores.csv")               # orders, weeks, left
X = df[["orders", "weeks"]]                  # features
y = df["left"]                               # target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)

model = KNeighborsClassifier(n_neighbors=3)
model.fit(X_train, y_train)                  # learn
pred = model.predict(X_test)                 # predict

print("Precision:", precision_score(y_test, pred))
print("Recall:   ", recall_score(y_test, pred))

No code? Some tools build simple models for you: Excel's Forecast Sheet forecasts monthly sales in one click, Power BI adds forecasts and anomaly detection inside charts, and cloud services such as Azure Machine Learning and Google Vertex AI offer AutoML, which tries many models and keeps the best. But the understanding you built in this track is what tells you whether a result makes sense.

The ML project life cycle: the best-known method is CRISP-DM, and it's a cycle because you often step back:

1 · Business understanding2 · Data understanding3 · Data preparation4 · Modelling5 · Evaluation6 · DeploymentCRISP-DMThe ML project cycle
Watch outNotice that step one is business understanding, not coding. Most failed AI projects fail because they answered a question nobody needed or couldn't act on. That's exactly the business and systems analyst's job.
Spotted a mistake on this page, or have an idea to improve the site?