valueerror in Nbeats model from keras-beats

I am trying to implement NBeats model from keras-beats for timeseries prediction forcasting and it shows me valueerror about using float data type. I tried using astype to convert data to float 32 and 64 and it still showed me similar error

code:
from kerasbeats import prep_time_series, NBeatsModel

# import the dataset

df = pd.read_csv(‘DailyDelhiClimateTrain.csv’, parse_dates = [‘date’], index_col = ‘date’)

# sort by dates

df.sort_index(inplace = True)

# prep a univariate time series for N-Beats

X, y = prep_time_series(df[‘meantemp’], lookback = 7, horizon = 1)

# create training and test sets

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y,

shuffle = False, test_size = 0.2)

# initialize N-Beats and fit

nbeats = NBeatsModel(model_type = ‘generic’, lookback = 7, horizon = 1)

nbeats.fit(X,y)

Error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[104], line 4
      1 X = X.astype('float64')
      2 y = y.astype('float64')
----> 4 nbeats.fit(X,y)

File ~AppDataRoamingPythonPython311site-packageskerasbeatsnbeats.py:384, in NBeatsModel.fit(self, X, y, **kwargs)
    382 """Build and fit model"""
    383 self.build_layer()
--> 384 self.build_model()
    385 self.model.compile(optimizer = keras.optimizers.Adam(self.learning_rate), 
    386                    loss      = [self.loss],
    387                    metrics   = ['mae', 'mape'])
    388 self.model.fit(X, y, batch_size = self.batch_size, **kwargs)

File ~AppDataRoamingPythonPython311site-packageskerasbeatsnbeats.py:376, in NBeatsModel.build_model(self)
    374 def build_model(self):
    375     """Creates keras model to use for fitting"""
--> 376     inputs     = keras.layers.Input(shape = (self.horizon * self.lookback, ), dtype = 'float')
    377     forecasts  = self.model_layer(inputs)
    378     self.model = Model(inputs, forecasts)

File ~AppDataRoamingPythonPython311site-packageskerassrclayerscoreinput_layer.py:143, in Input(shape, batch_size, dtype, sparse, batch_shape, name, tensor)
     89 @keras_export(["keras.layers.Input", "keras.Input"])
     90 def Input(
     91     shape=None,
   (...)
     97     tensor=None,
     98 ):
     99     """Used to instantiate a Keras tensor.
    100 
    101     A Keras tensor is a symbolic tensor-like object, which we augment with
   (...)
    141     ```
    142     """
--> 143     layer = InputLayer(
    144         shape=shape,
    145         batch_size=batch_size,
    146         dtype=dtype,
    147         sparse=sparse,
    148         batch_shape=batch_shape,
    149         name=name,
    150         input_tensor=tensor,
    151     )
    152     return layer.output

File ~AppDataRoamingPythonPython311site-packageskerassrclayerscoreinput_layer.py:49, in InputLayer.__init__(self, shape, batch_size, dtype, sparse, batch_shape, input_tensor, name, **kwargs)
     47     batch_shape = (batch_size,) + shape
     48 self.batch_shape = tuple(batch_shape)
---> 49 self._dtype = backend.standardize_dtype(dtype)
     51 self.sparse = bool(sparse)
     52 if self.sparse and not backend.SUPPORTS_SPARSE_TENSORS:

File ~AppDataRoamingPythonPython311site-packageskerassrcbackendcommonvariables.py:521, in standardize_dtype(dtype)
    518     dtype = dtype.__name__
    520 if dtype not in dtypes.ALLOWED_DTYPES:
--> 521     raise ValueError(f"Invalid dtype: {dtype}")
    522 return dtype

ValueError: Invalid dtype: float

I tried changing dtype to float 32 and 64 and it still didnt work. I was just expecting model to fit the data. For data I have used climate change daata available at kaggle

New contributor

Priyanshu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật