Skip to content

Commit

Permalink
Store results
Browse files Browse the repository at this point in the history
  • Loading branch information
nreimers committed Apr 20, 2018
1 parent 2916572 commit 57f37c8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions Train_Chunking.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
model = BiLSTM(params)
model.setMappings(mappings, embeddings)
model.setDataset(datasets, data)
model.storeResults('results/conll2000_chunking.csv') #Path to store performance scores for dev / test
model.modelSavePath = "models/[ModelName]_[DevScore]_[TestScore]_[Epoch].h5"
model.fit(epochs=25)

Expand Down
3 changes: 2 additions & 1 deletion Train_POS.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
model = BiLSTM(params)
model.setMappings(mappings, embeddings)
model.setDataset(datasets, data)
model.modelSavePath = "models/[ModelName]_[DevScore]_[TestScore]_[Epoch].h5"
model.storeResults('results/unidep_pos_results.csv') #Path to store performance scores for dev / test
model.modelSavePath = "models/[ModelName]_[DevScore]_[TestScore]_[Epoch].h5" #Path to store models
model.fit(epochs=25)


Expand Down
14 changes: 13 additions & 1 deletion docs/Training.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,26 @@ params = {'classifier': ['CRF'], 'LSTM-Size': [100], 'dropout': (0.25, 0.25)}
model = BiLSTM(params)
model.setMappings(mappings, embeddings)
model.setDataset(datasets, data)
model.modelSavePath = "models/[ModelName]_[DevScore]_[TestScore]_[Epoch].h5"
model.storeResults('results/unidep_pos_results.csv') #Path to store performance scores for dev / test
model.modelSavePath = "models/[ModelName]_[DevScore]_[TestScore]_[Epoch].h5" #Path to store models
model.fit(epochs=25)
```

`params` defines the hyperparameters of the network. See [Hyperparameters.md](Hyperparameters.md) for more details.

`model.modelSavePath` defines the path where the trained models should be stored. `[ModelName]` is replaced by the name of your dataset, `[DevScore]` with the score on the development set, `[TestScore]` with the score on the test set and `[Epoch]` is replaced by the epoch.

## Storing performance Scores
By calling the `model.storeResults()` we specify the path where the performance scores during training should be stored. The file contains for each training epoch a line that contains the following information:
- epoch
- dataset name
- Performance on development set
- Performance on test set
- Highest development set performance so far
- Test performance for epoch with highest development score



## Training BIO-Encoded Labels
If you want to perform chunking instead of POS-tagging, simple change the `datasets` variable (`Train_Chunking.py`):
```
Expand Down

0 comments on commit 57f37c8

Please sign in to comment.