Skip to main content
Skip table of contents

tw.forecast.predict

tw.forecast.predict(configuration=dict,dataset=pandas.DataFrame,model=dict)

Generate forecasts using a previously built model. Submits a prediction job, polls until it completes, and returns the forecast results together with job metadata.

Parameters

configuration : dict

Prediction configuration payload as expected by the API.

dataset : pandas.DataFrame

Time-series data covering the prediction horizon.

model: dict

A trained forecast model (as returned by the method: “build_model”).

Returns

dict

A dictionary with keys:

"id" – job identifier (str).

"results" – forecast results as a :class:`pandas.DataFrame`.

"status" – final job status response (dict).

Example Configuration

CODE
forecast_predict_configuration = {
    'prediction_from': {
        'base_unit': 'sample',
        'value': 1
        },
    'prediction_to': {
        'base_unit': 'sample',
        'value': 1
    }, 
    'prediction_boundaries': {
        'type': 'explicit',
        'max_value': 100,
        'min_value': 0
    },
    'data_alignment': [
        {
            'column_name': 'string',
            'timestamp': 'yyyy-mm-dd hh:mm:ssZ'
        }
    ],
}

Example Usage

CODE
forecast_predict_response = tw.forecast.predict(
    configuration = forecast_predict_configuration,
    dataset = dataset,
    model = model
)

Example Output

CODE
forecast_predict_id = forecast_predict_response['id']
forecast_predict_results = forecast_predict_response['results']
forecast_predict_status = forecast_predict_response['status']
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.