class_docstr: Abstract base class of all MatchZoo models.
  
  MatchZoo models are wrapped over keras models, and the actual keras model
  built can be accessed by `model.backend`. `params` is a set of model
  hyper-parameters that deterministically builds a model. In other words,
  `params['model_class'](params=params)` of the same `params` always create
  models with the same structure.
  
  :param params: Model hyper-parameters. (default: return value from
      :meth:`get_default_params`)
  :param backend: A keras model as the model backend. Usually not passed as
      an argument.
  
  Example:
      >>> BaseModel()  # doctest: +ELLIPSIS
      Traceback (most recent call last):
      ...
      TypeError: Can't instantiate abstract class BaseModel ...
      >>> class MyModel(BaseModel):
      ...     def build(self):
      ...         pass
      >>> isinstance(MyModel(), BaseModel)
      True
class_docstr_tok: ["Abstract","base","class","of","all","MatchZoo","models",".","MatchZoo","models","are","wrapped","over","keras","models",",","and","the","actual","keras","model","built","can","be","accessed","by","`","model.backend","`",".","`","params","`","is","a","set","of","model","hyper-parameters","that","deterministically","builds","a","model",".","In","other","words",",","`","params","[","'model_class","'","]","(","params=params",")","`","of","the","same","`","params","`","always","create","models","with","the","same","structure",".",":","param","params",":","Model","hyper-parameters",".","(","default",":","return","value","from",":","meth",":","`","get_default_params","`",")",":","param","backend",":","A","keras","model","as","the","model","backend",".","Usually","not","passed","as","an","argument",".","Example",":",">",">",">","BaseModel","(",")","#","doctest",":","+ELLIPSIS","Traceback","(","most","recent","call","last",")",":","...","TypeError",":","Ca","n't","instantiate","abstract","class","BaseModel","...",">",">",">","class","MyModel","(","BaseModel",")",":","...","def","build","(","self",")",":","...","pass",">",">",">","isinstance","(","MyModel","(",")",",","BaseModel",")","True"]
docstr: Model default parameters.
  
  The common usage is to instantiate :class:`matchzoo.engine.ModelParams`
      first, then set the model specific parametrs.
  
  Examples:
      >>> class MyModel(BaseModel):
      ...     def build(self):
      ...         print(self._params['num_eggs'], 'eggs')
      ...         print('and', self._params['ham_type'])
      ...
      ...     @classmethod
      ...     def get_default_params(cls):
      ...         params = ParamTable()
      ...         params.add(Param('num_eggs', 512))
      ...         params.add(Param('ham_type', 'Parma Ham'))
      ...         return params
      >>> my_model = MyModel()
      >>> my_model.build()
      512 eggs
      and Parma Ham
  
  Notice that all parameters must be serialisable for the entire model
  to be serialisable. Therefore, it's strongly recommended to use python
  native data types to store parameters.
  
  :return: model parameters
code: def get_default_params(
      cls, with_embedding=False, with_multi_layer_perceptron=False
  ) -> ParamTable:
      """
      Model default parameters.
  
      The common usage is to instantiate :class:`matchzoo.engine.ModelParams`
          first, then set the model specific parametrs.
  
      Examples:
          >>> class MyModel(BaseModel):
          ...     def build(self):
          ...         print(self._params['num_eggs'], 'eggs')
          ...         print('and', self._params['ham_type'])
          ...
          ...     @classmethod
          ...     def get_default_params(cls):
          ...         params = ParamTable()
          ...         params.add(Param('num_eggs', 512))
          ...         params.add(Param('ham_type', 'Parma Ham'))
          ...         return params
          >>> my_model = MyModel()
          >>> my_model.build()
          512 eggs
          and Parma Ham
  
      Notice that all parameters must be serialisable for the entire model
      to be serialisable. Therefore, it's strongly recommended to use python
      native data types to store parameters.
  
      :return: model parameters
  
      """
      params = ParamTable()
      params.add(
          Param(
              name="model_class",
              value=cls,
              desc="Model class. Used internally for save/load. "
              "Changing this may cause unexpected behaviors.",
          )
      )
      params.add(
          Param(
              name="input_shapes",
              desc="Dependent on the model and data. Should be set manually.",
          )
      )
      params.add(
          Param(
              name="task",
              desc="Decides model output shape, loss, and metrics.",
          )
      )
      params.add(
          Param(
              name="optimizer",
              value="adam",
          )
      )
      if with_embedding:
          params.add(
              Param(
                  name="with_embedding",
                  value=True,
                  desc="A flag used help `auto` module. Shouldn't be changed.",
              )
          )
          params.add(
              Param(
                  name="embedding_input_dim",
                  desc="Usually equals vocab size + 1. Should be set manually.",
              )
          )
          params.add(
              Param(
                  name="embedding_output_dim",
                  desc="Should be set manually.",
              )
          )
          params.add(
              Param(
                  name="embedding_trainable",
                  value=True,
                  desc="`True` to enable embedding layer training, "
                  "`False` to freeze embedding parameters.",
              )
          )
      if with_multi_layer_perceptron:
          params.add(
              Param(
                  name="with_multi_layer_perceptron",
                  value=True,
                  desc="A flag of whether a multiple layer perceptron is used. "
                  "Shouldn't be changed.",
              )
          )
          params.add(
              Param(
                  name="mlp_num_units",
                  value=128,
                  desc="Number of units in first `mlp_num_layers` layers.",
                  hyper_space=hyper_spaces.quniform(8, 256, 8),
              )
          )
          params.add(
              Param(
                  name="mlp_num_layers",
                  value=3,
                  desc="Number of layers of the multiple layer percetron.",
                  hyper_space=hyper_spaces.quniform(1, 6),
              )
          )
          params.add(
              Param(
                  name="mlp_num_fan_out",
                  value=64,
                  desc="Number of units of the layer that connects the multiple "
                  "layer percetron and the output.",
                  hyper_space=hyper_spaces.quniform(4, 128, 4),
              )
          )
          params.add(
              Param(
                  name="mlp_activation_func",
                  value="relu",
                  desc="Activation function used in the multiple "
                  "layer perceptron.",
              )
          )
      return params
  
imports: import abc
  import typing
  from pathlib import Path
  import dill
  import numpy
  import keras
  import keras.backend
  import pandas
  import matchzoo
  from matchzoo import DataGenerator
  from matchzoo.engine import hyper_spaces
  from matchzoo.engine.base_preprocessor import BasePreprocessor
  from matchzoo.engine.base_metric import BaseMetric
  from matchzoo.engine.param_table import ParamTable
  from matchzoo.engine.param import Param
  from matchzoo import tasks
label_desc: Use image node_id 2 for calling the BaseModel obj's underlying member method code with example usage: obj.get_default_params(cls, with_embedding, with_multi_layer_perceptron) and returns: params