Auto_timeseries is a complex model building utility for time series data. Since it automates many Tasks involved in a complex endeavor, it assumes many intelligent defaults. But you can change them. Auto_Timeseries will rapidly build predictive models based on Statsmodels ARIMA, Seasonal ARIMA and Scikit-Learn ML. It will automatically select the best model which gives best score specified.
New version 0.0.25 onwards changes the syntax of Auto_TimeSeries to be more like scikit-learn (fit and predict syntax). You will have to initialize an object and then call fit with your data and then predict again with data. Hope this makes it easier to remember and use.
Auto_TimeSeries enables you to build and select multiple time series models using techniques such as ARIMA, SARIMAX, VAR, decomposable (trend+seasonality+holidays) models, and ensemble machine learning models.
Auto_TimeSeries is an Automated ML library for time series data. Auto_TimeSeries was initially conceived and developed by Ram Seshadri and was significantly expanded in functionality and scope and upgraded to its present status by Nikhil Gupta.
auto-ts.Auto_TimeSeries() is the main function that you will call with your train data. You can then choose what kind of models you want: stats, ml or FB prophet based model. You can also tell it to automatically select the best model based on the scoring parameter you want it to be based on. It will return the best model and a dictionary containing predictions for the number of forecast_periods you mentioned (default=2).
- Use “pip install auto-ts”
- Use “pip3 install auto-ts” if the above doesn’t work
- pip install git+git://github.com/AutoViML/Auto_TS
First you need to import auto_timeseries from auto_ts library:
from auto_ts import auto_timeseries
Second, Initialize an auto_timeseries model object which will hold all your parameters:
Here are how the input parameters defined:
model = auto_timeseries(
- score_type (default='rmse'): The metric used for scoring the models. Type is string. Currently only the following two types are supported: (1) "rmse": Root Mean Squared Error (RMSE) (2) "normalized_rmse": Ratio of RMSE to the standard deviation of actuals
- time_interval (default=None): Used to indicate the frequency at which the data is collected This is used for two purposes (1) in building the Prophet model and (2) used to impute the seasonal period for SARIMAX in case it is not provided by the user (None). Type is String. Allowed values are: (1) 'months', 'month', 'm' for monthly frequency data (2) 'days', 'daily', 'd' for daily freuency data (3) 'weeks', 'weekly', 'w' for weekly frequency data (4) 'qtr', 'quarter', 'q' for quarterly frequency data (5) 'years', 'year', 'annual', 'y', 'a' for yearly frequency data (6) 'hours', 'hourly', 'h' for hourly frequency data (7) 'minutes', 'minute', 'min', 'n' for minute frequency data (8) 'seconds', 'second', 'sec', 's' for second frequency data You can leave it blank and auto_timeseries will impute it.
- non_seasonal_pdq (default = (3,1,3)): Indicates the maximum value of (p, d, q) to be used in the search for statistical ARIMA models. If None, then the following values are assumed max_p = 3, max_d = 1, max_q = 3. Type is Tuple.
- seasonality (default=False): Used in the building of the SARIMAX model only at this time. True or False. Type is bool.
- seasonal_period (default is None): Indicates the seasonality period in the data. Used in the building of the SARIMAX model only at this time. There is no impact of this argument if seasonality is set to False If None, the program will try to infer this from the time_interval (frequency) of the data (1) If frequency = Monthly, then seasonal_period = 12 (1) If frequency = Daily, then seasonal_period = 30 (1) If frequency = Weekly, then seasonal_period = 52 (1) If frequency = Quarterly, then seasonal_period = 4 (1) If frequency = Yearly, then seasonal_period = 1 (1) If frequency = Hourly, then seasonal_period = 24 (1) If frequency = Minutes, then seasonal_period = 60 (1) If frequency = Seconds, then seasonal_period = 60 Type is integer
- conf_int (default=0.95): Confidence Interval for building the Prophet model. Default: 0.95. Type is float.
- model_type (default: 'stats': The type(s) of model to build. Default to building only statistical models Can be a string or a list of models. Allowed values are: 'best', 'prophet', 'pyflux', 'stats', 'ARIMA', 'SARIMAX', 'VAR', 'ML'. "prophet" will build a model using FB Prophet -> this means you must have FB Prophet installed "stats" will build statsmodels based ARIMA, SARIMAX and VAR models "ML" will build a machine learning model using Random Forests provided explanatory vars are given 'best' will try to build all models and pick the best one If a list is provided, then only those models will be built WARNING: "best" might take some time for large data sets. We recommend that you choose a small sample from your data set bedfore attempting to run entire data. Type can be either: [string, list]
- verbose (default=0): Indicates the verbosity of printing (Default = 0). Type is integer.
Here are how the parameters defined:
- traindata (required): It can be either a dataframe or a file. You must give the name of the file along with its data path in case if a file. It also accepts a pandas dataframe in case you already have a dataframe loaded in your notebook.
- ts_column (required): name of the datetime column in your dataset (it could be a name of column or index number in the columns index)
- target (required): name of the column you are trying to predict. Target could also be the only column in your dataset
- cv (default=5): You can enter any integer for the number of folds you want in your cross validation data set.
- sep (default=","): Sep is the separator in your traindata file. If your separator is ",", "\t", ";", make sure you enter it here. If not, it is ignored.
predictions = model.predict(
testdata = can be either test_data or forecast_period,
Here are how the parameters are defined. You can choose to send either testdata in the form of a dataframe or send in an integer to decide how many periods you want to forecast. You need only
- testdata (required): It can be either a dataframe or an empty string to indicate no test data frame is available. Instead you can use the forecast_period (next).
- forecast_period (optional, default = 5): The number of time intervals ahead that you want to forecast. Type is integer.