Statsmodels Exporter Module

Copyright (c) 2004-2016 Zementis, Inc. Copyright (c) 2016-2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class statsmodels_to_pmml.StatsmodelsToPmml(results_obj=None, pmml_file_name='from_statsmodels.pmml', conf_int=None, model_name=None, description=None)[source]

Bases: object

Exports time-series models from statsmodels library into PMML.

results_obj:

Instance of AR(I)MAResultsWrapper / (SARI/VAR)MAXResultsWrapper from statsmodels

pmml_file_name: string

Name of the PMML

conf_intlist (optional)

Confidence intervel. A list of values mentioning the percentage of confidence. e.g., conf_int = [80,95] will create OutputField for lower bound and upper bound of confidence interval with 80% and 95%.

model_namestring (optional)

Name of the model

descriptionstring (optional)

Description of the model

Generates PMML object and exports it to pmml_file_name

construct_pmml()[source]

Constructs the actual model object. (ARIMA/ TimeSeriesModel)

export_pmml()[source]

Writes the generated PMML object to given pmml_file_name

generate_arima_model()[source]

Constructs ARIMA object. Only for statsmodels.tsa.arima_model.ARIMA class.

generate_data_dictionary()[source]

Generates DataDictionary Object. The number of DataField is one more than the dimension of the data. The extra DataField is a supplementary to hold the value of `h`(horizon) for forecasting.

generate_mining_schema()[source]

Generates MiningSchema object.

generate_output()[source]

Generates Output object. If user provides value in conf_int parameter, then there will be two OuputField for each value. One with feature=confidenceIntervalLower and another with feature=confidenceIntervalUpper.

generate_state_space_model()[source]

Constructs StateSpaceModel object. For the following models - - statsmodels.tsa.statespace.sarimax.SARIMAX - statsmodels.tsa.statespace.varmax.VARMAX - statsmodels.tsa.statespace.tsa.arima.ARIMA

generate_time_series()[source]

Generates TimeSeries object. The number of TimeSeries object is equal to the dimeansion of the data.

generate_time_value_object(data)[source]

Generates TimeValue object. If data has any index, then the index will be in TimeStamp object.