How to train the system?¶
The script train_dssm.py
builds a DSSM and trains it with the provided dataset.
How does it work?¶
Usage¶
In a console, you can use the following command:
>>> python train_dssm.py -e 100 -n1 300 -n2 300 -no 128 -r 0.1 -i "../data/dataset-pasi.npz" -o "../data/output-pasi"
This will build a DSSM with 300 units in the first and in the second layers, and 128 units in the output layer.
The training will be done over 100 epochs, with a learning rate of 0.1.
The input dataset has been produced by the script generate_dataset.py
.
API¶
-
train_dssm.
main
(author_id=None, num_epochs=100, num_entries=6, num_hid1=300, num_hid2=300, num_out=128, learning_rate=0.1, input_file=None, output_file='output')[source]¶ Builds a DSSM and trains it with the dataset of the given author.
The DSSM parameters are saved into a file, in order to be used for recommendation. You must specify either the author’s id, or the dataset input file.
Parameters: - author_id (int or None) – id of the author in the SQL database
- num_epochs (int) – number of iterations in the training
- num_entries (int) – number of compared papers in the DSSM structure
- num_hid1 (int) – number of units in the first hidden layer
- num_hid2 (int) – number of units in the second hidden layer
- num_out (int) – number of units in the output layer
- learning_rate (float) – parameter of the SGD training algorithm
- input_file (string or None) – path to the dataset file of the author
- output_file (string) – path to the output file (DSSM parameters)