-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from tsukuba-websci/nanami/update/README
Update: READMEを更新する
- Loading branch information
Showing
7 changed files
with
137 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ランダムサーチによるパラメタ探索 | ||
|
||
## 概要 | ||
パラメータのランダムサーチを行います。 | ||
決められた`rho,nu,recentness,frequency`の範囲でランダムに遺伝子を生成する。 | ||
生成した遺伝子で壺モデルを一定回数実行し、遺伝子パラメータと10個の指標を保存する。 | ||
|
||
GA,QDはターゲットデータに合うように`(rho,nu,s)`を探索しますが、`randome-search/main.py`ではターゲットデータを意識していません。 | ||
ターゲットデータとのフィッティング(ターゲットデータとのdistanceを求め、最良の`(rho,nu,s)`を見つける操作)は`fitting.py`で行われます。 | ||
|
||
## 実行方法 | ||
10個の指標を計算して保存するには、以下のコマンドを実行してください。 | ||
```bash | ||
$ python main.py | ||
``` | ||
この結果は`./results/random-search.csv`に以下の形式で保存されます。 | ||
``` | ||
rho,nu,recentness,frequency,gamma,no,nc,oo,oc,c,y,g,r,h | ||
<int>,<int>,<float>,<float>,<float>,<float>,<float>,<float>,<float>,<float>,<float>,<float>,<float>,<float> | ||
... | ||
``` | ||
|
||
|
||
次に以下のコマンドを実行してください。`./results/random-search.csv`を用いて、各ターゲットデータとの距離を計算できます。 | ||
```bash | ||
$ python fitting.py <target_type> | ||
``` | ||
全ての出力結果は`./results/<target>/archive.csv`に以下のような形式で出力されます。 | ||
また、最もdistanceが小さいパラメータの情報は`best.csv`に出力されます。 | ||
``` | ||
rho,nu,recentness,frequency,distance | ||
<float>,<float>,<float>,<float>,<float> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,79 @@ | ||
# full searh, GA, QDの実験結果の可視化 | ||
# 既存モデルの全探索, ランダムサーチ, GA, QDの実験結果の可視化 | ||
|
||
## 概要 | ||
|
||
以下の3種類の図を作成する。 | ||
- 棒グラフ | ||
- レーダーチャート | ||
以下の5種類の図と2種類の表を出力するソースコードです。 | ||
|
||
図を生成するスクリプトは`/graphs`にあります。 | ||
- 箱ひげ図 | ||
- `box.py` | ||
- full-search,random-search,GA,QD | ||
- Fig.3(A), Fig.5(A) | ||
- タイムライン | ||
- `timeline.py` | ||
- GA,QD | ||
- Fig.3(B), Fig.5(B) | ||
- レーダーチャート | ||
- `radar_chart.py` | ||
- full-search,GA,QD | ||
- Fig.4, Fig.6 | ||
- ネットワークのベクトルが作るマップ | ||
- `map.py` | ||
- GA,QDの実データ | ||
- Fig.7 | ||
- 棒グラフ | ||
- `bar_graph.py` | ||
- full-search,random-search,GA,QD | ||
|
||
表を生成するスクリプトは`/tables`にある。 | ||
- 最良個体の距離の平均と分散を示す表 | ||
- `print_best.py` | ||
- full-search,random-search,GA,QD | ||
- Table1, Table2 | ||
- 最良の遺伝子5つを示すlatex形式の表 | ||
- `latex_table.py` | ||
- QD | ||
- Table3 | ||
|
||
|
||
## 実行方法 | ||
|
||
### 前処理 | ||
GA,QDで見つけた最良のrho,nu,recentness,frequencyの組で壺モデルを10回走らせます。 | ||
GA,QD,ランダムサーチで見つけた最良の`(rho,nu,recentness,frequency)`の組で壺モデルを10回走らせます。(既存モデルの全探索では初めから10回走らせているため、ここでは行いません) | ||
```bash | ||
$ pwd # => /path/to/visualize | ||
$ python preprocessing.py <target_type> | ||
``` | ||
この結果は`./results/fitted`に保存され、棒グラフ・レーダーチャートの生成に用いられます。 | ||
この結果は`./results/fitted`に保存され、棒グラフ・レーダーチャート、最良個体の距離の表の生成に用いられます。 | ||
|
||
|
||
GA,QDの最終的な全個体のに対して、壺モデルを回してネットワークを生成します。そのネットワークをgraph2vecしたベクトルを保存しておきます。 | ||
```bash | ||
$ python make_vec.py <target_type> | ||
``` | ||
この結果は`./results/vec`に保存され、ネットワークのベクトルが作るマップに用いられます。 | ||
|
||
|
||
|
||
### 可視化のスクリプト | ||
図を出力する場合: | ||
```bash | ||
$ pwd # => /path/to/visualize | ||
$ python main.py <graph_type> <target_type> | ||
``` | ||
|
||
各引数の詳細などは `python main.py -h` あるいは `python main.py --help` で確認できます。 | ||
実行を行うと,`./results` 以下にグラフの種類ごとに分けられて結果が保存されます。 | ||
|
||
また、latex形式で遺伝子の表を出力するには、以下のコマンドを実行してください。 | ||
|
||
最良個体の距離の平均と分散を示す表を出力する場合: | ||
```bash | ||
$ python tables/print_best.py <target_type> | ||
``` | ||
|
||
latex形式で遺伝子の表を出力する場合: | ||
```bash | ||
$ pwd # => /path/to/visualize | ||
$ python graphs/latex_table.py | ||
``` | ||
`MPS-TOM-urnmodel/`で用意されているpoetry環境では、このスクリプトだけpandasのversionの依存関係が合わないため、動きません。 | ||
`MPS-TOM-urnmodel/`で用意されているpoetry環境では、`latex_table.py`だけ`pandas`のversionの依存関係が合わないため、動きません。 | ||
`pandas>=1.5.3`, `Jinja2>=3.0.0`, `matplotlib`, `numpy`のある環境で実行してください。 |