Others · OTC-19

Data Science with Python and FastAPI

Data Science with Python and FastAPI is a course in predictive analytics with Python, from CRISP-DM and data preparation with pandas to building models with scikit-learn, tracking them with MLflow and serving them through a FastAPI prediction API backed by a database. It suits data scientists, Python developers and learners who have already completed a basic Python course.

Updated
From 11,610 THB / person 12,900 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration30 hours · 5 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

In many organisations data science work stops at the notebook. A model that forecasts sales or risk is finished but never used, because other systems cannot call it, nobody knows which version is best, and predictions are not kept for later review. Data science delivers value when models are built properly and handed over as a service that other systems can call securely.

This course takes learners through predictive analytics in Python from raw data to an API that works in practice. It starts by planning the project with CRISP-DM, preparing and cleaning data with pandas 3 and building models with scikit-learn 1.9, including regression, clustering, decision trees, association rules and neural networks, inside reusable pipelines. Learners then save and track models with MLflow and build a RESTful API with FastAPI that loads the model to make predictions, connects to a database with SQLModel, is protected with JWT, tested with pytest and run with Docker. The course closes with an end-to-end prediction system. (5 days, 6 hours per day, 30 hours in total, Intermediate level.)

What you’ll gain

  • Plan a predictive analytics project following the CRISP-DM process
  • Prepare, clean and explore data correctly with pandas 3 and charts
  • Build pipelines and models with scikit-learn, including regression, clustering, decision trees and neural networks
  • Evaluate models properly with cross-validation and tune hyperparameters
  • Save, compare and version models with skops and MLflow
  • Build a RESTful API with FastAPI that serves predictions from a model
  • Connect a database with SQLModel for CRUD operations and a prediction history
  • Protect the API with JWT, test it with pytest and run the system with Docker

Who this course is for

  • Data scientists and data analysts who want to take models out of the notebook and into real use
  • Python developers who want to add machine learning and API skills
  • Data engineers and IT teams who look after their organisation's prediction systems
  • Learners who have completed basic Python and want to move on to full data science work

Prerequisites

  • Basic Python, or completion of an introductory Python course
  • Basic statistics such as mean, standard deviation and relationships between variables
  • Basic SQL and an understanding of HTTP and JSON will help a great deal
  • A laptop that can run Python, VS Code and Docker Desktop, with permission to install software

Curriculum

Course Details

This is the 2026 edition of the Data Science with Python and FastAPI course. It keeps the original core of predictive analytics in Python and a FastAPI RESTful API with database access, rewritten for pandas 3, scikit-learn 1.9 and the current FastAPI. It runs for 5 days, 6 hours per day (30 hours in total, 09:00-16:00), as lectures with labs that build on fictional customer and sales data throughout. Intermediate level. Compared with the previous

edition it adds pipelines, cross-validation, gradient boosting, MLflow, skops, lifespan events, SQLModel, JWT, pytest and Docker. The course focuses on the path from data to a prediction API, unlike Data Science with Python, which concentrates on modelling, and the other FastAPI courses, which cover general API development. All tools are open source and no GPU is needed. Learners take home a lab guide, notebooks and code for every lab, and the prediction API project with docker-compose files.

Day 1 Data and Predictive Foundations

Section 1: Lab: Predictive Modelling and CRISP-DM

  • What predictive analytics is and which business problems suit prediction
  • The six stages of CRISP-DM, from understanding the problem to deployment
  • The path a model takes from a notebook to a service other systems can call
  • Install Python and manage the project with uv, with JupyterLab or VS Code
  • Lab: plan a customer churn prediction project with CRISP-DM

Section 2: Lab: Working with Data in pandas 3

  • Read data from CSV, Excel and SQL databases into a DataFrame
  • What is new in pandas 3: Copy-on-Write and the str data type by default
  • Select, filter and create columns with loc and assign
  • Join tables with merge and summarise with groupby and pivot_table
  • Lab: build a one-row-per-customer table from several data sources

Section 3: Lab: Data Cleaning and EDA

  • Find and handle missing values, duplicates and wrong data types
  • Detect outliers and decide whether to remove, fix or keep them
  • Handle dates, text and categories
  • Explore the data with Matplotlib and seaborn charts
  • Lab: clean the customer data and summarise the first findings

Section 4: Statistics for Predictive Modelling

  • Distributions, central tendency, spread and skewness
  • Correlation, and the difference between association and cause
  • Splitting data into train and test sets properly, including stratified splits
  • What data leakage is and where it tends to creep in
  • Lab: test simple hypotheses and set a baseline for the model
Day 2 Regression, Classification and Evaluation

Section 5: Lab: Feature Engineering and Pipelines

  • Encode categories with OneHotEncoder and scale numeric values
  • Handle columns of different types together with ColumnTransformer
  • Keep preparation and model in a single pipeline to prevent data leakage
  • Create new features from dates, behaviour and running totals
  • Lab: a pipeline that takes raw data and makes it ready for the model

Section 6: Lab: Linear Regression

  • How linear regression works and how to interpret its coefficients
  • Evaluate with MAE, RMSE and R²
  • Reduce overfitting with Ridge and Lasso
  • Check the residuals to see where the model goes wrong
  • Lab: forecast a store's weekly sales

Section 7: Lab: Logistic Regression and Evaluation

  • Logistic regression for predicting classes and probabilities
  • Confusion matrix, precision, recall, F1 and ROC AUC
  • Choose a threshold that matches the business cost
  • Deal with imbalanced data using class_weight and suitable metrics
  • Lab: predict which customers are likely to cancel

Section 8: Cross-Validation and Hyperparameters

  • Why a single train and test split is not enough
  • K-fold and stratified cross-validation with cross_validate
  • Tune hyperparameters with GridSearchCV and RandomizedSearchCV
  • Compare several models fairly on the same data
  • Lab: find the best model and settings for the churn problem
Day 3 Clustering, Trees and Neural Networks

Section 9: Lab: Data Clustering

  • Unsupervised learning and customer segmentation problems
  • K-Means and choosing the number of clusters with the elbow and silhouette methods
  • DBSCAN and HDBSCAN for clusters that are not round
  • Describe each cluster so the business can act on it
  • Lab: segment customers by purchasing behaviour with RFM

Section 10: Lab: Decision Trees and Ensembles

  • How a decision tree works and how to read rules from it
  • Limit tree depth to reduce overfitting
  • Random Forest and HistGradientBoosting for tabular data
  • Explain models with feature importance and permutation importance
  • Lab: compare a decision tree with gradient boosting on the same problem

Section 11: Lab: Association Rules Discovery

  • Market basket analysis and products bought together
  • Support, confidence and lift
  • Find rules with Apriori and FP-Growth from mlxtend
  • Filter for useful rules and turn them into business recommendations
  • Lab: find products to promote together from shopping basket data

Section 12: Lab: Introduction to Neural Networks

  • Neurons, layers, activation functions and learning through backpropagation
  • Build neural networks with MLPClassifier and MLPRegressor
  • Scale the data, use early stopping and read learning curves
  • When tabular data is better served by gradient boosting, and when to move on to deep learning
  • Lab: compare a neural network with the models built earlier
Day 4 From Model to Prediction API

Section 13: Lab: Saving and Tracking Models with MLflow

  • Save models with skops, which is safer than pickle and joblib
  • Log parameters, metrics and model files for each experiment with MLflow Tracking
  • Compare experiments in the MLflow UI
  • Register models in the Model Registry and give the production version an alias
  • Lab: choose the best model and prepare it for the API

Section 14: Lab: FastAPI Fundamentals

  • Declare GET, POST, PUT and DELETE endpoints
  • Take values from the path, query string and request body with Pydantic v2
  • Test through Swagger UI at /docs and with Postman or Bruno
  • Split routes into several files with APIRouter and configure CORS
  • Lab: a customer data API with automatic OpenAPI documentation

Section 15: Lab: A Prediction API with FastAPI

  • Load the model once at start-up with a lifespan handler
  • Design Pydantic schemas that match the features the model expects
  • Single and batch prediction endpoints that return probabilities
  • Handle malformed input and return clear error messages
  • Lab: a churn prediction API that uses the model from the registry

Section 16: Lab: Connecting a Database with SQLModel

  • The ORM idea and connecting FastAPI to PostgreSQL through SQLModel
  • Create models, sessions and database dependencies
  • Write GET, POST, PUT and DELETE endpoints that read and write real data
  • Store a prediction history with the model version for later review
  • Lab: customer CRUD and a prediction log table
Day 5 Security, Quality and the Complete System

Section 17: Lab: Authentication and Authorisation

  • The OAuth2 password flow and JSON Web Tokens with PyJWT
  • Hash passwords with pwdlib using Argon2
  • Role-based permissions such as viewer, user and model administrator
  • API keys for other systems that call the prediction service
  • Lab: protect the prediction endpoints and customer data

Section 18: Lab: Testing and API Quality

  • Write tests with pytest and FastAPI's TestClient
  • Test the model contract, such as input types and the range of outputs
  • Use a test database separate from the live system
  • Logging and measuring API response times
  • Lab: a test suite that runs before every new release

Section 19: Lab: Docker and Looking After Models in Use

  • Build a Docker image of the API and combine it with PostgreSQL in Docker Compose
  • Configure the system with environment variables and pydantic-settings
  • Monitor whether incoming data drifts away from the training data
  • Plan retraining and switch model versions through an alias without downtime
  • Lab: run the whole prediction system with a single command

Section 20: Workshop: Capstone End-to-End Prediction System

  • Choose a brief such as sales forecasting, customer risk or customer segmentation
  • Go all the way from data preparation to building the model and logging it in MLflow
  • Hand it over as an API with a database, authentication and a test suite
  • Present the work, review it together and wrap up with a go-live checklist

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 CRISP-DM and what are its stages?

CRISP-DM is a standard framework for data mining and analytics projects with six stages: business understanding, data understanding, data preparation, modelling, evaluation and deployment. The stages are iterative, so weak evaluation results can send you back to prepare the data again. In this course the deployment stage is done for real by serving the model as an API through FastAPI.

What is the difference between linear regression and logistic regression?

Linear regression predicts a continuous number, such as sales or property values, by fitting the line that best describes the relationship between variables, and is evaluated with MAE or RMSE. Logistic regression predicts a category or the likelihood of an event, such as whether a customer will cancel, giving a probability between 0 and 1 and then applying a threshold to decide the class. It is evaluated with precision, recall or ROC AUC.

How do you make a predictive model available to other systems through FastAPI?

Keep the data preparation and the model in a single scikit-learn pipeline, then save it with skops or register it in the MLflow Model Registry. In the FastAPI app, load the model once at start-up with a lifespan handler, define a Pydantic schema for the input data, and write a POST endpoint that calls predict and returns the result as JSON with probabilities. Test it through the Swagger page at /docs and write a test suite with pytest.

Who is the Data Science with Python and FastAPI course for, and what should I know beforehand?

It suits data scientists and data analysts who want to take models out of the notebook and into real use, Python developers who want to add machine learning skills, and data engineers or IT teams who look after prediction systems. You should know basic Python or have completed an introductory Python course and understand basic statistics. Some SQL and an understanding of HTTP and JSON will help a great deal.

What will I be able to do after the Data Science with Python and FastAPI course?

You will be able to plan projects with CRISP-DM, prepare and clean data with pandas 3, build models with scikit-learn including linear and logistic regression, clustering, decision trees, gradient boosting, association rules and neural networks, evaluate them with cross-validation, track and version them with MLflow, and build a FastAPI prediction API connected to a database with SQLModel, protected with JWT, tested with pytest and run with Docker. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the Data Science with Python and FastAPI course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your own work, such as building models and a prediction API for sales or risk problems close to your real cases. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.