Skip to content
Permalink
Browse files

added ARIMA and SARIMAX examples

Example Jupyter Notebook files and required data files are added . which gives a demo of ArimaToPMML() method usage for both ARIMA and SARIMAX
  • Loading branch information...
Chiragasourabh committed Mar 14, 2019
1 parent 4e96126 commit 5290fa01b0d2bf6f76d1b239a64f6d524177d017

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,95 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"from statsmodels.tsa.arima_model import ARIMA\n",
"from nyoka import ArimaToPMML\n",
"import warnings\n",
"warnings.filterwarnings('ignore')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def parser(x):\n",
" return pd.datetime.strptime(x,'%Y-%m')\n",
"\n",
"# Load the data\n",
"sales_data = pd.read_csv('sales-cars.csv', index_col=0, parse_dates = [0], date_parser = parser)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"model = ARIMA(sales_data, order = (9, 2, 0))\n",
"result = model.fit()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Export"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<nyoka.statsmodels.arima.ArimaToPMML at 0x15bb6ac1fd0>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Use exporter to create pmml file\n",
"pmml_f_name = 'non_seasonal_car_sales.pmml'\n",
"ArimaToPMML( time_series_data = sales_data,\n",
" model_obj = model,\n",
" results_obj = result,\n",
" pmml_file_name = pmml_f_name\n",
" )"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 5290fa0

Please sign in to comment.
You can’t perform that action at this time.