Git Product home page Git Product logo

cibook-study-python's Introduction

cibook-study-python

効果検証入門の学習のため、テキストに乗っている図や分析結果をPythonで実装していったコード群です。
notebook/以下に章別に.ipynbファイルをまとめています。
実装していく際に、nekoumeiさんのpythonでの実装を何度も参考にさせて頂きました。この場を借りてお礼申し上げます。

How to use

自分の学習の際はpipenvを使用しました。pipenvを使用されている場合は次のコマンド群を実行してください。

git clone https://github.com/shyaginuma/cibook-study-python.git
cd cibook-study-python
pipenv install
pipenv shell
jupyter lab

それ以外を利用されている方は、requirements.txtを含めていますのでそちらから依存関係をインストールしてください。

書籍内で使用されているデータについて

書籍内ではいくつかのサンプルデータを例に分析をしていますが、中にはRのライブラリ内にのみ存在するデータがあるので、以下手順で事前にダウンロードし、data/配下に置いてください。

  • 2.3.2節で使用するvouvhersデータ:ここからrdaファイルをダウンロード
  • 4.3.1節で使用するCigarデータ:ここからEcdatライブラリをダウンロードし展開、data/からCigarを取り出す。

※nekoumeiさんの実装では、rpy2というライブラリを使ってpythonからRのライブラリを使用する方法で行われていました。そちらの方がスマートなやり方かもしれません。

Cautions

  • 書籍で利用されているコードはRであり、Pythonには無いライブラリもいくつかあったので代替ライブラリを使うか直接実装しています。そのため分析結果の数値が書籍のものと異なる部分があります。

  • 書籍の中の図などはnekoumeiさんのPython実装で完璧に再現されているので、そちらを参照されることをお勧めします。

  • 書籍に乗っている一部の図は実装できていません。(以下)

    • 図3.10 IPWの共変量のバランス
    • 図5.6 rddパッケージによる分析結果の可視化

References

Libraries

普段あまり使わないライブラリも多く使用しています。下記リンクをご参照下さい。

name homepage
rdata https://github.com/vnmabus/rdata
rdd https://github.com/evan-magnusson/rdd
pycausalimpact https://github.com/dafiti/causalimpact

cibook-study-python's People

Contributors

shyaginuma avatar

Stargazers

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

Watchers

 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.