# What Is the Purpose of the Examples Directory in AI for Beginners?

> Discover the purpose of the examples directory in AI for Beginners. This sandbox offers hands-on AI concepts without the full curriculum, perfect for quick learning and experimentation.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: how-to-guide
- Published: 2026-08-28

---

**The examples directory houses self-contained, beginner-friendly code scripts that demonstrate core AI concepts without requiring the full curriculum, serving as an immediate hands-on sandbox for newcomers.**

The Microsoft **AI-For-Beginners** repository provides comprehensive educational content for newcomers to artificial intelligence. Within this ecosystem, the **examples directory in AI for Beginners** functions as a curated quick-start playground located at `examples/`, offering standalone scripts and notebooks that let learners see AI in action within minutes of installation.

## Standalone Entry Points for Immediate Experimentation

Each file in `examples/` is designed to run independently after installing minimal dependencies. According to [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md), the **Getting Started** section outlines the few prerequisites needed to execute any sample immediately. This architecture eliminates setup friction, allowing users to focus on learning concepts rather than configuring complex environments.

## Concept-Driven Learning Progression

The examples follow a pedagogical sequence that builds AI literacy step-by-step:

### Hello AI World ([`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py))

The first script, [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py), introduces fundamental pattern recognition using pure Python. It implements a `SimpleAILearner` class that demonstrates the core mechanics of machine learning—prediction, error calculation, and weight updates—through a simple linear relationship.

### Neural Network Foundations ([`02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/02-simple-neural-network.py))

Moving from linear models to network architectures, [`examples/02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/02-simple-neural-network.py) constructs a minimal neural network from scratch. This file reveals how layers, weights, and activation functions interact without relying on high-level frameworks.

### Computer Vision Application (`03-image-classifier.ipynb`)

The Jupyter notebook `examples/03-image-classifier.ipynb` transitions learners to practical application, leveraging pre-trained models to classify images. This bridges theoretical knowledge with real-world computer vision workflows.

### Natural Language Processing ([`04-text-sentiment.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/04-text-sentiment.py))

Completing the progression, [`examples/04-text-sentiment.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/04-text-sentiment.py) applies AI to text data, demonstrating basic sentiment analysis techniques that form the foundation of modern NLP pipelines.

## Bridging Examples to Comprehensive Lessons

After working through the standalone samples, learners are directed toward the repository's deeper lesson notebooks covering **Intro to AI**, **Neural Networks**, **Computer Vision**, and **NLP**. The `examples/` directory explicitly serves as a bridge to these comprehensive materials, ensuring beginners build confidence before tackling complex theoretical content.

## Inside the Hello AI World Implementation

The [`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py) file contains heavily commented code that invites experimentation. The `SimpleAILearner` class implements a complete training loop in pure Python:

```python
class SimpleAILearner:
    def __init__(self):
        self.weight = random.uniform(0, 5)   # random start

        self.learning_rate = 0.01

    def predict(self, x):
        return self.weight * x

    def train(self, training_data, epochs=100):
        for epoch in range(epochs):
            for x, y_actual in training_data:
                y_pred = self.predict(x)
                error = y_actual - y_pred
                # weight update = learning_rate × error × x

                self.weight += self.learning_rate * error * x

```

Running `python 01-hello-ai-world.py` executes the training trace, displaying how the model iteratively adjusts its weights to minimize prediction error. This visualization of the **training loop**, **gradient descent**, and **inference** demystifies AI mechanics in under 50 lines of code.

## Summary

- The **examples directory in AI for Beginners** provides self-contained scripts requiring minimal setup.
- Files progress logically from basic pattern recognition ([`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py)) to neural networks, computer vision, and NLP.
- Each example encourages experimentation through heavily commented, tweakable code.
- The directory serves as a gateway to the repository's comprehensive lesson notebooks.

## Frequently Asked Questions

### Do I need to complete the full curriculum before running the examples?

No. The examples are designed as independent entry points. Each script in `examples/` runs standalone with only basic dependencies installed, allowing you to explore AI concepts immediately without navigating the entire course structure.

### What programming knowledge is required for the examples directory?

Basic Python familiarity is sufficient. The [`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py) script uses standard library modules only, while later examples introduce minimal external dependencies like TensorFlow or PyTorch, with clear installation instructions provided in [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md).

### Can I modify the code in the examples directory?

Yes. The repository explicitly encourages modification. The source files contain detailed comments indicating where to adjust parameters like `learning_rate` or `epochs`, allowing you to observe how changes affect model behavior and reinforce learning through experimentation.

### How do the examples relate to the lesson notebooks in the main repository?

The examples function as a practical prelude. After completing the quick-start scripts, learners are directed to comprehensive lesson notebooks covering deeper theoretical concepts, creating a smooth transition from hands-on experimentation to structured learning.