AI and ML Fundamentals

Learn the key concepts and terminology of artificial intelligence and machine learning to effectively document these technologies.

Table of Contents

Now that we’ve packed our bags with curiosity, let’s step into the world of Artificial Intelligence (AI) and Machine Learning (ML).

You don’t need a PhD in math to understand these concepts. Just bring your imagination, a few metaphors, and maybe a cup of coffee.

AI vs ML Relationship
AI is the big umbrella, ML is the clever part inside, and deep learning is its overachieving cousin.

What Is AI? What Is ML? And Why Should You Care?

Let’s break it down as simply as possible.

Artificial Intelligence (AI)

Think of AI as the big idea: teaching machines to behave intelligently—like playing chess, recognizing your face in a photo, or making movie recommendations.

Machine Learning (ML)

ML is how machines learn. Instead of being programmed with strict rules, they look at data and learn from patterns. Like how you get better at riding a bicycle by practicing.

Deep Learning

Deep learning is a subset of ML. It uses neural networks with many layers to learn complex things—like understanding spoken language or recognizing animals in photos.

Types of Machine Learning: How Machines Learn

Learning Types

Supervised Learning

This is like learning with a teacher. You show the algorithm examples with answers, and it learns to make predictions.

Example: Teach it the difference between cats and dogs using labeled images.

Common algorithms:

  • Linear and Logistic Regression
  • Support Vector Machines
  • Decision Trees and Random Forests
  • Neural Networks

Unsupervised Learning

Here, the machine learns without labeled data. It finds patterns on its own.

Example: Grouping customers based on purchasing habits without telling the algorithm what the groups should be.

Common algorithms:

  • K-means Clustering
  • Hierarchical Clustering
  • Principal Component Analysis
  • Association Rules

Reinforcement Learning

The algorithm learns by doing, receiving rewards or penalties. It’s trial and error at scale.

Example: Learning to play a video game by winning or losing points based on actions.

Common algorithms:

  • Q-Learning
  • Deep Q Networks (DQN)
  • Policy Gradient Methods
  • Actor-Critic Methods

The Machine Learning Pipeline

Think of this as the recipe for building an ML solution.

ML Pipeline

1. Data Collection and Preparation

Start with gathering data. It might come from:

  • Databases
  • Sensors or devices
  • User interactions
  • Web scraping
  • Public datasets

Then clean the data:

  • Handle missing values
  • Remove duplicates
  • Fix incorrect data types
  • Normalize values

2. Exploratory Data Analysis (EDA)

Understand your data using:

  • Statistical summaries
  • Visualizations
  • Correlation checks
  • Outlier detection

3. Feature Engineering

Features are what the model uses to make decisions:

  • Create new features
  • Scale or normalize data
  • Encode text or categories
  • Select the most relevant features

4. Model Training and Selection

Pick the right algorithm for the job, then:

  • Split data into training and validation sets
  • Train the model
  • Tune parameters (hyperparameters)
  • Use cross-validation to test stability

5. Evaluation

Use metrics to see how well the model works.

How do we know if our model is any good? Let's talk metrics!

Task Type Metric In Plain English When to Use It Score Range
Classification Accuracy 🎯 "How often is my model right?" When all mistakes cost the same
0-100% (higher is better)
Precision 🔍 "When it predicts 'yes', how often is it correct?" When false alarms are expensive
0-100% (higher is better)
Recall 🕸️ "What percentage of actual 'yes' cases did it catch?" When missing positives is costly
0-100% (higher is better)
F1 Score ⚖️ "The harmony between precision and recall" When you need balance between both
0-100% (higher is better)
Regression MAE 📏 "On average, how far off are my predictions?" When all errors matter equally Lower is better
MSE 📊 "Like MAE, but big mistakes are punished more" When large errors are particularly bad Lower is better
RMSE 📉 "MSE, but brought back to original units" When you want errors in original units Lower is better
R² 📈 "What percentage of the variation does my model explain?" When comparing models across datasets
0-1 (higher is better)

Pro tip: No single metric tells the whole story. Always consider multiple metrics and the real-world impact of your model's predictions!

6. Deployment

Put the model into production:

  • Expose it via an API
  • Integrate it into apps
  • Set up monitoring

7. Monitoring and Maintenance

Even after deployment, your model needs care:

  • Watch performance
  • Retrain as new data arrives
  • Handle concept drift

Common Machine Learning Pitfalls

Common Pitfalls

Overfitting

The model memorizes the training data too well and fails on new data.

Fix it by:

  • Simplifying the model
  • Adding more data
  • Using regularization

Underfitting

The model is too simple and fails to learn from the data.

Fix it by:

  • Using a more complex model
  • Adding more useful features
  • Allowing more training time

Data Leakage

The model accidentally uses information it shouldn’t have during training.

Fix it by:

  • Carefully splitting data
  • Avoiding future info
  • Designing features responsibly

Class Imbalance

When one class dominates, the model might ignore the smaller class.

Fix it by:

  • Resampling techniques
  • Generating synthetic data
  • Using appropriate evaluation metrics

Comparing Algorithms

Algorithm Comparison

Choosing the right algorithm is like picking the right tool for a job. Let's meet the contenders!

Algorithm What It's Good At Where It Struggles Perfect For Complexity
LR
Linear Regression Regression
  • Simple to understand and explain
  • Fast to train, even on large datasets
  • Clear relationship between inputs and outputs
  • Can only model straight-line relationships
  • Easily thrown off by outliers
  • Assumes features don't influence each other
  • House price predictions
  • Sales forecasting
  • Simple trend analysis
Beginner Friendly
LG
Logistic Regression Classification
  • Gives probability of outcomes
  • Resists the urge to overcomplicate
  • Results make logical sense
  • Limited to simple yes/no boundaries
  • Best for binary outcomes
  • Needs feature preparation
  • Email spam filters
  • Credit approvals
  • Medical diagnosis
Beginner Friendly
DT
Decision Trees Both
  • Maps easily to human decision-making
  • Works with numbers and categories
  • Minimal data preprocessing needed
  • Tends to memorize training data
  • Can favor majority classes
  • Small data changes can completely reshape the tree
  • Customer segmentation
  • Medical diagnosis flows
  • Risk categorization
Intermediate
RF
Random Forest Both
  • Resists memorizing training data
  • Handles large, messy datasets like a champ
  • Tells you which features matter most
  • Less intuitive than single trees
  • Computationally hungry
  • Can be biased with categorical variables
  • Detecting fraudulent transactions
  • Predicting customer behavior
  • Environmental modeling
Intermediate
SVM
Support Vector Machine Both
  • Handles high-dimensional data well
  • Memory efficient for complex tasks
  • Clear separation between classes
  • Struggles with large datasets
  • Requires careful feature scaling
  • Parameter tuning is an art form
  • Text categorization
  • Image classification
  • Biological classifications
Advanced
NN
Neural Networks Both
  • Models incredibly complex patterns
  • Adapts to almost any data type
  • State-of-the-art results in many fields
  • Requires mountains of training data
  • Computationally expensive
  • The ultimate "black box"
  • Image recognition
  • Natural language processing
  • Game playing AI
Expert Level

💡 Pro tip: Simpler algorithms often outperform complex ones on smaller datasets. Don't reach for a neural network when linear regression will do!

Neural Networks Explained

Neural Network Anatomy

Neural networks are inspired by the human brain, but they work on numbers.

Structure

  • Input Layer: Takes in raw data (like pixels or numbers)
  • Hidden Layers: Process information and find patterns
  • Output Layer: Gives the final prediction
  • Neurons: Each node that does some math
  • Weights: Control how strongly inputs influence outputs

How Training Works

  1. Data goes forward through the layers (forward pass)
  2. Compare prediction to actual result (loss)
  3. Send feedback backward to update weights (backpropagation)
  4. Repeat until it gets better

Common Types

  • Convolutional Neural Networks (CNNs): Best for images
  • Recurrent Neural Networks (RNNs): Great for sequences and time
  • Transformers: Power modern language models
  • Generative Adversarial Networks (GANs): Create new content

The Neural Network Family: Each One Has Its Superpower

Network Type How It Works What It's Great At Famous Examples Difficulty Level
CNN
Convolutional Neural Networks The Visual Specialists

Uses filters that slide across images to detect patterns like edges, textures, and shapes at different levels of abstraction.

  • Recognizing objects in photos
  • Detecting faces in images
  • Reading handwritten text
  • Medical image analysis
ResNet VGG Inception YOLO
Moderate
RNN
Recurrent Neural Networks The Memory Keepers

Processes sequences by maintaining a memory of what came before, making them perfect for data where order matters.

  • Translating languages
  • Predicting stock prices
  • Speech recognition
  • Text generation
LSTM GRU Bi-LSTM
Challenging
TF
Transformers The Attention Masters

Uses attention mechanisms to weigh the importance of different parts of input data, allowing them to process entire sequences at once.

  • Human-like text generation
  • Question answering
  • Summarization
  • Sentiment analysis
BERT GPT T5 DALL-E
Advanced
GAN
Generative Adversarial Networks The Creative Duos

Two networks compete: one creates content, the other judges its authenticity, driving each other to improve through competition.

  • Creating realistic images
  • Turning sketches into photos
  • Aging faces in photos
  • Style transfer between images
StyleGAN CycleGAN Pix2Pix
Advanced

💡 Did you know? The largest neural networks today (like GPT-4) have hundreds of billions of parameters - that's like having more connections than there are stars in our galaxy!

The Limits of AI

Data Dependency

Garbage in, garbage out. Poor data = poor model.

Lack of Understanding

AI doesn’t actually “know” things—it just recognizes patterns.

Black Box Models

Deep models are hard to explain, even to experts.

Fragile in New Situations

Trained for summer? It might fail in winter unless retrained.

High Resource Demand

Training big models requires massive computing power.

Ethical Considerations in AI

AI isn’t just technical—it’s deeply human.

Bias and Fairness

Biased training data leads to biased outcomes.

Privacy

Machine learning often needs personal data. This raises red flags.

Transparency

People should understand decisions that affect them.

Accountability

When AI fails, who takes the blame?

Environmental Impact

Training large models contributes to carbon emissions.

What This Means for Documentation

Understanding these fundamentals helps you:

Provide Technical Depth

  • Create layered content
  • Use analogies and visuals

Communicate Limitations Clearly

  • Be transparent about edge cases
  • Manage user expectations

Track Change and Versioning

  • Show how models evolve
  • Explain what’s different between versions

Write Ethically

  • Mention fairness, privacy, and data origin
  • Include known risks and how they are handled

Exercise: Identify the ML Approach

Pick an application and answer:

  1. What type of learning is used?
  2. Is it classification, regression, clustering, etc.?
  3. What kind of data does it need?
  4. What might be hard to explain in the documentation?

Examples:

  • Spam filter
  • Product recommendation
  • Fraud detection
  • Customer segmentation
  • Self-driving car
  • Stock price prediction

Want to Learn More?

Books

  • “The Hundred-Page Machine Learning Book” by Andriy Burkov
  • “Interpretable Machine Learning” by Christoph Molnar
  • “Artificial Intelligence: A Guide for Thinking Humans” by Melanie Mitchell

Free Courses

Helpful Resources

What’s Coming Up Next?

Next, we’ll explore how to explain AI and ML systems to different types of readers—developers, decision-makers, and everyday users.
You’ll learn how to adjust your writing style, use the right tone, and build clarity even for the most complex concepts.

Let’s move from understanding AI to helping others understand it.

Frequently Asked Questions About AI-ML Fundamentals

Get answers to common questions about AI and ML concepts, terminology, and documentation approaches.

AI and ML Basics

Practical Documentation

AI and ML Fundamentals Quiz

Test your understanding of the core concepts covered in this chapter.
Question 1 of 5

What is the relationship between Artificial Intelligence (AI) and Machine Learning (ML)?

65
They are completely separate technologies with no overlap
66
ML is a subset of AI where machines learn from data rather than being explicitly programmed
67
AI is a subset of ML focused on mimicking human intelligence
68
They are exactly the same thing with different names