Skip to main content
AIDevOps
  • Learn
  • Learning Paths
  • Practice
  • Open Source
  • Books
  • Engineering

    AI DevOpsThe full map of building and operating AI servicesLLMOpsLLM deployment Β· evaluation Β· observabilityHands-on ProjectsBuild AI Agent projects

    Knowledge

    DocsTechnical documentationBlogEngineering articlesPloggerDevelopment log feed

    Validate

    Certification3-level skills certification Β· coming soon
AI Models
LlamaTutorial|MistralTutorial|GemmaTutorial|DeepSeekTutorial|QwenTutorial
🧠 AI Core
AI Intro & RoadmapML FundamentalsLLM Fundamentals|Python AIC++|PyTorchTensorFlowJAX
πŸ€– AI Applied Development
Applied AI Intro & RoadmapHugging FaceLangChainLlamaIndexLLMOps|LangGraphMCPMulti-AgentAgent Evaluation
🧠 AI Agent Development
Finance AI AgentLLM API ServerStock Investing AgentAIOps AI AgentEducation AI AgentCoding AI Agent
🌱 Spring Cloud
Spring Intro & RoadmapSpring Cloud GatewaySpring BootJava|Spring AISpring SecuritySpring BatchSpring JPA
🐳 DevOps
DevOps Intro & RoadmapLinuxDockerCI/CD|Kubernetes BasicsK8s AdvancedPrometheusGrafana
🧱 Infrastructure
Infrastructure Intro & RoadmapNginxRedis
☁️ Cloud
Cloud Intro & RoadmapAWSGCPAzureNCPCloudflare
🎨 Frontend
Frontend Intro & RoadmapJavaScriptTypeScript|ReactNext.js|VueNuxt|Electron
πŸ“± Mobile
Mobile Intro & RoadmapKotlinAndroidFlutter
βš™οΈ Backend
Backend Intro & RoadmapPython BasicsFastAPIDjangoFlask|CGoGinNode.js
πŸ’Ύ Database
DB Intro & RoadmapCore SQLOracleMySQLPostgreSQL|MongoDBVector DB
πŸ§ͺ Testing
k6JMeternGrinder
AIDevOps

Engineering AI. From Code to Production.
An engineering learning platform for building and operating AI and AI Agents

Learn

  • All Guides
  • Learning Paths
  • AI Tutorial
  • Practice
  • Books

Resources

  • AI DevOps
  • LLMOps
  • Hands-on Projects
  • Docs
  • Blog
  • Plogger
  • Open Source
  • Certification (coming soon)

Start Here

  • AI Core Roadmap
  • AI Applied Development Roadmap
  • Spring Cloud Roadmap
  • DevOps Roadmap
  • Infrastructure Roadmap

Β 

  • Cloud Roadmap
  • Frontend Roadmap
  • Mobile Roadmap
  • Backend Roadmap
  • Database Roadmap
Β© 2026 AIDevOps. All rights reserved.
Terms of ServicePrivacy PolicySitemaptestforge.kr
  1. Home
  2. Learn
  3. AI Core
  4. ML Fundamentals
Guide to AI learning fundamentals

πŸ“ ML Fundamentals Complete Guide

Visitors

From the big picture of what machine learning is to learning types, core algorithms, neural networks, metrics, overfitting, hyperparameter tuning, and MLOps β€” the ML fundamentals to get solid before learning LLMs, covered from start to finish in a way that is easy but deep.

  • Beginner
  • Updated Oct 1, 2026
  • ~11 min read
  • 12 sections
  • 5 code examples

Learning Paths that include this guide

This guide is one step in the paths below. Study it together with the steps before and after.

  • AI Foundations β†’
Organize machine learning conceptsNeural network basicsUnderstand the PyTorch training loopGetting started as an AI engineerModel evaluation and tuning

Contents

0 / 15
  1. How to use this guide
  2. Architecture diagrams
  3. The big picture: AI Β· ML Β· DL Β· LLM
  4. The three kinds of learning
  5. The 6-step ML pipeline
  6. Map of core algorithms
  7. Neural network basics
  8. CNN Β· RNN at a glance
  9. Loss functions and optimization
  10. Model evaluation metrics
  11. Overfitting and regularization
  12. Hyperparameter tuning
  13. A real-world ML workflow
  14. Deployment and MLOps
  15. Frequently asked questions
Contents 15 sections
  1. How to use this guide
  2. Architecture diagrams
  3. The big picture: AI Β· ML Β· DL Β· LLM
  4. The three kinds of learning
  5. The 6-step ML pipeline
  6. Map of core algorithms
  7. Neural network basics
  8. CNN Β· RNN at a glance
  9. Loss functions and optimization
  10. Model evaluation metrics
  11. Overfitting and regularization
  12. Hyperparameter tuning
  13. A real-world ML workflow
  14. Deployment and MLOps
  15. Frequently asked questions

How to use this guide

How to read it

Understanding ML Fundamentals as a real-world workflow

From the big picture of what machine learning is to learning types, core algorithms, neural networks, metrics, overfitting, hyperparameter tuning, and MLOps β€” the ML fundamentals to get solid before learning LLMs, covered from start to finish in a way that is easy but deep. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.

Key perspective

AI / LLM systems

Look beyond the model and the prompt: connect the data flow, evaluation, and post-deployment operating metrics in one view.

Organize machine learning conceptsNeural network basicsUnderstand the PyTorch training loopGetting started as an AI engineerModel evaluation and tuning

Architecture diagrams

To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning ML Fundamentals.

Learning flow

Rendering diagram…

Architecture view

Rendering diagram…

The big picture: how AI, ML, DL, and LLMs relate

When you first open ML Fundamentals, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.

We start by sorting out the terms. Artificial intelligence (AI) is the broadest goal: "build systems that judge like people". Machine learning (ML) is one way of reaching that goal, an approach in which rules are found from data instead of being hand-coded one by one. Deep learning (DL) is a subfield of ML that stacks many layers of neural networks (deep) to learn complex patterns. An LLM (large language model) is, within deep learning, a model that handles language by training on vast text with the Transformer architecture. In other words, AI βŠƒ ML βŠƒ DL βŠƒ LLM, each more specific than the last.
LayerDefinitionExamples
AI (artificial intelligence)The whole range of systems that perceive, judge, and act like peopleChess engines, voice assistants, recommender systems
ML (machine learning)The subfield of AI that learns rules from dataSpam filters, credit scoring models
DL (deep learning)The subfield of ML that learns complex patterns with multi-layer neural networksImage classification (CNN), speech recognition
LLM (large language model)A branch of DL that learns language on the Transformer architectureGPT, Claude, LLaMA

Tip

This guide covers the AI βŠƒ ML βŠƒ DL part, the basic fitness behind "why LLMs behave the way they do". The structure of LLMs themselves, such as the Transformer and tokenizers, is covered in the LLM Fundamentals guide that follows.

The three kinds of learning (+1)

The three kinds of learning (+1) is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

Machine learning divides by "what is treated as the answer during training" into three kinds, plus a fourth that has become especially important in the LLM era. Working out first which of these a problem falls under lets you pick the right tool much faster.
KindAnswer dataTypical problemsExamples
Supervised learningNeeds input-answer pairsClassification, regressionSpam classification, stock price prediction
Unsupervised learningNo answersClustering, dimensionality reductionCustomer segments, anomaly detection
Reinforcement learningA reward signalSequential decision makingRLHF, game AI, robot control
Self-supervised learningThe data itself is the answerRepresentation learningLLM pre-training (next-token prediction)

Tip

LLM pre-training is self-supervised learning ("guess the next token"), and the RLHF alignment stage of ChatGPT-style models is reinforcement learning β€” a single model goes through several kinds of learning in stages.

The 6-step ML pipeline: how data becomes a model

Here you look at The 6-step ML pipeline: how data becomes a model alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

In practice, building a model is far broader than "picking an algorithm". Knowing the 6 steps below means that, whatever project you meet, you never lose track of which step you are in.
pipeline_skeleton.pyPYTHON
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report

# 1-2. Load the data
df = pd.read_csv("customers.csv")
X, y = df.drop(columns=["churn"]), df["churn"]

# 3. Split the data first! (preprocessing parameters are learned from train only)
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, stratify=y, random_state=42
)
scaler = StandardScaler().fit(X_train)          # fit on train only
X_train_s = scaler.transform(X_train)
X_test_s  = scaler.transform(X_test)             # test is only transformed

# 4. Start with a baseline model
model = LogisticRegression(max_iter=1000)
model.fit(X_train_s, y_train)

# 5. Evaluate
y_pred = model.predict(X_test_s)
print(classification_report(y_test, y_pred))
StepWhat you doCommon trap
1. Problem definitionDecide whether it is classification/regression/clustering and set the success criterion (metric) firstAiming only at "get it right" with no metric
2. Data collectionGather data relevant to the problemLabeling criteria differ from person to person, so data quality is uneven
3. Preprocessing & feature engineeringHandle missing values, normalize, encode categoricals, create derived featuresData leakage, where test data information seeps into preprocessing
4. Model trainingStart from a baseline and move gradually to more complex modelsJumping straight to a complex deep learning model with no validation
5. EvaluationMeasure performance with the right metric, analyze the error casesJudging by accuracy alone (dangerous with class imbalance)
6. Deployment & monitoringShip it to production and keep watching for performance decayIgnoring drift as the data distribution changes after deployment

Tip

Always apply scaler.fit() to the train data only β€” if test statistics seep into training, you get data leakage and performance is measured as better than it really is.

Map of core algorithms

Map of core algorithms is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

The classic algorithms used since before deep learning are still powerful today as baseline models and on tabular data. Drawing a map of what exists before jumping into neural networks makes it easier to pick the tool that fits the problem.
AlgorithmTypeOne-line principleTraits
Linear regressionSupervised (regression)Predicts a continuous value as a weighted sum of the inputsEasy to interpret, fast, try first as a baseline
Logistic regressionSupervised (classification)Turns the weighted sum into a 0-1 probability with a sigmoidThe standard baseline for binary classification
Decision tree / random forestSupervisedSplits the data by asking questions repeatedly, like pruningStrong on tabular data, little preprocessing needed
Gradient boosting (XGBoost and others)SupervisedEach new tree corrects the errors of the previous onesThe model family that regularly wins Kaggle competitions
k-NNSupervisedPredicts by majority vote/average of the k nearest neighborsSimple and distance-based, slow on large data
SVMSupervisedFinds the boundary that separates two classes with the widest marginStrong on small-to-medium high-dimensional data
k-meansUnsupervisedForms clusters by moving the centroids repeatedlyDistance-based clustering, the number of clusters k is set in advance
PCAUnsupervisedRebuilds the axes along the directions of greatest varianceCompresses high-dimensional data to low dimensions (dimensionality reduction)

Tip

When starting a new project, always run a light baseline such as linear/logistic regression or a decision tree first. If a complex model is only 1-2 percentage points better than the baseline, the complexity may not be worth it.

Neural network basics

Here you look at Neural network basics alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

A neural network is perceptrons (one linear function + an activation function) stacked in layers. The output of each layer becomes the input of the next, and at the end the error against the answer is passed back to the earlier layers by backpropagation to update the weights. Put simply, it is a process of turning the input into ever more abstract representations through several stages of filters β€” for an image, "lines β†’ shapes β†’ parts β†’ the whole object".
mlp_forward.pyPYTHON
import torch
import torch.nn as nn

# ── The simplest MLP (multilayer perceptron) ──────
class SimpleMLP(nn.Module):
    def __init__(self, in_dim: int, hidden_dim: int, out_dim: int):
        super().__init__()
        self.net = nn.Sequential(
            nn.Linear(in_dim, hidden_dim),
            nn.ReLU(),                      # non-linear activation function
            nn.Linear(hidden_dim, hidden_dim),
            nn.ReLU(),
            nn.Linear(hidden_dim, out_dim),
        )

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return self.net(x)

model = SimpleMLP(in_dim=10, hidden_dim=32, out_dim=1)
x = torch.randn(4, 10)          # batch size 4, 10 features
y_pred = model(x)               # forward pass
print(y_pred.shape)             # torch.Size([4, 1])

# Calling backward() computes the gradient of every weight automatically (backpropagation)
loss = y_pred.sum()
loss.backward()
Activation functionTraitsMain use
SigmoidSquashes the output to 0-1, suffers from vanishing gradientsThe last layer of binary classification
ReLUNegatives become 0, positives pass through β€” fast to compute with fewer vanishing gradientsThe default choice for hidden layers
GELUA smoothed form of ReLUTransformer family models
SoftmaxTurns several values into a probability distribution that sums to 1The last layer of multi-class classification

Tip

Without an activation function (ReLU and the like), however many layers you stack, the result is equivalent to a single linear function β€” non-linearity is the key to the expressive power of neural networks.

CNN Β· RNN at a glance: deep learning before the Transformer

CNN Β· RNN at a glance: deep learning before the Transformer is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

Before the Transformer took over, deep learning used dedicated architectures matched to the kind of data. They are still valid choices for image and time-series problems, so it is worth knowing at least the concepts.
ArchitectureKey ideaMain useLimits
CNN (convolutional neural network)Small filters slide over the image to detect local patterns (lines, edges)Image classification, object detectionRelatively weak at capturing long-range relationships
RNN / LSTMUses the hidden state of the previous time step as input to the next, reflecting orderTime-series forecasting, early machine translationForgets the beginning as sentences get long, and is slow because it processes sequentially
TransformerSelf-Attention compares every position with every other at once β€” capturing relationships directly however far apartLanguage models (LLMs), modern vision models (ViT)Compute grows with the square of the input length

Tip

If an RNN "reads one word at a time in order and remembers", a Transformer "lays the whole sentence out at once and computes the relationships between words simultaneously" β€” that difference is the key reason LLMs could scale up quickly with parallel training. The detailed architecture continues in the LLM Fundamentals guide.

Loss functions and optimization

Here you look at Loss functions and optimization alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

A loss function expresses as a number how far the prediction of the model is from the answer. An optimizer is the algorithm that moves the weights little by little in the direction that minimizes that loss. Imagine standing on a mountain in fog β€” feeling the slope (gradient) under your feet and taking one step at a time (the size of the learning rate) in the steepest downhill direction is gradient descent.
train_loop.pyPYTHON
import torch.nn as nn
import torch.optim as optim

model     = SimpleMLP(in_dim=10, hidden_dim=32, out_dim=1)
criterion = nn.MSELoss()
optimizer = optim.AdamW(model.parameters(), lr=1e-3)

for epoch in range(100):
    optimizer.zero_grad()             # reset the previous gradients
    y_pred = model(x_train)
    loss   = criterion(y_pred, y_train)
    loss.backward()                   # compute gradients by backpropagation
    optimizer.step()                  # update the weights along the gradient

    if epoch % 20 == 0:
        print(f"epoch {epoch}: loss={loss.item():.4f}")
CategoryCommon choiceUse
Regression lossMSE (mean squared error)Predicting continuous values (price, temperature, and so on)
Classification lossCross-EntropyClass classification, next-token prediction in LLMs
OptimizerSGDSimple and light, sensitive to learning rate tuning
OptimizerAdam / AdamWThe default choice for most deep learning and LLM training

Tip

If the learning rate is too large the model overshoots the optimum and oscillates, and if it is too small training becomes painfully slow β€” start around 1e-3 and adjust while watching the loss curve.

How a model is graded: evaluation metrics

Here you look at How a model is graded: evaluation metrics alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

"Is a model with 95% accuracy a good model?" The answer is "it depends". On data where only 1% of transactions are fraudulent, answering "always normal" already gives 99% accuracy. You only see real performance when you pick the metric that fits the problem type.
confusion_matrix.pyPYTHON
from sklearn.metrics import confusion_matrix, precision_score, recall_score, f1_score

y_true = [1, 0, 1, 1, 0, 1, 0, 0]
y_pred = [1, 0, 0, 1, 0, 1, 1, 0]

tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()
print(f"TP={tp} FP={fp} FN={fn} TN={tn}")
print(f"precision={precision_score(y_true, y_pred):.2f}")
print(f"recall={recall_score(y_true, y_pred):.2f}")
print(f"f1={f1_score(y_true, y_pred):.2f}")
Problem typeMetricMeaning
ClassificationAccuracyShare of all cases it got right β€” trustworthy only when the classes are balanced
ClassificationPrecisionShare of predicted "positives" that are truly positive β€” matters when false positives are costly
ClassificationRecallShare of true positives the model found β€” matters when misses are unacceptable (disease, fraud)
ClassificationF1 ScoreThe harmonic mean of Precision and Recall β€” the balance of the two in one number
ClassificationROC-AUCOverall classification performance across thresholds (closer to 1 is better)
RegressionMAE / RMSEAverage difference between predicted and actual values (RMSE is more sensitive to large errors)
RegressionRΒ² (coefficient of determination)How much of the variance in the data the model explains (closer to 1 is better)

Tip

On data with imbalanced classes (fraud detection, disease diagnosis, and so on), always look at Precision, Recall, and F1 together instead of Accuracy. Which to weight more is decided by whether "the cost of a false positive" or "the cost of a miss" is greater.

Overfitting and regularization

Overfitting and regularization is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

Overfitting is when a model memorizes even the noise in the training data and then performs worse on new data. Training loss keeps falling while validation loss starts to rise again: that is the signal. It is also explained by the bias-variance tradeoff β€” a model that is too simple has high bias and underfits, and a model that is too complex has high variance and overfits.
TechniqueHow it works
Train/Val/Test splitDetects the onset of overfitting early with validation data
K-Fold cross-validation (K-Fold CV)Splits the data into K parts and rotates which one validates, making the evaluation more reliable
DropoutRandomly switches off some neurons during training to prevent reliance on specific neurons
L1/L2 regularizationPenalizes weight magnitude to keep the model simple
Early StoppingStops training early when validation loss no longer improves
Data augmentationTransforms and expands the training data to improve generalization

Tip

If "the model scores 99 on the training data but 70 in the real world", it is almost always overfitting. Before making the model more complex, try regularization, data augmentation, and more data.

Hyperparameter tuning

Here you look at Hyperparameter tuning alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.

Unlike weights, which are set automatically by training, hyperparameters are settings a person has to choose in advance (learning rate, hidden layer size, batch size, number of trees, and so on). Finding good hyperparameters alone can change performance a great deal.
random_search.pyPYTHON
from sklearn.model_selection import RandomizedSearchCV
from sklearn.ensemble import RandomForestClassifier

param_dist = {
    "n_estimators": [100, 200, 400],
    "max_depth": [None, 5, 10, 20],
    "min_samples_split": [2, 5, 10],
}

search = RandomizedSearchCV(
    RandomForestClassifier(random_state=42),
    param_distributions=param_dist,
    n_iter=20, cv=5, scoring="f1", random_state=42,
)
search.fit(X_train, y_train)
print(search.best_params_)
MethodDescriptionWhen to use it
Grid SearchLays out every possible combination on a grid and searches exhaustivelyWhen the search space is small
Random SearchSearches by sampling combinations at randomMore efficient than Grid Search, the default choice in most cases
Bayesian OptimizationPicks the next point to try intelligently based on previous resultsWhen training is expensive and trials must be spent carefully

Tip

The hyperparameter with the most impact is usually the learning rate β€” before anything else, search the learning rate widely on a log scale (0.1, 0.01, 0.001...).

A real-world ML workflow

This section covers A real-world ML workflow from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.

In practice, the data pipeline and validation strategy often decide the outcome more than the model architecture does. Use the order below as your basic checklist.

Tip

  • Split the data into Train/Validation/Test first, and never look at Test until the final evaluation.
  • Run a baseline (simple regression/decision tree) first to establish a minimum performance bar, then move to complex models.
  • Always plot the training and validation loss curves together to check for overfitting by eye.
  • Error analysis β€” looking at the wrong predictions with your own eyes β€” gives far more hints for improvement than a single metric.

Overview of deployment and MLOps

Overview of deployment and MLOps is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.

Training a model and operating it reliably in production are entirely different problems. MLOps is the practice that systematizes model deployment, monitoring, and retraining.
ConceptDescription
Model servingWrapping a trained model as an API that answers real-time prediction requests
Data driftThe distribution of production input data moving away from what it was at training time
Model driftModel performance decaying gradually over time because of drift and similar causes
A/B testing / shadow deploymentApplying a new model to a slice of traffic, or comparing results without affecting real use
VersioningVersioning data, code, and model artifacts together for reproducibility

Tip

  • It is not "deploy once and done" β€” production data distributions keep changing, so always plan performance monitoring and periodic retraining together.
  • As the next step, continue to the LLM Fundamentals guide, which covers the pre-training and fine-tuning structure of Transformers/LLMs.

ML Fundamentals: frequently asked questions

What is the difference between supervised and unsupervised learning?

Supervised learning trains on data that has both inputs and correct answers, then predicts the answer for new inputs. Spam classification and price prediction are examples. Unsupervised learning finds structure in data without answers; clustering customers into similar groups and dimensionality reduction are typical.

What is overfitting and how do I prevent it?

Overfitting is when a model memorizes accidental patterns in the training data, so it does well on the training data and worse on new data. You detect it by checking performance on validation data that was not used for training, and reduce it with more data, a simpler model, regularization, or early stopping.

Why split data into training, validation, and test sets?

The training set fits the model, the validation set is for choosing hyperparameters and models, and the test set estimates real performance once at the end. If you adjust the model while looking at the test set, the model adapts to it and the measured performance looks better than it is. That is why the test set stays untouched until the end.

← Previous guideAI Intro & RoadmapNext guide β†’LLM Fundamentals