Closed thild closed 6 years ago
Hello,
please make sure to flatten/reshape the initial data, i.e. inputDataTraining.values[-1].reshape(-1)
. Let me know if that solves your problem.
Hi @FlashTek
I tried to reshape as you said, but with no luck.
I'm trying to predict a Lorenz attractor using x and y variables. So I have two inputs and two outputs. I started to study ESN and I'm using this problem to understand the concepts.
Can your library handle multi features? What I'm doing wrong? Any help wold be appreciated.
Best regards
import numpy as np
import pandas as pd
from easyesn.optimizers import GradientOptimizer
from easyesn import PredictionESN
from easyesn.optimizers import GridSearchOptimizer
from easyesn import helper as hlp
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
np.random.seed(42)
# feature_cols = ["x", "y", "z", "vet_norm_x1", "vet_norm_x2", "vet_norm_y1", "vet_norm_y2", "vet_norm_z1", "vet_norm_z2"]
feature_cols = ["x", "y"]
data = pd.read_csv("./data/Lorenz-Bred.dat",
sep=r' ',
skipinitialspace=True, usecols=range(1,10))
X = data.loc[:,feature_cols]
X_train, X_test, y_train, y_test = train_test_split(X, X, test_size=0.33, shuffle=False)
inputDataTraining = np.array(list(zip(X_train["x"],X_train["y"])))
inputDataValidation = np.array(list(zip(X_test["x"],X_test["y"])))
# inputDataTraining = X_train.values.reshape(-1)
# inputDataValidation = X_test.values.reshape(-1)
esn = PredictionESN(n_input=0, n_output=2, n_reservoir=100, spectralRadius=0.9, leakingRate=0.2, regressionParameters=[1e-1], solver="pinv", feedback=True)
esn.fit(None, inputDataTraining, transientTime=2500, verbose=1)
generation = esn.generate(n=len(inputDataValidation), inputData=None, initialOutputData=inputDataTraining[-1].reshape(-1))
plt.plot(generation[0, :])
plt.plot(inputDataValidation)
plt.savefig("plot.png")
plt.show()
I have the same problem. I'm using the feedback=True
in PredictionESN
. I guess when setting the number of outputs to more than 1 brings this error, as the previous outputs with a different shape cannot be properly stored in Y[t, :] = previousOutputData[:]
.
Hi,
First of all, thanks for creating this great library.
I'm trying to predict a temporal series based on a chaotic system using generative task. My system have many features but I'm unable to generate the output with more than one feature.
The data was loaded with pandas.
inputDataTraining
andinputDataValidation
are pandas DataFrames.Could you create a example o generating task with more than one feature?
Thanks
If I change inputDataTraining[-1] to inputDataTraining.values[-1] I get: