Agentic AI DevOps Bootcamp · Session 4 · Summary Notes
Today’s topics
- From theory to practice: today’s use case (predict a salary)
- The first ingredient of any ML project: the data
- Who prepares the data in a real project
- How we train without writing the algorithm ourselves (scikit-learn)
- Setting up the machine: Python, an IDE, pip and the Jupyter notebook
- Why ML work happens in notebooks
- A first look at pandas and NumPy
Where we are
We have covered the theory: a machine is trained on business data, then used at inference time to predict. We also know the two problem types, classification (pick a category) and regression (predict a number).
From today we start the practical side. Our use case stays the same: predict the salary we should offer an employee, based on that employee’s profile. It is a simple example, chosen to learn the concepts, not a claim about how companies set salaries.
1. The data comes first
Training needs data about the problem you want to solve. For salary prediction that means historical records: for each past employee, their features and the salary they were paid.
Our starter dataset is a CSV file with 10 records and 2 columns:
| Term | Meaning here |
|---|---|
| Record | One row: one employee |
| Feature | What describes the employee: experience (years) |
| Target label (also “the truth”) | The answer we want to predict: salary |
For example, 1 year of experience is a salary of 30k, and 10 years is 75k.
Two labels to remember:
- This is structured data (rows and columns).
- This is supervised learning: the dataset contains the features and the answer. The model learns from the pairs, so later it can predict the salary for, say, 15 years.
How do you find the target? From the business problem, not from the column position. If the goal is “predict salary from experience”, salary is the target. If the goal were “predict age from salary”, age would be the target.
More data, better training. Think of a student who practised thousands of problems versus one who practised ten. Real projects use thousands of records, and the quality of the data matters as much as the quantity. For practice data, browse kaggle.com/datasets (for example, search “employee salary”).
2. Who prepares the data in a real project
You rarely receive raw data. It passes through three teams:
- Data engineers extract data from the real databases, clean it and convert it into a usable format such as CSV.
- Data scientists analyse it: Is there enough? Does it need changes? Which approach fits? They add recommendations.
- ML engineers (us) receive data that is almost ready, and run the training.
3. We don’t write the training algorithm ourselves
Training means finding the best m and b: try values, calculate the loss, compare, adjust, repeat for many epochs. That logic is already written and shared in an open-source library called scikit-learn.
- Algorithm = the code in the library. Model = what you get after training that algorithm on your data.
- The scikit-learn site groups algorithms by problem type: classification, regression, clustering. For us: Regression → Supervised learning → Linear models.
- Each algorithm page explains what it does, shows the equations, and has sample code. The algorithm is a Python class that takes arguments.
- You don’t need the equations. Data scientists study the options and give you a shortlist of 2 or 3 algorithms to try.
Note: logistic regression, despite its name, is a classification algorithm. For our salary (regression) problem we use Linear Regression next session.
4. Setting up your machine
| Tool | What to use |
|---|---|
| Python | Version 3.11 or 3.12. Avoid the very newest (library incompatibilities) and anything below 3.11. Download from python.org. |
| IDE | PyCharm Community Edition (free). Any IDE works: VS Code is general-purpose, PyCharm is Python-specific. |
| Project folder | One folder for all ML work, for example code/ml. Open it in the IDE. |
| pip | Python’s package manager. Downloads libraries from PyPI (pypi.org), the public package repository. |
| Jupyter notebook | The interactive environment we will use for experiments. |
Commands:
python3 --version # check your Python version
python3 -m pip install notebook # install the Jupyter notebook
python3 -m notebook # open it in the browser
In the browser: File → New → Notebook, choose the Python kernel, and name it (for example salary). It is saved as a .ipynb file. If the install says “requirement already satisfied”, it was already installed.
5. Why ML work happens in a notebook
ML is experimentation. The first attempt is rarely accurate enough, so you change something and train again, many times. A plain .py script runs all its lines at once, which makes that back-and-forth slow.
A notebook runs one cell at a time:
- Run a cell and see its output right away.
- Go back to any earlier cell, change it, and run it again.
- Save the whole experiment as one file.
Use the notebook for experiments. Once the approach is proven, move the final code into your IDE for normal development. (Use the plain notebook; JupyterLab is a heavier product we don’t need.)
6. First look at pandas and NumPy
Our CSV must be read into the program before training. Two libraries do the data work in ML:
- pandas: loads and processes tables from files (CSV, Excel, JSON, XML and more).
- NumPy: fast math on arrays of numbers.
Every library follows the same routine: install → import → use. We start with pandas in the next session, because reading the data is the first step of any training.
Recap
- Today’s problem: predict salary from experience (supervised, structured, regression).
- Data = features + target. Find the target from the business problem. More, better data means better training.
- Data reaches us through data engineers and data scientists.
- scikit-learn already contains the algorithms. We train them on our data to get a model.
- Tools: Python 3.11/3.12, an IDE, pip, and the Jupyter notebook for experiments.
Before the next session: install Python, an IDE and the notebook, and make sure python3 -m notebook opens in your browser.
