https://github.com/nixtla logo
#general
Title
# general
y

Yaping Lang

09/04/2023, 7:37 AM
Hi all, I'm new to the project, just got token and experimenting with timegpt, i'm constantly hitting this error , does anyone also encounter this ? I'm just using the sample code . I'm able to get the forecast results. but statsforecast spit some error. I've checked both df, there is no null value.. Appreciate any help .. I'm on python@3.11/3.11.5 , numba 0.57.1. I suspect it is the version issue?
Copy code
Traceback (most recent call last):
  File "/Users/lilypad/Documents/Code/timegpt/test1.py", line 19, in <module>
    sf.plot(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
  File "/opt/homebrew/lib/python3.11/site-packages/statsforecast/core.py", line 1789, in plot
    axes[idx, idy].fill_between(
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/__init__.py", line 1446, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 5425, in fill_between
    return self._fill_between_x_or_y(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 5330, in _fill_between_x_or_y
    ind, dep1, dep2 = map(
    ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/numpy/ma/core.py", line 2360, in masked_invalid
    return masked_where(~(np.isfinite(getdata(a))), a, copy=copy)
                          ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
python script is :
Copy code
import pandas as pd
import os
from nixtlats import TimeGPT
from statsforecast import StatsForecast as sf

print(os.environ)


df = pd.read_csv('<https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/electricity-short.csv>')

timegpt = TimeGPT(token=os.environ['TIMEGPT_TOKEN'])
fcst_df = timegpt.forecast(df, h=24, level=[80, 90])

print("NaN count in df:")
print(df.isna().sum())
print("NaN count in fcst_df:")
print(fcst_df.isna().sum())

sf.plot(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
lol i think i know why . 3.11 is not supported yet.. https://github.com/Nixtla/statsforecast/pull/425
j

José Morales

09/04/2023, 3:54 PM
Hey. Can you print the types of the fcst_df (
fcst_df.dtypes
)?. I think the level columns may not be numerical
m

Max (Nixtla)

09/04/2023, 9:18 PM
Hi @Yaping Lang, thanks for the interestest we are currently in closed beta and are trying to onboard as many users as possible. That means that you probably are getting a 429 error. Something like:
Copy code
{
  "status": 429,
  "data": null,
  "message": "Too many requests",
  "details": "You have reached your request limit, top up your credits to continue using the API",
  "code": "A20",
  "requestID": ""
}
If you haven't yet. Could you please fill out the form on our Website so we can process it? Just click on Submit interest on https://www.nixtla.io/
y

Yaping Lang

09/06/2023, 3:13 AM
@José Morales, they were float
Copy code
unique_id         object
ds                object
TimeGPT          float64
TimeGPT-lo-90    float64
TimeGPT-lo-80    float64
TimeGPT-hi-80    float64
TimeGPT-hi-90    float64
dtype: object
j

José Morales

09/06/2023, 10:34 PM
Hmm I think the ds has to be timestamp. Which version of statsforecast are you using?
Also if you can try installing utilsforecast instead (
pip install utilsforecast
) and using:
Copy code
from utilsforecast.plotting import plot_series

plot_series(df, fcst_df, level=[80, 90], max_insample_length=24 * 5)
It'd help us because we're going to replace the statsforecast function with that one and it'd be better to fix the error there if we find one
4 Views