Hi.
I want to create a NARX (Nonlinear Autoregressive with exogenous variables) model based on LM (Levenberg Marquardt) method.
Since this two method are not implemented in keras, I search for the library fireTs (for NARX) and neupy (for LM).
I'm using the sample code for both libraries:
fireTS (NARX): fireTS
neupy (LM): Neupy
and I combine them:
from fireTS.models import NARX
from sklearn.ensemble import RandomForestRegressor
import numpy as np
from neupy import algorithms
from neupy.layers import *
x = np.array([[1, 2], [3, 4]])
y = np.array([[1], [0]])
#y = np.ravel(y) <-just to avoid a warning (the error is the same without comment)
network = Input(2) >> Sigmoid(3) >> Sigmoid(1)
optimizer = algorithms.LevenbergMarquardt(network)
mdl1 = NARX(
optimizer, #I change random forest for LevenbergMarquardt
auto_order=2,
exog_order=[2, 2],
exog_delay=[1, 1])
mdl1.fit(x, y)
ypred1 = mdl1.predict(x, y)
ypred1
But I'm having this error in .fit method:
ZeroDivisionError Traceback (most recent call last)
in ()
18 exog_delay=[1, 1])
19
---> 20 mdl1.fit(x, y)
21
22 ypred1 = mdl1.predict(x, y)
5 frames
/usr/local/lib/python3.7/dist-packages/neupy/utils/iters.py in
count_minibatches(inputs, batch_size)
22
23 def count_minibatches(inputs, batch_size):
---> 24 return int(math.ceil(count_samples(inputs) / batch_size))
25
26
ZeroDivisionError: division by zero
Any solution?
Hi.
I want to create a NARX (Nonlinear Autoregressive with exogenous variables) model based on LM (Levenberg Marquardt) method.
Since this two method are not implemented in keras, I search for the library fireTs (for NARX) and neupy (for LM).
I'm using the sample code for both libraries:
fireTS (NARX): fireTS
neupy (LM): Neupy
and I combine them:
But I'm having this error in .fit method:
Any solution?