LoginSignup
6
4

More than 3 years have passed since last update.

【Julia】Genを動かしてみた

Posted at

最近こんなタイトル「MIT、確率的プログラミング言語「Gen」を開発」の記事をよく見るので
とりあえず環境を作ってみたお話。

PDLI 2019で発表された内容はこちら
https://youtu.be/DImI6l_0yiM

環境

macOS Mojave
julia version 1.1.1
Gen v0.3.1 #master (https://github.com/probcomp/Gen)
IJulia v1.19.0
PyPlot v2.8.1

Juliaの環境構築はこちらを参考に、
Mac OS X(Mojave)にJulia環境を構築する[VSCode&notebook版]

Genのインストール

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.1 (2019-05-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

「]」キーをターミナル上で押下すると下のように変わる

(v1.1) pkg>

Genのパッケージを追加

(v1.1) pkg> add https://github.com/probcomp/Gen

チュートリアルで使われているパッケージも追加

(v1.1) pkg> add PyPlot

環境が整ったのでチュートリアルのコードを実行
Tutorial: Introduction to Modeling in Gen

実行して下のような警告が出ると思うので

┌ Warning: `getindex(o::PyObject, s::Symbol)` is deprecated in favor of dot overloading (`getproperty`) so elements should now be accessed as e.g. `o.s` instead of `o[:s]`.

こんな感じで修正

ax[:set_xlim]((xmin, xmax))
↓
ax.set_xlim((xmin, xmax))

セクション2ぐらいまでが動けば後は警告など出ることなくいけるので問題ないかと思います。

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4