Agentic AI DevOps: Local Setup

Recap of the previous session

  • A model is an equation: y = m·x + b. Training finds the best m and b by guessing, measuring the loss and adjusting. This is gradient descent, and each round is an epoch.
  • With many features, each feature gets its own weight.
  • Classification predicts a category and regression predicts a number. Classification adds the sigmoid and a 0.5 decision boundary.
  • Quality is decided in training. Inference only applies the saved parameters.

In this session

  • The practical use case: predicting an employee’s salary
  • The dataset: features, target and supervised learning
  • How data reaches you in a real project
  • Scikit-learn: ready-made algorithms, so you do not code gradient descent
  • Setting up: Python, an IDE, and Jupyter notebook
  • Pandas and NumPy: the first tools you will use

In one sentence: you do not write the learning algorithm yourself. You prepare the data, pick a ready-made algorithm from scikit-learn, and run it in a notebook.

1. The use case: predict a salary

The use case from the previous session now becomes practical: given an employee’s profile, the model should predict the salary we can offer. It is a simple use case to learn the concepts, not necessarily one used in real life.

2. The dataset

In a real company you would have, say, ten or twenty years of data: every employee, their features (years of experience, projects completed) and the salary they were paid. The model learns the pattern from that history.

For learning, the dataset is a small CSV file with two columns and ten records:

experience,salary
1,30000
2,35000
3,40000
...
10,75000
  • This is structured data (rows and columns). One row is one record.
  • It is supervised learning: the answers (the salary) are already in the data. The model sees the feature (experience) and the target (salary).


Supervised, unsupervised and reinforcement learning

Which column is the target? It is decided by the business problem, not by its position in the file. We want to predict the salary, so salary is the target and the other columns are features. If the goal were to predict age from salary, age would be the target. Always identify the features and the target the moment you receive a dataset.

More data, better training. Ten records is only for learning. Like a student who solves many examples and does better in the exam, a model needs a large dataset, ideally thousands of records, with different kinds of examples.

Where to find practice data: websites such as Kaggle (kaggle.com/datasets) have many datasets. For example, an employee salary dataset with columns for department, experience, education, age and city, where salary is the target.

3. How data reaches you in a real project

Raw data is never ready for training. Different teams prepare it:

Team Role
Data engineers Extract data from the real databases, build data pipelines, clean it, and produce files such as CSV
Data scientists Analyse the data, check that it is enough and suitable, advise on the approach, and short-list two or three algorithms that fit the business problem
ML engineers (you) Take the almost-ready data and the recommendations, then train, evaluate and deploy the model

4. Scikit-learn: ready-made algorithms

You do not write the gradient descent code (random starting values, loss, adjusting, epochs) from scratch. It is already coded in scikit-learn, an open-source Python library of machine learning algorithms.

  • The library is organised by problem type: classification, regression, clustering and more. For salary, you open the regression section, then supervised learning, then linear models.
  • Each entry is a Python class with a description, its parameters and sample code.
  • You pick the algorithm, give it your data, and run the training. The outcome of training is your model.
  • People often call these algorithms “models”. Strictly, the algorithm is the ready-made code, and the model is what you get after training it on your data.
  • Each algorithm learns in a different way, like two teachers using different methods for the same topic. Choosing the right one comes later, and in real projects the data scientists short-list it for you. You do not need to learn every equation.

For the salary problem the course uses linear regression.

5. Setting up your machine

Python

  • Install Python from python.org. If the python command is not found afterwards, restart the system.
  • Use Python 3.11 or 3.12. Avoid the very latest version, because some libraries may not support it yet, and avoid anything older than 3.11.
  • pip is the Python package manager. It downloads libraries from PyPI (the Python Package Index, a public repository).

An IDE

  • PyCharm Community Edition was used in the session. It is free and made for Python projects. VS Code also works and supports many other languages. Any IDE you are comfortable with is fine.
  • Create a folder for your code (for example code/ml), and open it in the IDE. A Python file ends in .py.

Jupyter notebook

Machine learning is experimentation. You train, check the accuracy, change something and train again. Running a whole .py file each time is slow. A notebook lets you run code one cell at a time, go back, change a cell and re-run it.

python3 -m pip install notebook     # install
python3 -m notebook                 # start it in your browser

Then choose File, New, Notebook, and select the Python kernel. The file is saved with the .ipynb extension.

a = 6
print(a + 7)     # run each cell with the play button

Each cell shows its own output, and you can edit and re-run any earlier cell. You do not need the full JupyterLab product.

6. Pandas and NumPy: the first tools you will use

The first step in any training is to read the data. For that you use:

  • Pandas: for working with tabular data (rows and columns). It can read CSV, Excel, JSON and XML files into your program.
  • NumPy: for numerical processing and maths.

Python libraries are used in three steps: install (with pip), import, then use. The next session starts with this. No extra notebook add-on is needed for Pandas or NumPy.

Summary

Key takeaways

  • The practical use case is a salary prediction trained on a small CSV with a feature (experience) and a target (salary).
  • This is supervised learning: the data contains the answers. The target is chosen by the business problem.
  • More and better data gives better training.
  • In real projects data engineers and data scientists prepare the data before it reaches the ML engineer.
  • Scikit-learn gives you ready-made algorithms. You do not code gradient descent yourself.
  • Set up Python 3.11 or 3.12, an IDE, and a Jupyter notebook for step-by-step experimentation.
  • Pandas reads the data and NumPy handles the numbers.

Quick revision

Term Meaning
Record One row of the dataset
Supervised learning Training data includes the answers
Algorithm vs. model Ready-made code vs. the result after training on your data
scikit-learn Python library of ready-made ML algorithms
pip / PyPI Package manager / public package repository
Notebook Interactive page that runs code cell by cell
Pandas / NumPy Library for tables of data / library for numbers

Remember: read the data first, then experiment in a notebook.

0 Shares:
You May Also Like