The structure of classification and regression is similar. Below function can be used for both tasks.
The structure of classification and regression is similar. Below function can be used for both tasks.
Please check the function `_build_classification_or_regression_model` in [network_conf.py](https://github.com/PaddlePaddle/models/blob/develop/dssm/network_conf.py) for detail implementation.
Please check the function `_build_rank_model` in [network_conf.py](https://github.com/PaddlePaddle/models/blob/develop/dssm/network_conf.py) for implementation.
```python
def_build_rank_model(self):
'''
Build a pairwise rank model, and the cost is returned.
A pairwise rank model has 3 inputs:
- source sentence
- left_target sentence
- right_target sentence
- label, 1 if left_target should be sorted in front of right_target, otherwise 0.
Below is a simple example for the data in `./data`
Below is a simple example for the data in `./data`
...
@@ -347,67 +240,7 @@ The example of this format is as follows.
...
@@ -347,67 +240,7 @@ The example of this format is as follows.
## Training
## Training
We use `python train.py -y 0 --model_arch 0` with the data in `./data/classification` to train a DSSM model for classification.
We use `python train.py -y 0 --model_arch 0` with the data in `./data/classification` to train a DSSM model for classification. The paremeters to execute the script `train.py` can be found by execution `python infer.py --help`. Some important parameters are:
The structure of classification and regression is similar. Below function can be used for both tasks.
The structure of classification and regression is similar. Below function can be used for both tasks.
Please check the function `_build_classification_or_regression_model` in [network_conf.py]( https://github.com/PaddlePaddle/models/blob/develop/dssm/network_conf.py) for detail implementation.
Please check the function `_build_rank_model` in [network_conf.py]( https://github.com/PaddlePaddle/models/blob/develop/dssm/network_conf.py) for implementation.
```python
def _build_rank_model(self):
'''
Build a pairwise rank model, and the cost is returned.
A pairwise rank model has 3 inputs:
- source sentence
- left_target sentence
- right_target sentence
- label, 1 if left_target should be sorted in front of right_target, otherwise 0.
Below is a simple example for the data in `./data`
Below is a simple example for the data in `./data`
...
@@ -389,67 +282,7 @@ The example of this format is as follows.
...
@@ -389,67 +282,7 @@ The example of this format is as follows.
## Training
## Training
We use `python train.py -y 0 --model_arch 0` with the data in `./data/classification` to train a DSSM model for classification.
We use `python train.py -y 0 --model_arch 0` with the data in `./data/classification` to train a DSSM model for classification. The paremeters to execute the script `train.py` can be found by execution `python infer.py --help`. Some important parameters are: