+0
日增长
8,874
stars
4,058
forks
316
watchers
947
prs
407
issues
0
releases
README
aima-python Python code for the book Artificial Intelligence: A Modern Approach. You can use this in conjunction with a course on AI, or for study on your own. We're looking for solid contributors to help. Updates for 4th Edition The 4th edition of the book is out now in 2020, and thus we are updating the code. All code here will reflect the 4th edition. Changes include: - Move from Python 3.5 to 3.7, and on to modern Python (the code now runs on Python 3.9 and up). - More emphasis on Jupyter (Ipython) notebooks. - More projects using external packages (tensorflow, etc.). Edition policy (3rd vs 4th). As Peter Norvig stated, we are not maintaining two parallel editions — all new work should move toward the 4th edition. Concretely: - The 4th edition is canonical: new algorithms, fixes and pseudocode references should follow the 4e numbering and content. - The 3e/4e split is done: there is now a single version per module (no 4e.py files remain). The old 3e/4e pairs have been merged — the canonical implementation was kept and any genuinely-new 4e algorithms were folded in — and the 4e-only modules (deep_learning.py, game_theory.py, making_simple_decisions.py, perception.py) were de-suffixed. Add new 4e content directly to the relevant module. Structure of the Project When complete, this project will have Python implementations for all the pseudocode algorithms in the book, as well as tests and examples of use. The code is organised into these top-level folders: - aima/ — the importable Python package: one module per major topic (e.g. aima/search.py) with the implementations of the pseudocode algorithms and their support functions/classes/data. - notebooks/ — the Jupyter notebooks that explain and demonstrate the code (e.g. notebooks/search.ipynb), plus the per-chapter notebooks/chapterNN/ demos. Each notebook starts with a %run bootstrap.ipynb cell that puts the repo root on sys.path, so from aima import ... works wherever the notebook is launched. A GitHub Action (notebooks-to-py.yml) keeps a readable, diffable .py mirror of every notebook beside it (generated with jupytext); the .ipynb is the source of truth, so edit the notebook, not the generated .py. - tests/ — a lightweight test suite (e.g. tests/test_search.py), using assert statements, designed for use with py.test but also usable on their own. - lite/ — a JupyterLite proof-of-concept that runs a few notebooks entirely in the browser via Pyodide, no install required (try it here; see lite/README.md and issue 1072). Python 3.9 and up The code for the 3rd edition was in Python 3.5; the 4th edition code targets Python 3.7 and runs on Python 3.9 and up, but does not run in Python 2. Continuous integration runs the full test suite (including the deep-learning modules) on Python 3.9, 3.10, 3.11 and 3.12; note that some optional dependencies (tensorflow, keras, opencv-python) do not yet ship wheels for the very latest releases (3.13+), so one of those versions is recommended for
Top issues
#1072Pyodide: Interesting Approach to Python in the Browser11 comments · 2019-04-17#1341Python 3.9, or 3.11, or another version?1 comments · 2026-06-30#1355Display bug in games.py TicTacToe class and children0 comments · 2026-11-08#1349Clarify Figure 8.3 first-order logic syntax0 comments · 2026-10-04