amber-kshz /
PRML
Python implementations (on jupyter notebook) of algorithms described in the book "PRML"
Loading repository data…
aimacode / repository
Python implementation of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
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.
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:
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:
*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.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).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 running everything. You can install Python or use a browser-based Python interpreter such as repl.it.
The algorithms live in the aima package, so you import them as from aima.search import astar_search (or from aima import search). You can install the package in editable mode with pip install -e . and then run the code in an IDE, or from the command line with python -i -m aima.search where the -i option puts you in an interactive loop where you can run Python functions. All notebooks are available in a binder environment. Alternatively, visit jupyter.org for instructions on setting up your own Jupyter notebook environment.
Features from Python 3.6 and 3.7 that we will be using for this version of the code:
f'var = {var}', not with 'var = {}'.format(var) nor 'var = %s' % var.typing module: declare functions with type hints: def successors(state) -> List[State]:; that is, give type declarations, but omit them when it is obvious. I don't need to say state: State, but in another context it would make sense to say s: State.1_000_000 not as 1000000.dataclasses module: replace namedtuple with dataclass.To download the repository:
git clone https://github.com/aimacode/aima-python.git
Then you need to install the basic dependencies to run the project on your system:
cd aima-python
pip install -r requirements.txt
A couple of notebooks also need the Graphviz system
binary (dot) for rendering — the graphviz PyPI package is only a wrapper. Install it
with your OS package manager if needed (e.g. apt install graphviz, brew install graphviz).
You also need to fetch the datasets from the aima-data repository:
git submodule init
git submodule update
Wait for the datasets to download, it may take a while. Once they are downloaded, you need to install pytest, so that you can run the test suite:
pip install pytest
Then to run the tests:
py.test
And you are good to go!
Here is a table of algorithms, the figure, name of the algorithm in the book and in the repository, and the file where they are implemented in the repository. This chart was originally made for the third edition of the book; per the edition policy above, the project has converged on the fourth edition (4th-edition content, a single module per topic, all under the aima/ package). Empty implementations are a good place for contributors to look for an issue. The aima-pseudocode project describes all the algorithms from the book. An asterisk next to the file name denotes the algorithm is not fully implemented. Another great place for contributors to start is by adding tests and writing on the notebooks. You can see which algorithms have tests and notebook sections below. If the algorithm you want to work on is covered, don't worry! You can still add more tests and provide some examples of use in the notebook!
| Figure | Name (in 3rd edition) | Name (in repository) | File | Tests | Notebook |
|---|---|---|---|---|---|
| 2 | Random-Vacuum-Agent | RandomVacuumAgent | [agents.py][agents] | Done | Included |
| 2 | Model-Based-Vacuum-Agent | ModelBasedVacuumAgent | [agents.py][agents] | Done | Included |
| 2.1 | Environment | Environment | [agents.py][agents] | Done | Included |
| 2.1 | Agent | Agent | [agents.py][agents] | Done | Included |
| 2.3 | Table-Driven-Vacuum-Agent | TableDrivenVacuumAgent | [agents.py][agents] | Done | Included |
| 2.7 | Table-Driven-Agent | TableDrivenAgent | [agents.py][agents] | Done | Included |
| 2.8 | Reflex-Vacuum-Agent | ReflexVacuumAgent | [agents.py][agents] | Done | Included |
| 2.10 | Simple-Reflex-Agent | SimpleReflexAgent |
Selected from shared topics, language and repository description—not editorial ratings.
amber-kshz /
Python implementations (on jupyter notebook) of algorithms described in the book "PRML"
AmirHosseinNamadchi /
This is a more pythonic implementation of OpenSeesPy library to model and analyze structural problems in Jupyter notebooks
dr-mushtaq /
A complete A-Z guide to Machine Learning and Data Science using Python. Includes implementation of ML algorithms, statistical methods, and feature selection techniques in Jupyter Notebooks. Follow Coursesteach for tutorials and updates.
[agents.py][agents] |
| Done |
| Included |
| 2.12 | Model-Based-Reflex-Agent | ReflexAgentWithState | [agents.py][agents] | Done | Included |
| 3 | Problem | Problem | [search.py][search] | Done | Included |
| 3 | Node | Node | [search.py][search] | Done | Included |
| 3 | Queue | Queue | [utils.py][utils] | Done | No Need |
| 3.1 | Simple-Problem-Solving-Agent | SimpleProblemSolvingAgent | [search.py][search] | Done | Included |
| 3.2 | Romania | romania | [search.py][search] | Done | Included |
| 3.7 | Tree-Search | depth/breadth_first_tree_search | [search.py][search] | Done | Included |
| 3.7 | Graph-Search | depth/breadth_first_graph_search | [search.py][search] | Done | Included |
| 3.11 | Breadth-First-Search | breadth_first_graph_search | [search.py][search] | Done | Included |
| 3.14 | Uniform-Cost-Search | uniform_cost_search | [search.py][search] | Done | Included |
| 3.17 | Depth-Limited-Search | depth_limited_search | [search.py][search] | Done | Included |
| 3.18 | Iterative-Deepening-Search | iterative_deepening_search | [search.py][search] | Done | Included |
| 3.22 | Best-First-Search | best_first_graph_search | [search.py][search] | Done | Included |
| 3.24 | A*-Search | astar_search | [search.py][search] | Done | Included |
| 3.26 | Recursive-Best-First-Search | recursive_best_first_search | [search.py][search] | Done | Included |
| 4.2 | Hill-Climbing | hill_climbing | [search.py][search] | Done | Included |
| 4.5 | Simulated-Annealing | simulated_annealing | [search.py][search] | Done | Included |
| 4.8 | Genetic-Algorithm | genetic_algorithm | [search.py][search] | Done | Included |
| 4.11 | And-Or-Graph-Search | and_or_graph_search | [search.py][search] | Done | Included |
| 4.21 | Online-DFS-Agent | online_dfs_agent | [search.py][search] | Done | Included |
| 4.24 | LRTA*-Agent | LRTAStarAgent | [search.py][search] | Done | Included |
| 5.3 | Minimax-Decision | minimax_decision | [games.py][games] | Done |
rajchandran006-ops /
RFD Classification Machine Learning project developed using Python and Jupyter Notebook. This project includes data preprocessing, exploratory data analysis, feature engineering, and implementation of multiple classification algorithms such as Logistic Regression, Random Forest, SVM, KNN, and Naive Bayes for prediction and accuracy evaluation.
artix41 /
Implementation of many transfer learning algorithms in Python with Jupyter notebooks
Suraj-G-Rao /
A collection of Machine Learning lab programs implemented in Python (Jupyter Notebook) covering fundamental supervised and unsupervised learning algorithms, search algorithms, and neural network concepts.