mxfusion.inference.inference_parameters¶
Members¶
-
class
mxfusion.inference.inference_parameters.
InferenceParameters
(constants=None, dtype=None, context=None)¶ Bases:
object
The parameters and outcomes of an inference method.
InferenceParameters is a pool of memory that contains a mapping from uuid to two types of memories (MXNet ParameterDict and Constants).
Parameters: - constants ({ModelComponent.uuid : mxnet.ndarray}) – Specify a list of model variables as constants
- dtype ({numpy.float64, numpy.float32, 'float64', 'float32'}) – data type for internal numerical representation
- context ({mxnet.cpu or mxnet.gpu}) – The MXNet context
-
update_constants
(constants)¶ Update the constants.
Parameters: constants ({Variable: float or MXNet NDArray}) – The constants to be updated.
-
initialize_params
(graphs, observed_uuid)¶ Parameters:
-
initialize_with_carryover_params
(graphs, observed_uuid, var_ties, carryover_params)¶ Parameters: - graphs (a list of FactorGraph) – a list of graphs in which the parameters will be optimized.
- observed_uuid ({UUID : mx.ndarray}) – Parameter Variables that are passed in directly as data, not to be inferred.
- var_ties – A dictionary of variable maps that are tied together and use the MXNet Parameter of the dict
value’s uuid. :type var_ties: { UUID to tie from : UUID to tie to } :param carryover_params: list of InferenceParameters containing the outcomes of previous inference algorithms. :type carryover_params: [InferenceParameters]
-
fix_all
()¶
-
param_dict
¶
-
constants
¶
-
var_ties
¶
-
static
load_parameters
(uuid_map=None, mxnet_parameters=None, variable_constants=None, mxnet_constants=None, context=None, dtype=None, current_params=None)¶ Loads back a set of InferenceParameters from files. :param mxnet_parameters: These are the parameters of
the previous inference algorithm.These are in a {uuid: mx.nd.array} mapping. :type mxnet_parameters: Dict of {uuid: mx.nd.array} :param mxnet_constants: These are the constants in mxnet format
from the previous inference algorithm.These are in a {uuid: mx.nd.array} mapping. :type mxnet_constants: Dict of {uuid: mx.nd.array} :param variable_constants: These are the constants in
primitive format from the previousinference algorithm. :type variable_constants: dict of {uuid: constant primitive}
-
get_serializable
()¶ - Returns three dicts:
- MXNet parameters {uuid: mxnet parameters, mx.nd.array}.
- MXNet constants {uuid: mxnet parameter (only constant types), mx.nd.array}
3. Other constants {uuid: primitive numeric types (int, float)} :returns: Three dictionaries: MXNet parameters, MXNet constants, and other constants (in that order) :rtypes: {uuid: mx.nd.array}, {uuid: mx.nd.array}, {uuid: primitive (int/float)}