AutoViML / Auto_TS

Automatically build ARIMA, SARIMAX, VAR, FB Prophet and XGBoost Models on Time Series data sets with a Single Line of Code. Created by Ram Seshadri. Collaborators welcome.
Apache License 2.0
729 stars 114 forks source link

Type of time series column datetime is float or unknown. Must be string or datetime. Please check input and try again. #70

Closed plaban1981 closed 2 years ago

plaban1981 commented 2 years ago

<class 'pandas.core.frame.DataFrame'> Int64Index: 101952 entries, 0 to 103391 Data columns (total 8 columns):

Column Non-Null Count Dtype


0 datetime 101952 non-null datetime64[ns] 1 load 101952 non-null float64
2 apparent_temperature 101952 non-null float64
3 temperature 101952 non-null float64
4 humidity 101952 non-null float64
5 dew_point 101952 non-null float64
6 wind_speed 101952 non-null float64
7 cloud_cover 101952 non-null float64
dtypes: datetime64ns, float64(7) memory usage: 7.0 MB

sample data

datetime load apparent_temperature temperature humidity dew_point wind_speed cloud_cover 0 2018-01-01 00:00:00 803.22270 10.45800 10.45800 0.955500 8.946000 0.0 0.0 1 2018-01-01 00:15:00 774.89523 10.32675 10.32675 0.961625 8.911875 0.0 0.0 2 2018-01-01 00:30:00 731.46927 10.19550 10.19550 0.967750 8.877750 0.0 0.0 3 2018-01-01 00:45:00 713.93870 10.06425 10.06425 0.973875 8.843625 0.0 0.0 4 2018-01-01 01:00:00 699.23007 9.93300 9.93300 0.980000 8.809500 0.0 0.0

model = auto_timeseries( score_type='rmse', time_interval='T,min', non_seasonal_pdq=None, seasonality=True, seasonal_period=60, model_type=['Prophet'], verbose=2)

model.fit( traindata=train, ts_column="datetime", target="load", cv=5, sep="," )

While training I emncounter the below error : Start of Fit..... Running Augmented Dickey-Fuller test with paramters: maxlag: 31 regression: c autolag: BIC Results of Augmented Dickey-Fuller Test: +-----------------------------+------------------------------+ | | Dickey-Fuller Augmented Test | +-----------------------------+------------------------------+ | Test Statistic | -15.883436634196332 | | p-value | 8.704767665249516e-29 | | #Lags Used | 27.0 | | Number of Observations Used | 101924.0 | | Critical Value (1%) | -3.430414160204652 | | Critical Value (5%) | -2.8615683578111595 | | Critical Value (10%) | -2.5667850938695476 | +-----------------------------+------------------------------+ this series is stationary Target variable given as = load Start of loading of data..... Input is data frame. Performing Time Series Analysis ts_column: datetime sep: , target: load Using given input: pandas dataframe... datetime column exists in given train data... Type of time series column datetime is float or unknown. Must be string or datetime. Please check input and try again.

TypeError Traceback (most recent call last)

in () ----> 1 model.fit( traindata=train, ts_column="datetime", target="load", cv=5, sep="," ) 1 frames /usr/local/lib/python3.7/dist-packages/auto_ts/__init__.py in fit(self, traindata, ts_column, target, sep, cv) 309 dask_df, ts_df = load_ts_data(traindata, self.ts_column, sep, target, self.dask_xgboost_flag) 310 else: --> 311 _, ts_df = load_ts_data(traindata, self.ts_column, sep, target, self.dask_xgboost_flag) 312 if isinstance(ts_df, str): 313 print("""Time Series column '%s' could not be converted to a Pandas date time column. /usr/local/lib/python3.7/dist-packages/auto_ts/utils/etl.py in load_ts_data(filename, ts_column, sep, target, dask_xgboost_flag) 51 dft, _ = change_to_datetime_index(dft, ts_column) 52 ### you have to change the pandas df also to datetime index ### ---> 53 filename, _ = change_to_datetime_index(filename, ts_column) 54 #preds = [x for x in list(dft) if x not in [target]] 55 #dft = dft[[target]+preds] TypeError: cannot unpack non-iterable NoneType object Note the datetime column is in datetimeformat , even then it throws error. Could you please help me with the resolution [AssignmentData.csv](https://github.com/AutoViML/Auto_TS/files/7776667/AssignmentData.csv)
plaban1981 commented 2 years ago

Sorry this issue still persists. Please consider it open

plaban1981 commented 2 years ago

Machine_learning_Assignment (1).zip Attached is the sample notebook

AutoViML commented 2 years ago

Hi @plaban1981 👍 Thanks for the detailed notebook. yes I found the bug and fixed it, you should upgrade your auto-ts version like this:

pip install auto-ts --upgrade

and run it. All the best! AutoViML team

Plabanzeoanai commented 2 years ago

Thanks a lot for the prompt resolution. It surely does executes for Prophet now . Much Appreciated. Machine_learning_Assignment__using_Auto_Timeseries.zip

But when I try to apply ARIMA, ML models I encounter the below error

Time Interval is given as T,min Correct Time interval given as a valid Pandas date-range frequency...

UnboundLocalError Traceback (most recent call last)

in () ----> 1 model.fit( traindata=train, ts_column="datetime", target="load" ) /usr/local/lib/python3.7/dist-packages/auto_ts/__init__.py in fit(self, traindata, ts_column, target, sep, cv) 529 if self.time_interval in ['T,min']: 530 ### put the time interval back in shape ### --> 531 self.time_interval = ts_time_interval 532 533 # if self.__any_contained_in_list(what_list=['ARIMA', 'stats', 'best'], in_list=self.model_type): UnboundLocalError: local variable 'ts_time_interval' referenced before assignment Model instantiated with the below parameters model = auto_timeseries( score_type='rmse', time_interval='T,min', non_seasonal_pdq=None, seasonality=True, seasonal_period=60, model_type=['ARIMA','ML'], verbose=2) model.fit( traindata=train, ts_column="datetime", target="load" )
AutoViML commented 2 years ago

Hi @plaban1981 👍

I found that you should set seasonality = False and run ARIMA first. Then try it setting as True.

I found the bug and fixed it, you should upgrade your auto-ts version like this:

pip install auto-ts --upgrade

and run it. All the best! AutoViML team