matchzoo.models.dssm
¶
An implementation of DSSM, Deep Structured Semantic Model.
Module Contents¶
Classes¶
Deep structured semantic model. |
-
class
matchzoo.models.dssm.
DSSM
(params: typing.Optional[ParamTable] = None)¶ Bases:
matchzoo.engine.base_model.BaseModel
Deep structured semantic model.
Examples
>>> model = DSSM() >>> model.params['mlp_num_layers'] = 3 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 128 >>> model.params['mlp_activation_func'] = 'relu' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()
-
classmethod
get_default_params
(cls) → ParamTable¶ - Returns
model default parameters.
-
classmethod
get_default_preprocessor
(cls, truncated_mode: str = 'pre', truncated_length_left: typing.Optional[int] = None, truncated_length_right: typing.Optional[int] = None, filter_mode: str = 'df', filter_low_freq: float = 1, filter_high_freq: float = float('inf'), remove_stop_words: bool = False, ngram_size: typing.Optional[int] = 3) → BasePreprocessor¶ Model default preprocessor.
The preprocessor’s transform should produce a correctly shaped data pack that can be used for training.
- Returns
Default preprocessor.
-
classmethod
get_default_padding_callback
(cls)¶ - Returns
Default padding callback.
-
build
(self)¶ Build model structure.
DSSM use Siamese arthitecture.
-
forward
(self, inputs)¶ Forward.
-
classmethod