Inference module

Composer.__call__(inputs: dict = {}, *, sampled: bool = False, closed_loop: dict = {}, connect: dict = {}, prediction_samples: str | int = 'auto', num_of_samples: int | None = None, log_internal: bool = False) dict[source]

Performs inference on the model.

Parameters:
  • inputs (dict, optional) – A dictionary of input data. The keys are input names and the values are the corresponding data. Default is an empty dictionary.

  • sampled (bool, optional) – A boolean indicating whether the inputs are already sampled. Default is False.

  • closed_loop (dict, optional) – A dictionary specifying closed loop connections. The keys are input names and the values are output names. Default is an empty dictionary.

  • connect (dict, optional) – A dictionary specifying direct connections. The keys are input names and the values are output names. Default is an empty dictionary.

  • prediction_samples (str or int, optional) – The number of prediction samples. Can be ‘auto’, None or an integer. Default is ‘auto’.

  • num_of_samples (str or int, optional) – The number of samples. Can be ‘auto’, None or an integer. Default is ‘auto’.

Returns:

A dictionary containing the model’s prediction outputs.

Return type:

dict

Raises:
  • RuntimeError – If the network is not neuralized.

  • ValueError – If an input variable is not in the model definition or if an output variable is not in the model definition.

Examples

model = Modely()
x = Input('x')
out = Output('out', Fir(x.last()))
model.addModel('example_model', [out])
model.neuralizeModel()
predictions = model(inputs={'x': [1, 2, 3]})

For more examples of how to use the export module, please refer to the inference tutorial.