# How to Run the Beginner AI Examples in the Microsoft AI For Beginners Repository

> Easily run beginner AI examples from the Microsoft AI For Beginners repository using Python or Conda. Get started with AI coding in minutes.

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

---

**You can run the beginner AI examples in the Microsoft AI For Beginners repository using either a minimal Python 3.8+ environment with `pip install numpy` or the full Conda environment defined in [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml), then execute the four self-contained files ([`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py), [`02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/02-simple-neural-network.py), `03-image-classifier.ipynb`, and [`04-text-sentiment.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/04-text-sentiment.py)) directly from the `examples/` folder.**

The **AI For Beginners** repository by Microsoft provides four hands-on examples designed specifically for newcomers to artificial intelligence. These self-contained files demonstrate pattern recognition, neural network construction, image classification, and sentiment analysis without requiring the full 12-week curriculum setup. According to the source code in [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md), you can execute these examples using either lightweight dependencies or the comprehensive Conda environment used throughout the course.

## Prerequisites and Environment Setup

Before running the examples, you must configure your Python environment. The repository offers two approaches documented in [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md) and the main curriculum setup guide.

### Minimal Pip-Based Installation

For quick experimentation with just the four beginner examples, install the minimal required packages directly via pip. This approach requires Python 3.8 or higher.

For the Python scripts only:

```bash
pip install numpy

```

For the Jupyter notebook in addition to the scripts:

```bash
pip install jupyter numpy pillow tensorflow

```

### Full Conda Environment Setup

If you plan to continue with the complete curriculum after the beginner examples, create the shared Conda environment defined in the repository root. This ensures compatibility with all subsequent lessons and dependencies.

```bash
conda env create --name ai4beg --file ../environment.yml
conda activate ai4beg

```

The [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) file specifies all required packages for the full learning path, including deep learning frameworks and data science libraries.

## Running the Python Script Examples

The repository includes three executable Python files in the `examples/` directory. After activating your environment, run each script using the standard Python interpreter.

### Hello AI World Demo

Execute the first pattern-recognition demo:

```bash
python 01-hello-ai-world.py

```

This script, located at [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py), introduces fundamental AI concepts through a simple pattern-matching implementation.

### Simple Neural Network from Scratch

Run the neural network construction example:

```bash
python 02-simple-neural-network.py

```

The [`examples/02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/02-simple-neural-network.py) file builds a tiny neural network from scratch using only NumPy, demonstrating forward propagation and basic backpropagation without high-level frameworks.

### Text Sentiment Analysis

Launch the sentiment analysis demonstration:

```bash
python 04-text-sentiment.py

```

This script ([`examples/04-text-sentiment.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/04-text-sentiment.py)) processes sample sentences and classifies sentiment polarity, showing natural language processing fundamentals.

## Running the Jupyter Notebook Example

The image classification example requires Jupyter to render visualizations and cell-by-cell commentary. Launch the notebook server from within the `examples/` directory:

```bash
jupyter notebook 03-image-classifier.ipynb

```

Alternatively, use JupyterLab:

```bash
jupyter lab 03-image-classifier.ipynb

```

The `examples/03-image-classifier.ipynb` notebook demonstrates image classification using a pre-trained model. Each cell contains detailed comments explaining the inference pipeline, tensor operations, and result interpretation.

## Alternative Setup Options

For developers using integrated development environments or cloud-based coding, the repository provides additional configuration guidance in [`lessons/0-course-setup/how-to-run.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md). This canonical guide covers:

- **VS Code**: Configuration for the Python extension and Jupyter notebook support
- **GitHub Codespaces**: One-click cloud development environment setup
- **Local Jupyter**: Advanced local server configuration and virtual environment isolation

These alternatives utilize the same [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) specification but provide containerized or IDE-specific workflows for different development preferences.

## Summary

- The **AI For Beginners** repository contains four self-contained examples in the `examples/` folder: three Python scripts and one Jupyter notebook
- **Minimal setup** requires only `pip install numpy` for scripts or `pip install jupyter numpy pillow tensorflow` for notebooks
- **Full curriculum setup** uses `conda env create --name ai4beg --file environment.yml` for comprehensive dependency management
- Execute Python scripts directly: `python 01-hello-ai-world.py`, `python 02-simple-neural-network.py`, and `python 04-text-sentiment.py`
- Launch the image classifier with: `jupyter notebook 03-image-classifier.ipynb`
- Refer to [`lessons/0-course-setup/how-to-run.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md) for VS Code, Codespaces, or advanced local configurations

## Frequently Asked Questions

### Can I run the examples without installing Conda?

Yes. According to the [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md), you can use `pip install numpy` for the three Python scripts ([`01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/01-hello-ai-world.py), [`02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/02-simple-neural-network.py), and [`04-text-sentiment.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/04-text-sentiment.py)). For the Jupyter notebook (`03-image-classifier.ipynb`), install the additional packages `jupyter`, `pillow`, and `tensorflow` via pip.

### What Python version is required for the beginner examples?

The examples require **Python 3.8 or higher**. This version ensures compatibility with the NumPy operations and TensorFlow components used in the image classification notebook.

### Do I need a GPU to run these beginner examples?

No. The examples are designed to run on CPU-only environments. The neural network in [`02-simple-neural-network.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/02-simple-neural-network.py) uses small synthetic datasets, and the `03-image-classifier.ipynb` notebook uses lightweight pre-trained models optimized for CPU inference.

### Where can I find troubleshooting help if the examples fail to run?

The [`lessons/0-course-setup/how-to-run.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/0-course-setup/how-to-run.md) file provides platform-specific troubleshooting for common environment issues. Additionally, the [`examples/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/README.md) contains specific prerequisite instructions and known dependency conflicts for different operating systems.