evaluate_batch#

TwinModel.evaluate_batch(inputs_df)#

Evaluate the twin model with historical input values given with a data frame.

Parameters:
inputs_df: pandas.DataFrame

The historical input values stored in a pandas dataframe. It must have a ‘Time’ column and all twin model inputs history you want to simulate (one input per column),starting at time instant t=0.(s). If a twin model input is not found in the dataframe columns then this input is kept constant to its initialization value. The column header must match with a twin model input name.

Returns:
output_df: pandas.DataFrame

The twin output values associated to the input values, stored in a pandas.DataFrame.

Raises:
TwinModelError:

if initialize_evaluation(…) has not been called before, if there is no ‘Time’ column in the inputs dataframe, if there is no time instant t=0.s in the inputs dataframe.

Examples

>>> import pandas as pd
>>> from pytwin import TwinModel
>>> twin_model = TwinModel(model_filepath='path_to_your_twin_model.twin')
>>> inputs_df = pd.DataFrame({'Time': [0., 1., 2.], 'input1': [1., 2., 3.], 'input2': [1., 2., 3.]})
>>> twin_model.initialize_evaluation(inputs={'input1': 1., 'input2': 1.})
>>> outputs_df = twin_model.evaluate_batch(inputs_df=inputs_df)