<jupyter_start><jupyter_text>2. Get StartedThis notebook provides a walkthrough on how to train a model using NeuRec. This walkthrough trains and evaluates the MLP model on the Ciao dataset.> Please read 1. Installation for details on how to setup NeuRec. StructureThe structure for the NeuRec project is as follows:* data - Modules for processing datasets;* dataset - Available datasets;* evaluation - Modules for evaluating the performance of models;* model - Available models;* util - Utility modules for assisting NeuRec;* neurec.py - Main script for NeuRec. DatasetsSeveral datasets are available for use with NeuRec, which can be found in the **/datasets** folder. Included are the following:* Ciao.rating* Ciao.trust* ml-1m.test.rating* ml-1m.train.rating* ml-100k.rating> For custom datasets, read the 5. Custom Datasets guide to learn how to load them into NeuRec. ModelsNeuRec contains a large number of models which are ready to be trained. To discover which models are available, you can run the following:<jupyter_code>import neurec

neurec.listModels()<jupyter_output><empty_output><jupyter_text>Train a ModelTo train a model, in this walkthrough the MLP model, three steps are taken. First, the settings for NeuRec are created. Second, the model specific settings are created. Finally, NeuRec is run with these settings. Step 1: Configure NeuRec SettingsWe must create a properties files that defines the properties relating to the dataset and recommender model. To do this, first create a file called **neurec.properties** and enter the following into the file:```python[DEFAULT]data.input.path=neurecdata.input.dataset=Ciao.ratingdata.column.format=UIRTdata.convert.separator=','data.convert.binarize.threshold=0data.splitter=ratiodata.splitterratio=[0.8,0.2]|floatrec.number.thread=20rec.evaluate.neg=0recommender=mlp```We have selected the MLP model by setting the **recommender** property to **mlp**.> If you would like to use a dataset provided by NeuRec, set the **data.input.path** property to **neurec**. Step 2: Configure Model SettingsNext, we must also configure settings specific to the MLP model in the neurec.properties file. For this walkthrough, we will use the following properties:```pythondata.input.path=neurecdata.input.dataset=Ciao.ratingdata.column.format=UIRTdata.convert.separator=','data.convert.binarize.threshold=0data.splitter=ratiodata.splitterratio=[0.8,0.2]|floatrec.number.thread=20rec.evaluate.neg=0recommender=mlpepochs=100batch_size=256layers=[64,32,16,8]|intreg_mlp=0.0topK=10learning_rate=0.001learner=adamispairwise=falsenum_neg=4loss_function=cross_entropyverbose=1``` Step 3: Train ModelFinally, we let NeuRec train and evaluate the MLP model on the Ciao dataset. To do this, we run the following:<jupyter_code>import neurec

# Perform necessary setup, such as 
# the dataset and seed values
neurec.setup('neurec.properties')

# Run NeuRec with the configuration settings.
neurec.run()<jupyter_output>[iter 1 : loss : 0.002706, time: 5.114259]
[iter 2 : loss : 0.002706, time: 4.625121]
[iter 3 : loss : 0.002706, time: 4.642166]
[iter 4 : loss : 0.002706, time: 5.117908]
[iter 5 : loss : 0.002706, time: 4.938822]
[iter 6 : loss : 0.002706, time: 4.725869]
[iter 7 : loss : 0.002706, time: 4.942281]
[iter 8 : loss : 0.002706, time: 5.548614]
[iter 9 : loss : 0.002706, time: 4.999757]
[iter 10 : loss : 0.002706, time: 4.684390]
[iter 11 : loss : 0.002706, time: 5.009178]
[iter 12 : loss : 0.002706, time: 4.860038]
[iter 13 : loss : 0.002706, time: 4.679969]
[iter 14 : loss : 0.002706, time: 4.689629]
[iter 15 : loss : 0.002706, time: 4.681692]
[iter 16 : loss : 0.002706, time: 5.004865]
[iter 17 : loss : 0.002706, time: 5.560043]
[iter 18 : loss : 0.002706, time: 5.879498]
[iter 19 : loss : 0.002706, time: 5.572641]
[iter 20 : loss : 0.002706, time: 4.871847]
[iter 21 : loss : 0.002706, time: 5.494265]
[iter 22 : loss : 0.002706, time: 5.214601]
[iter 23 : loss : 0.002706, time: 4.82094[...]
{'fraction_non_alphanumeric': 0.10976532929598788, 'fraction_numerical': 0.10295230885692658, 'mean_word_length': 5.089093701996928, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '460660', 'license': 'MIT', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1294, 'n_words': 455, 'path': 'docs/2. Get Started.ipynb', 'repo_name': 'qiqiding/NeuRec', 'size': '3963'}