GithubHelp home page GithubHelp logo

oreilly-japan / artificial-intelligence-with-python-ja Goto Github PK

View Code? Open in Web Editor NEW
42.0 6.0 48.0 3.52 MB

『PythonによるAIプログラミング入門』のリポジトリ

Jupyter Notebook 92.68% Python 7.32%

artificial-intelligence-with-python-ja's Introduction

PythonによるAIプログラミング入門


表紙


本リポジトリはオライリー・ジャパン発行書籍『PythonによるAIプログラミング入門』(原書名『Artificial Intelligence with Python』)のサポートサイトです。

サンプルコード

ファイル構成

フォルダ名 説明
Chapter 1 1章で使用するデータと.ipynb形式のノートブック
... ...
Chapter 16 16章で使用するデータと.ipynb形式のノートブック
Appendix A 付録Aで使用するデータと.ipynb形式のノートブック

サンプルコードの解説は本書籍をご覧ください。

Pythonと外部ライブラリ

ソースコードを実行するには、下記のソフトウェアが必要です。

  • Python 3
  • NumPy
  • SciPy
  • Matplotlib
  • Jupyter Notebook

本書では、以下の環境で動作確認しました。

  • Windows 10
  • Anaconda3(Python 3.6, 3.7)

Anacondaでは、次のパッケージはインストール済みです。

numpy
scipy
scikit-learn
matplotlib
jupyter
sympy
nltk
pandas

Anacondaでパッケージを追加する場合には、pipよりもcondaを優先して使います。 conda installでインストールできるパッケージは次のとおりです。

gensim
cvxopt
opencv
tensorflow

pip installでインストールする必要があるパッケージは次のとおりです。

pandas_datareader
kanren
simpleai
deap
easyai
hmmlearn
pystruct
neurolab
gym

PyPIにあるpystruct 0.3.2はPython 3.7に対応していないため、インストールに失敗します。古いCythonによって生成されたsrc/utils.cがPython3.7と互換性がないためです。次のようにソースファイルからインストールしてください。インストールにはCコンパイラが必要です。Windowsの場合は、Visual Studio 2017コミュニティー版をインストールしておいてください。

  1. https://github.com/pystruct/pystruct を開き、[Clone or Download]をクリックしてソースファイルを取得します。

  2. ソースファイルのあるディレクトリに移動してから、次のようにCythonを実行して、src/utils.cを生成します。

cd src
cython utils.pyx 
  1. 元のディレクトリに戻って、パッケージをインストールします。
cd ..
python setup.py install

AIは進歩が激しいため、頻繁にパッケージがバージョンアップされます。 そのため本書のサンプルコードを実行すると、警告やエラーが表示されることがあります。 そのような場合には、まずパッケージのバージョンを最新化してください。 パッケージのバージョンアップは、次のコマンドで行います。

// pipの場合:
$ pip install -U パッケージ名

// Anacondaの場合:
$ conda update パッケージ名

APIがdeprecated(廃止予定)であるという警告が表示された場合には、 警告メッセージを読んで新しいAPIに書き換えなければならないこともあります。

実行方法

端末に次のように入力して、jupyter notebookを起動してください。

$ jupyter notebook

すると、Webブラウザが起動してjupyterのページが開き、 jupyterを起動したフォルダのファイル一覧が表示されます。

サンプルコードを開き、 画面上部の[Cell]メニューから選択するか画面上部のボタンを押して実行します。

右上のメニューから[New▼]→[Python 3]を選択すると、 「Untitled」タブが新たに開きます。 In [ ]:の右側にPythonのコードを記述し、 画面上部の[Cell]メニューから選択するか画面上部のボタンを押して実行することもできます。

正誤表

下記の誤りがありました。お詫びして訂正いたします。

本ページに掲載されていない誤植など間違いを見つけた方は、[email protected]までお知らせください。

第2刷まで

■2章 P.31 13行目

ラベルと数字のタプルが格納

単語ラベルが配列形式で格納

■2章 P.38 6行目

model_selection()という関数

model_selection.train_test_split()という関数

■2章 P.46 19行目

classifier = LinearSVC(random_state=0)

classifier = LinearSVC(dual=False, random_state=0)

■2章 P.50 25行目

 regressor_singlevar.py

regressor_singlevar.ipynb

■15章 P.367 18行目

acc = self.quantize5(obs[2], 1.0, 0.2)

acc = self.quantize5(obs[3], 1.0, 0.2)

第1刷

■14章 P.342 訳注

C:\Users\aizo\Anaconda3\lib\site-packages\nurolab\__init__.py

C:\Users\aizo\Anaconda3\lib\site-packages\neurolab\__init__.py

■A.1 P.391 コード

_, contours, _ = cv2.findContours(gray_image, cv2.RETR_TREE,
                               cv2.CHAIN_APPROX_SIMPLE)

contours, _ = cv2.findContours(gray_image, cv2.RETR_TREE,
                               cv2.CHAIN_APPROX_SIMPLE)[-2:]

artificial-intelligence-with-python-ja's People

Contributors

aizoaikawa avatar miyagawa-orj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.