Skip to content

Commit b6b4bce

Browse files
author
Rishal Hurbans
committed
Improved running instructions in root README. Upgraded requirements.txt. Fix for Chapter 10 code.
1 parent 3b0bd7f commit b6b4bce

3 files changed

Lines changed: 60 additions & 44 deletions

File tree

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Grokking Artificial Intelligence Algorithms
1+
# Grokking AI Algorithms
22

33
[Get Grokking Artificial Intelligence Algorithms at Manning Publications](https://www.manning.com/books/grokking-artificial-intelligence-algorithms?a_aid=gaia&a_bid=6a1b836a)
44

@@ -7,30 +7,37 @@ Rather Learn by exploring the code notebook in your browser? Click here:
77
[![Open the interactive code notebook](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/rishal-hurbans/Grokking-Artificial-Intelligence-Algorithms-Notebook/blob/main/Grokking_Artificial_Intelligence_Algorithms_Notebook.ipynb)
88

99
## Requirements
10-
* Python 3.7.0+
11-
* Pip 3
10+
* Python 3.9 or later (3.11 recommended)
11+
* pip 23.1+ (comes with recent Python installers)
12+
* Optional: PyTorch-compatible GPU for the heavy demos in Chapters 11–12
1213

1314
## Setup
14-
Make sure that you have Python 3.7.0+ installed. [Download Python here](https://www.python.org/downloads/).
15-
pip3 should be installed with Python 3.7.0+ on macOS and Windows. You may need to install pip3 seperately if you're using Linux.
16-
Use the ```sudo apt-get install python3-pip``` command if you're using Ubuntu or Debian Linux.
17-
Use the ```sudo yum install python3-pip``` command if you're using Fedora Linux.
18-
19-
Clone this repository.
20-
21-
Navigate to the directory that contains the repository using terminal/console/command line.
22-
23-
Run this command to install the dependency libraries required.
24-
25-
```pip3 install -r requirements.txt```
26-
27-
Navigate to the directory containing the example that you want to run, and run this command.
28-
29-
```python3 <file_name.py>```
30-
15+
1. **Install Python** – download the latest 3.x release from [python.org](https://www.python.org/downloads/) or use your platform package manager. Ensure `python` and `pip` point to the same interpreter (`python -m pip --version`).
16+
2. **Create a virtual environment** (recommended so project dependencies stay isolated):
17+
* macOS / Linux:
18+
```bash
19+
python3 -m venv .venv
20+
source .venv/bin/activate
21+
```
22+
* Windows (PowerShell):
23+
```powershell
24+
py -3 -m venv .venv
25+
.\.venv\Scripts\Activate.ps1
26+
```
27+
3. **Install dependencies**:
28+
```bash
29+
pip install --upgrade pip
30+
pip install -r requirements.txt
31+
```
32+
*PyTorch wheels are large; on Apple Silicon use the `arm64` build from `pip` or follow the [official instructions](https://pytorch.org/get-started/locally/) if you need CUDA support.*
33+
4. **Run an example** by moving into the chapter directory and executing the script:
34+
```bash
35+
cd ch03-intelligent_search/informed_search
36+
python3 maze_astar.py
37+
```
3138

3239
## Overview
33-
This is the official supporting code for the book, Grokking Artificial Intelligence Algorithms, published by Manning Publications, authored by Rishal Hurbans.
40+
This is the official supporting code for the book, Grokking AI Algorithms, published by Manning Publications, authored by Rishal Hurbans.
3441

3542
![History of AI](readme_assets/history_of_ai.png)
3643

@@ -39,4 +46,3 @@ The example implementations provided will make more sense if you've read the boo
3946
The purpose of this repository is to act as a practical reference for examples of how the algorithms mentioned in the book can be implemented.
4047
This repository should not be consulted as the book is read page-by-page, but rather, when you're attempting to implement an algorithm or gain a more technical understanding from a programming perspective.
4148

42-

ch10-reinforcement_learning/auto_simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def execute_random_brute_force():
244244
def train_with_q_learning(observation_space, action_space, number_of_iterations, learning_rate, discount,
245245
chance_of_random_move):
246246
# Initialize the Q-table
247-
q_table = np.zeros([observation_space, action_space], dtype=np.int8)
247+
q_table = np.zeros([observation_space, action_space], dtype=np.int32)
248248

249249
# Repeat for a number of iterations
250250
for i in range(number_of_iterations):

requirements.txt

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
cycler==0.10.0
2-
entrypoints==0.3
3-
flake8==3.7.9
4-
joblib==0.14.1
5-
kiwisolver==1.2.0
6-
matplotlib==3.7.1
7-
mccabe==0.6.1
8-
numpy==1.18.4
9-
pandas==1.0.3
10-
pycodestyle==2.5.0
11-
pydotplus==2.0.2
12-
pyflakes==2.1.1
13-
pyparsing==2.4.7
14-
python-dateutil==2.8.1
15-
pytz==2020.1
16-
scikit-learn==0.22.2.post1
17-
scipy==1.4.1
18-
seaborn==0.10.1
19-
six==1.14.0
20-
sklearn==0.0
21-
torch
1+
# Core scientific stack
2+
numpy>=1.26,<3
3+
scipy>=1.11
4+
pandas>=2.2
5+
matplotlib>=3.8
6+
seaborn>=0.13
7+
8+
# Machine learning
9+
scikit-learn>=1.4
10+
joblib>=1.3
11+
12+
# Utilities
13+
python-dateutil>=2.8
14+
pytz>=2024.1
15+
cycler>=0.11
16+
kiwisolver>=1.4
17+
pyparsing>=3.1
18+
six>=1.16
19+
20+
# Optional linting tools
21+
flake8>=7.0
22+
mccabe>=0.7
23+
pycodestyle>=2.11
24+
pyflakes>=3.2
25+
26+
# Deep learning (required for Chapters 9, 11, 12)
27+
torch>=2.3
28+
29+
# Visualization helpers
30+
entrypoints>=0.4
31+
pydotplus>=2.0.2

0 commit comments

Comments
 (0)