secretflow.ml.nn.applications#

secretflow.ml.nn.applications.sl_deep_fm#

Classes:

DeepFMbase(*args, **kwargs)

DeepFMfuse(*args, **kwargs)

class secretflow.ml.nn.applications.sl_deep_fm.DeepFMbase(*args, **kwargs)[源代码]#

基类:Model

Methods:

__init__(dnn_units_size[, dnn_activation, ...])

Split learning version of DeepFM :param dnn_units_size: list,list of positive integer or empty list, the layer number and units in each layer of DNN :param dnn_activation: activation function of dnn part :param preprocess_layer: The preprocessed layer a keras model, output a dict of preprocessed data :param fm_embedding_dim: fm embedding dim, default to be 16

call(inputs, **kwargs)

Calls the model on new inputs and returns the outputs as tensors.

output_num()

Define the number of tensors returned by basenet

get_config()

Returns the config of the Model.

__init__(dnn_units_size, dnn_activation='relu', preprocess_layer=None, fm_embedding_dim=16, **kwargs)[源代码]#

Split learning version of DeepFM :param dnn_units_size: list,list of positive integer or empty list, the layer number and units in each layer of DNN :param dnn_activation: activation function of dnn part :param preprocess_layer: The preprocessed layer a keras model, output a dict of preprocessed data :param fm_embedding_dim: fm embedding dim, default to be 16

call(inputs, **kwargs)[源代码]#

Calls the model on new inputs and returns the outputs as tensors.

In this case call() just reapplies all ops in the graph to the new inputs (e.g. build a new computational graph from the provided inputs).

Note: This method should not be called directly. It is only meant to be overridden when subclassing tf.keras.Model. To call a model on an input, always use the __call__() method, i.e. model(inputs), which relies on the underlying call() method.

参数:
  • inputs – Input tensor, or dict/list/tuple of input tensors.

  • training – Boolean or boolean scalar tensor, indicating whether to run the Network in training mode or inference mode.

  • mask – A mask or list of masks. A mask can be either a boolean tensor or None (no mask). For more details, check the guide [here](https://www.tensorflow.org/guide/keras/masking_and_padding).

返回:

A tensor if there is a single output, or a list of tensors if there are more than one outputs.

output_num()[源代码]#

Define the number of tensors returned by basenet

get_config()[源代码]#

Returns the config of the Model.

Config is a Python dictionary (serializable) containing the configuration of an object, which in this case is a Model. This allows the Model to be be reinstantiated later (without its trained weights) from this configuration.

Note that get_config() does not guarantee to return a fresh copy of dict every time it is called. The callers should make a copy of the returned dict if they want to modify it.

Developers of subclassed Model are advised to override this method, and continue to update the dict from super(MyModel, self).get_config() to provide the proper configuration of this Model. The default config is an empty dict. Optionally, raise NotImplementedError to allow Keras to attempt a default serialization.

返回:

Python dictionary containing the configuration of this Model.

class secretflow.ml.nn.applications.sl_deep_fm.DeepFMfuse(*args, **kwargs)[源代码]#

基类:Model

Methods:

__init__(dnn_units_size[, dnn_activation])

second_order_fm(x_sum_list, x_square_sum)

call(inputs, **kwargs)

Calls the model on new inputs and returns the outputs as tensors.

get_config()

Returns the config of the Model.

__init__(dnn_units_size, dnn_activation='relu', **kwargs)[源代码]#
second_order_fm(x_sum_list, x_square_sum)[源代码]#
call(inputs, **kwargs)[源代码]#

Calls the model on new inputs and returns the outputs as tensors.

In this case call() just reapplies all ops in the graph to the new inputs (e.g. build a new computational graph from the provided inputs).

Note: This method should not be called directly. It is only meant to be overridden when subclassing tf.keras.Model. To call a model on an input, always use the __call__() method, i.e. model(inputs), which relies on the underlying call() method.

参数:
  • inputs – Input tensor, or dict/list/tuple of input tensors.

  • training – Boolean or boolean scalar tensor, indicating whether to run the Network in training mode or inference mode.

  • mask – A mask or list of masks. A mask can be either a boolean tensor or None (no mask). For more details, check the guide [here](https://www.tensorflow.org/guide/keras/masking_and_padding).

返回:

A tensor if there is a single output, or a list of tensors if there are more than one outputs.

get_config()[源代码]#

Returns the config of the Model.

Config is a Python dictionary (serializable) containing the configuration of an object, which in this case is a Model. This allows the Model to be be reinstantiated later (without its trained weights) from this configuration.

Note that get_config() does not guarantee to return a fresh copy of dict every time it is called. The callers should make a copy of the returned dict if they want to modify it.

Developers of subclassed Model are advised to override this method, and continue to update the dict from super(MyModel, self).get_config() to provide the proper configuration of this Model. The default config is an empty dict. Optionally, raise NotImplementedError to allow Keras to attempt a default serialization.

返回:

Python dictionary containing the configuration of this Model.