Programming · PRC-27

Python for Machine Learning

Python for Machine Learning is a course in building and evaluating machine learning models with Python, pandas and scikit-learn, from regression, KNN, Naive Bayes and SVMs to random forests, K-Means, PCA and a face recognition project using eigenfaces. It suits programmers, IT teams, teachers and students who already have basic Python skills.

Updated
From 7,650 THB / person 8,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration18 hours · 3 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Machine learning is still at the heart of AI work in organisations, from sales forecasting and customer screening to document categorisation and anomaly detection, and a great deal of tabular data work is still handled better and more cheaply by classic models than by deep learning. Yet beginners often get stuck copying commands from examples without understanding how a model learns, how the data should be prepared, or how to tell whether a model is good enough to use.

This course takes learners through building machine learning models in Python from the ground up with pandas 3 and scikit-learn 1.9. It starts with the principles of linear and logistic regression through gradient descent, then moves on to k-nearest neighbours, Naive Bayes, support vector machines, decision trees, random forests, gradient boosting, K-Means and PCA. Along the way learners prepare data with pipelines, evaluate models with cross-validation and tune hyperparameters systematically, before bringing it all together in an eigenfaces face recognition project, saving models safely and a capstone that goes from raw data to a working model with a demo page. (3 days, 6 hours per day, 18 hours in total, Beginner level.)

What you’ll gain

  • Set up a Python environment for machine learning with uv and JupyterLab or VS Code
  • Understand how models learn, including loss functions and gradient descent
  • Prepare and explore data with pandas 3 and build pipelines that avoid data leakage
  • Build and evaluate regression and classification models with the right metrics
  • Apply KNN, Naive Bayes, SVMs, random forests and gradient boosting to suitable problems
  • Use cross-validation and GridSearchCV to choose models and hyperparameters
  • Cluster data with K-Means and reduce dimensions with PCA, up to a working face recognition system
  • Save models safely and build a demo page that others can try

Who this course is for

  • Programmers and system administrators who want to start machine learning with Python
  • IT staff who maintain and develop organisational systems and want to build predictive models from data
  • Teachers and lecturers who want up-to-date material for teaching machine learning
  • School and university students who want solid foundations before moving on to deep learning
  • General learners with basic Python who want to understand how models work

Prerequisites

  • Basic Python such as variables, lists, dictionaries, loops and functions
  • Some programming experience and confidence managing files and folders on a computer
  • Upper secondary school maths; the statistics and algebra needed are explained in class
  • A laptop on which you can install software, or a Google account to use Google Colab

Curriculum

Course Details

This is the 2026 edition that replaces the previous content of Python for Machine Learning. It keeps the original core of regression, k-nearest neighbours, Naive Bayes, SVMs and the eigenfaces face recognition project, but moves the tooling to uv, JupyterLab, pandas 3 and scikit-learn 1.9, and adds pipelines, model evaluation, tree models and gradient boosting, K-Means and putting models to use. It runs for 3 days, 6 hours per day (18 hours in total, 09:00-16:00), as lectures with a lab in every topic. Beginner level. An ordinary laptop without a GPU is enough and every tool is open source. Learners who want to move on to neural networks can continue with Deep Learning with Python.

Day 1 ML Foundations, Data and Regression

Section 1: Lab: Setting Up Python for Machine Learning

  • Install Python and create a project with a virtual environment using uv
  • Work in JupyterLab or notebooks in VS Code, with Google Colab as an alternative
  • Install NumPy, pandas, scikit-learn and Matplotlib with matching versions across the team
  • Review NumPy arrays, vectorisation and broadcasting used throughout the course

Section 2: Foundations of AI and Machine Learning

  • How AI, machine learning, deep learning and generative AI differ
  • Supervised, unsupervised and reinforcement learning with examples from organisations
  • The machine learning workflow from framing the problem and collecting data to training, evaluation and use
  • Overfitting, underfitting and the bias-variance tradeoff made simple
  • Problems where classic models are still a better fit than deep learning and LLMs

Section 3: Lab: Preparing and Exploring Data with pandas 3

  • Read CSV and Excel data and explore its structure with info and describe
  • Handle missing values, duplicates and data types, including the new string dtype in pandas 3
  • Copy-on-Write in pandas 3 and why chained assignment no longer works
  • Plot relationships in the data with Matplotlib
  • Split data into training and test sets correctly with train_test_split

Section 4: Lab: Linear Regression from First Principles

  • The idea behind linear regression, the cost function and finding the best fit
  • Write gradient descent yourself in NumPy to watch the model learn step by step
  • Build the same model with scikit-learn's LinearRegression and compare the results
  • Evaluate with MAE, RMSE and R² and interpret the errors
  • Reduce overfitting with Ridge and Lasso regularisation

Section 5: Logistic Regression and Evaluating Classifiers

  • The sigmoid function, probabilities and choosing a threshold
  • Confusion matrix, accuracy, precision, recall and F1-score
  • ROC curves, AUC and why accuracy alone can be misleading
  • Handle imbalanced data with class_weight and the right choice of metric
  • Lab: predict customers who are likely to cancel a service
Day 2 Pipelines, Evaluation and Classification Models

Section 6: Lab: Pipelines and ColumnTransformer

  • Data leakage and why preprocessing belongs inside a pipeline
  • StandardScaler, OneHotEncoder and SimpleImputer for mixed data types
  • Combine the steps with ColumnTransformer and Pipeline into a single object
  • Get DataFrame output with set_output and inspect the structure through the HTML display

Section 7: Cross-Validation and Hyperparameter Tuning

  • K-fold and stratified K-fold with cross_validate
  • Search for the best settings with GridSearchCV and RandomizedSearchCV
  • Read learning curves and validation curves to diagnose a model
  • Keep a test set for the final check and avoid tuning until the results flatter you
  • Lab: tune a whole pipeline and compare it with the baseline model

Section 8: Lab: K-Nearest Neighbours

  • Lazy learning and deciding by the nearest neighbours
  • Euclidean and Manhattan distance, and why features must be scaled
  • Choose K with cross-validation and see the effect of weighting
  • Use KNN for both classification and regression, and its limits on speed

Section 9: Lab: Naive Bayes and Classifying Thai Text

  • Bayes' theorem and the independence assumption behind Naive Bayes
  • Tokenise Thai text with PyThaiNLP before turning it into numbers
  • Vectorise text with CountVectorizer and TF-IDF
  • Train MultinomialNB and ComplementNB to categorise news
  • Read the key words for each category and analyse where the model goes wrong

Section 10: Lab: Support Vector Machines

  • Margins and support vectors when the data can be separated by a straight line
  • RBF and polynomial kernels for data that is not linearly separable
  • Tune C and gamma with GridSearchCV on the Iris dataset
  • Recognise handwritten digits with an SVM and read the confusion matrix
  • When to use LinearSVC instead of SVC on larger datasets
Day 3 Trees, Unsupervised Learning and Real Projects

Section 11: Lab: Decision Trees, Random Forests and Boosting

  • Decision trees, node splits and limiting depth to reduce overfitting
  • Random forests and the idea of bagging ensembles
  • HistGradientBoosting for large tabular datasets and categorical features
  • Explain models with feature importance and permutation_importance

Section 12: Unsupervised Learning: K-Means and PCA

  • Segment customers with K-Means and choose the number of clusters with the elbow method and silhouette score
  • Interpret the clusters so the business can act on them
  • Reduce dimensions with PCA and read the explained variance
  • Plot high-dimensional data in two dimensions to explore patterns

Section 13: Lab: Face Recognition with Eigenfaces

  • Understand the Olivetti Faces dataset and turn images into vectors
  • Find a suitable number of principal components and display the eigenfaces
  • Build a PCA and SVM pipeline and tune it with cross-validation
  • Evaluate the system and analyse the faces it gets wrong
  • Care points for face data, consent and PDPA

Section 14: Lab: Putting Models to Use

  • Save and load models with skops, and the risks of pickle files
  • Record library versions and training data so results can be reproduced
  • Build a demo page with Gradio so others can try the model
  • Use AI assistants to help write ML code, then check and re-evaluate every result

Section 15: Workshop: Capstone Project

  • Choose a problem and dataset and define the success metrics
  • Prepare the data, build a pipeline and compare at least three models
  • Tune the best model, check it against the test set and summarise its limits
  • Present the work with a demo page and plan the next step into deep learning

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

What is the difference between linear regression and logistic regression?

Linear regression predicts a continuous number, such as a house price or sales figure, by fitting the line that minimises overall error. Logistic regression classifies, for example whether a customer will cancel a service, by passing a linear combination through the sigmoid function to get a probability between 0 and 1 and applying a threshold. On the course you write gradient descent yourself before using scikit-learn, so you can see how the model learns.

What is cross-validation and why use it when building a model?

Cross-validation splits the data into several parts, for example five folds, and rotates which part is used for testing while the rest is used for training, then averages the results. This estimates performance on new data more reliably than a single split, helps reveal overfitting, and works with GridSearchCV to choose hyperparameters such as K in KNN or C in an SVM. Preprocessing should sit inside a pipeline so test data does not leak into training.

How does a support vector machine work, and what is a kernel for?

An SVM finds the line or hyperplane that separates classes with the widest possible margin from the nearest points of each class; those nearest points are the support vectors. When data cannot be split by a straight line, a kernel such as RBF or polynomial effectively maps it into a higher-dimensional space where separation is easier, with C and gamma tuned to control how strict the boundary is. On the course SVMs recognise handwritten digits and act as the classifier in the eigenfaces project.

Who is the Python for Machine Learning course for, and what should I know beforehand?

It suits programmers, system administrators, in-house IT development teams, teachers and students who want to start with machine learning. You need basic Python skills, some programming experience and confidence managing files on a computer. Upper secondary school maths is enough, because the statistics and algebra you need are explained again during the course.

What will I be able to do after the Python for Machine Learning course?

You will be able to prepare data with pandas, build pipelines that avoid data leakage, build and evaluate regression and classification models, apply KNN, Naive Bayes, SVMs, random forests and gradient boosting to suitable problems, categorise Thai news with TF-IDF, cluster data with K-Means, build an eigenfaces face recognition system, save models safely and create a demo page with Gradio. Participants who complete the training receive a Certificate of Completion.

Which software is used on the Python for Machine Learning course?

You use Python 3.12 or later, manage the project and libraries with uv, and write code in JupyterLab or VS Code with NumPy, pandas 3, scikit-learn 1.9, Matplotlib, PyThaiNLP, skops and Gradio, all of which are open source. Windows, Mac or Linux all work and no GPU is needed, but you should have permission to install software, or you can use Google Colab with a Google account instead.

Related articles

Articles are published in Thai.