intro.ipynb 5,71 ko
Newer Older
Chirag Vartak's avatar
Chirag Vartak a validé
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "# An Introduction To `aima-python`  \n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "  \n",
Peter Norvig's avatar
Peter Norvig a validé
    "The [aima-python](https://github.com/aimacode/aima-python) repository implements, in Python code, the algorithms in the textbook *[Artificial Intelligence: A Modern Approach](http://aima.cs.berkeley.edu)*. A typical module in the repository has the code for a single chapter in the book, but some modules combine several chapters. See [the index](https://github.com/aimacode/aima-python#index-of-code) if you can't find the algorithm you want. The code in this repository attempts to mirror the pseudocode in the textbook as closely as possible and to stress readability foremost; if you are looking for high-performance code with advanced features, there are other repositories for you.  For each module, there are three files, for example:\n",
    "\n",
    "- [**`logic.py`**](https://github.com/aimacode/aima-python/blob/master/logic.py): Source code with data types and algorithms for fealing with logic; functions have docstrings explaining their use.\n",
    "- [**`logic.ipynb`**](https://github.com/aimacode/aima-python/blob/master/logic.ipynb): A notebook like this one; gives more detailed examples and explanations of use.\n",
    "- [**`tests/test_logic.py`**](https://github.com/aimacode/aima-python/blob/master/tests/test_logic.py): Test cases, used to verify the code is correct, and also useful to see examples of use.\n",
    "\n",
    "There is also an [aima-java](https://github.com/aimacode/aima-java) repository, if you prefer Java.\n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "  \n",
    "## What version of Python?\n",
    "  \n",
Peter Norvig's avatar
Peter Norvig a validé
    "The code is tested in Python [3.4](https://www.python.org/download/releases/3.4.3/) and [3.5](https://www.python.org/downloads/release/python-351/). If you try a different version of Python 3 and find a problem, please report it as an [Issue](https://github.com/aimacode/aima-python/issues). There is an incomplete [legacy branch](https://github.com/aimacode/aima-python/tree/aima3python2) for those who must run in Python 2. \n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "  \n",
Peter Norvig's avatar
Peter Norvig a validé
    "We recommend the [Anaconda](https://www.continuum.io/downloads) distribution of Python 3.5. It comes with additional tools like the powerful IPython interpreter, the Jupyter Notebook and many helpful packages for scientific computing. After installing Anaconda, you will be good to go to run all the code and all the IPython notebooks. \n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "\n",
Peter Norvig's avatar
Peter Norvig a validé
    "## IPython notebooks  \n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "  \n",
Peter Norvig's avatar
Peter Norvig a validé
    "The IPython notebooks in this repository explain how to use the modules, and give examples of usage. \n",
    "You can use them in three ways: \n",
Peter Norvig's avatar
Peter Norvig a validé
    "\n",
    "1. View static HTML pages. (Just browse to the [repository](https://github.com/aimacode/aima-python) and click on a `.ipynb` file link.)\n",
    "2. Run, modify, and re-run code, live. (Download the repository (by [zip file](https://github.com/aimacode/aima-python/archive/master.zip) or by `git` commands), start a Jupyter notebook server with the shell command \"`jupyter notebook`\" (issued from the directory where the files are), and click on the notebook you want to interact with.)\n",
    "3. Binder - Click on the binder badge on the [repository](https://github.com/aimacode/aima-python) main page to opens the notebooks in an executable environment, online. This method does not require any extra installation. The code can be executed and modified from the browser itself.\n",
Peter Norvig's avatar
Peter Norvig a validé
    "\n",
Chirag Vartak's avatar
Chirag Vartak a validé
    "  \n",
    "You can [read about notebooks](https://jupyter-notebook-beginner-guide.readthedocs.org/en/latest/) and then [get started](https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Running%20Code.ipynb)."
Chirag Vartak's avatar
Chirag Vartak a validé
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "# Helpful Tips\n",
Peter Norvig's avatar
Peter Norvig a validé
    "Most of these notebooks start by importing all the symbols in a module:"
Chirag Vartak's avatar
Chirag Vartak a validé
  {
   "cell_type": "code",
Peter Norvig's avatar
Peter Norvig a validé
   "execution_count": 2,
Chirag Vartak's avatar
Chirag Vartak a validé
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
Peter Norvig's avatar
Peter Norvig a validé
    "from logic import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "From there, the notebook alternates explanations with examples of use. You can run the examples as they are, and you can modify the code cells (or add new cells) and run your own examples. If you have some really good examples to add, you can make a github pull request.\n",
    "\n",
    "If you want to see the source code of a function, you can open a browser or editor and see it in another window, or from within the notebook you can use the IPython magic funtion `%psource` (for \"print source\"):"
Peter Norvig's avatar
Peter Norvig a validé
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "%psource WalkSAT"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "Or see an abbreviated description of an object with a trainling question mark:"
Peter Norvig's avatar
Peter Norvig a validé
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "WalkSAT?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Peter Norvig's avatar
Peter Norvig a validé
    "# Authors\n",
    "\n",
    "This notebook by [Chirag Vertak](https://github.com/chiragvartak) and [Peter Norvig](https://github.com/norvig)."
Chirag Vartak's avatar
Chirag Vartak a validé
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
Chirag Vartak's avatar
Chirag Vartak a validé
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}