matchzoo.models.diin
¶
An implementation of DIIN Model.
Module Contents¶
-
class
matchzoo.models.diin.
DIIN
¶ Bases:
matchzoo.engine.base_model.BaseModel
DIIN model.
Examples
>>> model = DIIN() >>> model.params['embedding_input_dim'] = 10000 >>> model.params['embedding_output_dim'] = 300 >>> model.params['mask_value'] = 0 >>> model.params['char_embedding_input_dim'] = 100 >>> model.params['char_embedding_output_dim'] = 8 >>> model.params['char_conv_filters'] = 100 >>> model.params['char_conv_kernel_size'] = 5 >>> model.params['first_scale_down_ratio'] = 0.3 >>> model.params['nb_dense_blocks'] = 3 >>> model.params['layers_per_dense_block'] = 8 >>> model.params['growth_rate'] = 20 >>> model.params['transition_scale_down_ratio'] = 0.5 >>> model.params['conv_kernel_size'] = (3, 3) >>> model.params['pool_kernel_size'] = (2, 2) >>> model.params['dropout_rate'] = 0.2 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()
-
classmethod
get_default_params
(cls)¶ 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] = 1)¶ 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, fixed_length_left: int = 10, fixed_length_right: int = 30, 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')¶ 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.
-
build
(self)¶ Build model structure.
-
forward
(self, inputs)¶ Forward.
-
classmethod