-
Notifications
You must be signed in to change notification settings - Fork 13
/
cli.rst
188 lines (155 loc) · 4.81 KB
/
cli.rst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
.. _cli:
======================
Command Line Interface
======================
Commands
--------
After installing entity-embed with pip, the commands ``entity_embed_train`` and ``entity_embed_predict`` are available.
Train Options
~~~~~~~~~~~~~
To check all the CLI options for train, run:
.. code-block:: bash
$ entity_embed_train --help
The **mandatory** ones are:
.. csv-table::
:file: cli_train_options.csv
:widths: 30, 70
:header-rows: 1
If you're doing Record Linkage, there are other **mandatory** options:
.. csv-table::
:file: cli_rl_options.csv
:widths: 30, 70
:header-rows: 1
Preedict Options
~~~~~~~~~~~~~~~~
To check all the CLI options for predict, run:
.. code-block:: bash
$ entity_embed_predict --help
The **mandatory** ones are:
.. csv-table::
:file: cli_predict_options.csv
:widths: 30, 70
:header-rows: 1
If you're doing Record Linkage, there are other **mandatory** options:
.. csv-table::
:file: cli_rl_options.csv
:widths: 30, 70
:header-rows: 1
Examples
--------
#. Clone entity-embed GitHub repo: ``git clone https://github.com/vintasoftware/entity-embed.git``
#. ``cd`` into it
#. Check example data in ``example-data/``
#. Back to entity-embed root dir, run one of the following:
Deduplication Train
~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
$ entity_embed_train \
--field_config_json example-data/er-field-config.json \
--train_csv example-data/er-train.csv \
--valid_csv example-data/er-valid.csv \
--test_csv example-data/er-test.csv \
--unlabeled_csv example-data/er-unlabeled.csv \
--csv_encoding utf-8 \
--cluster_field cluster \
--embedding_size 300 \
--lr 0.001 \
--min_epochs 5 \
--max_epochs 100 \
--early_stop_monitor valid_recall_at_0.3 \
--early_stop_min_delta 0 \
--early_stop_patience 20 \
--early_stop_mode max \
--tb_save_dir tb_logs \
--tb_name er-example \
--check_val_every_n_epoch 1 \
--batch_size 32 \
--eval_batch_size 64 \
--num_workers -1 \
--multiprocessing_context fork \
--sim_threshold 0.3 \
--sim_threshold 0.5 \
--sim_threshold 0.7 \
--ann_k 100 \
--m 64 \
--max_m0 64 \
--ef_construction 150 \
--ef_search -1 \
--random_seed 42 \
--model_save_dir trained-models/er/
Deduplication Predict
~~~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
$ entity_embed_predict \
--model_save_filepath "trained-models/er/...fill-here..." \
--unlabeled_csv example-data/er-unlabeled.csv \
--csv_encoding utf-8 \
--eval_batch_size 50 \
--num_workers -1 \
--multiprocessing_context fork \
--sim_threshold 0.3 \
--ann_k 100 \
--m 64 \
--max_m0 64 \
--ef_construction 150 \
--ef_search -1 \
--random_seed 42 \
--output_json example-data/er-prediction.json
Record Linkage Train
~~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
$ entity_embed_train \
--field_config_json example-data/rl-field-config.json \
--train_csv example-data/rl-train.csv \
--valid_csv example-data/rl-valid.csv \
--test_csv example-data/rl-test.csv \
--unlabeled_csv example-data/rl-unlabeled.csv \
--csv_encoding utf-8 \
--cluster_field cluster \
--source_field __source \
--left_source amazon \
--embedding_size 300 \
--lr 0.001 \
--min_epochs 5 \
--max_epochs 100 \
--early_stop_monitor valid_recall_at_0.3 \
--early_stop_min_delta 0 \
--early_stop_patience 20 \
--early_stop_mode max \
--tb_save_dir tb_logs \
--tb_name rl-example \
--check_val_every_n_epoch 1 \
--batch_size 32 \
--eval_batch_size 64 \
--num_workers -1 \
--multiprocessing_context fork \
--sim_threshold 0.3 \
--sim_threshold 0.5 \
--sim_threshold 0.7 \
--ann_k 100 \
--m 64 \
--max_m0 64 \
--ef_construction 150 \
--ef_search -1 \
--random_seed 42 \
--model_save_dir trained-models/rl/
Record Linkage Predict
~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
$ entity_embed_predict \
--model_save_filepath "trained-models/rl/...fill-here..." \
--unlabeled_csv example-data/rl-unlabeled.csv \
--csv_encoding utf-8 \
--source_field __source \
--left_source amazon \
--eval_batch_size 50 \
--num_workers -1 \
--multiprocessing_context fork \
--sim_threshold 0.3 \
--ann_k 100 \
--m 64 \
--max_m0 64 \
--ef_construction 150 \
--ef_search -1 \
--random_seed 42 \
--output_json example-data/rl-prediction.json