matchzoo.models.duet
¶
An implementation of DUET Model.
Module Contents¶
Classes¶
Duet Model. |
-
class
matchzoo.models.duet.
DUET
(params: typing.Optional[ParamTable] = None)¶ Bases:
matchzoo.engine.base_model.BaseModel
Duet Model.
Examples
>>> model = DUET() >>> model.params['left_length'] = 10 >>> model.params['right_length'] = 40 >>> model.params['lm_filters'] = 300 >>> model.params['mlp_num_layers'] = 2 >>> model.params['mlp_num_units'] = 300 >>> model.params['mlp_num_fan_out'] = 300 >>> model.params['mlp_activation_func'] = 'relu' >>> model.params['vocab_size'] = 2000 >>> model.params['dm_filters'] = 300 >>> model.params['dm_conv_activation_func'] = 'relu' >>> model.params['dm_kernel_size'] = 3 >>> model.params['dm_right_pool_size'] = 8 >>> model.params['dropout_rate'] = 0.5 >>> 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: int = 10, truncated_length_right: int = 40, filter_mode: str = 'df', filter_low_freq: float = 1, filter_high_freq: float = float('inf'), remove_stop_words: bool = False, ngram_size: int = 3)¶ - Returns
Default preprocessor.
-
classmethod
get_default_padding_callback
(cls, fixed_length_left: int = 10, fixed_length_right: int = 40, pad_word_value: typing.Union[int, str] = 0, pad_word_mode: str = 'pre', with_ngram: bool = True, fixed_ngram_length: int = None, pad_ngram_value: typing.Union[int, str] = 0, pad_ngram_mode: str = 'pre') → BaseCallback¶ Model default padding callback.
The padding callback’s on_batch_unpacked would pad a batch of data to a fixed length.
- Returns
Default padding callback.
-
classmethod
_xor_match
(cls, x, y)¶ Xor match of two inputs.
-
build
(self)¶ Build model structure.
-
forward
(self, inputs)¶ Forward.
-
classmethod