forked from baidu/DuReader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support multiple file names for trainset and testset Change-Id: I26fd79bed1129ffc0d2ab875cd2f0d34bc8c0c54
- Loading branch information
Showing
3 changed files
with
20 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,8 @@ | |
# ============================================================================== | ||
""" | ||
This module implements an opinion classification model to classify a | ||
question answer pair into 4 categories: None(no opinion), Yes(positive opinion), | ||
question answer pair into 3 categories: Yes(positive opinion), | ||
No(negative opinion), Depends(depends on conditions). | ||
Authors: liuyuan([email protected]) | ||
Date: 2017/09/20 12:00:00 | ||
""" | ||
|
||
import logging | ||
|
@@ -49,9 +46,9 @@ def __init__(self, name, inputs, *args, **kwargs): | |
self.emb_dim = kwargs['emb_dim'] | ||
self.vocab_size = kwargs['vocab_size'] | ||
self.is_infer = kwargs['is_infer'] | ||
self.label_dim = 4 | ||
self.static_emb = kwargs['static_emb'] | ||
self.labels = ['None', 'Yes', 'No', 'Depends'] | ||
self.label_dim = 3 | ||
self.static_emb = kwargs.get('static_emb', False) | ||
self.labels = ['Yes', 'No', 'Depends'] | ||
self.label_dict = {v: idx for idx, v in enumerate(self.labels)} | ||
super(OpinionClassifier, self).__init__(name, inputs, *args, **kwargs) | ||
|
||
|
@@ -133,8 +130,6 @@ def train(self): | |
input=cls, name='label1', label=self.label, positive_label=1) | ||
evaluator_2 = paddle.evaluator.precision_recall( | ||
input=cls, name='label2', label=self.label, positive_label=2) | ||
evaluator_3 = paddle.evaluator.precision_recall( | ||
input=cls, name='label3', label=self.label, positive_label=3) | ||
evaluator_all = paddle.evaluator.precision_recall( | ||
input=cls, name='label_all', label=self.label) | ||
return loss | ||
|