stefanonardo / pytorch-esn

An Echo State Network module for PyTorch.
MIT License
205 stars 43 forks source link

Problems with mackey example #5

Closed DaddyWesker closed 5 years ago

DaddyWesker commented 5 years ago

Here is what i've found:

  1. if dtype == torch.double:
    data = np.loadtxt('../../datasets/mg17.csv', delimiter=',', dtype=np.float64)
    elif dtype == torch.float:
    data = np.loadtxt('../../datasets/mg17.csv', delimiter=',', dtype=np.float32)

    Here are wrong pathes to dataset since it's in the same directory so it should be

    if dtype == torch.double:
    data = np.loadtxt('datasets/mg17.csv', delimiter=',', dtype=np.float64)
    elif dtype == torch.float:
    data = np.loadtxt('datasets/mg17.csv', delimiter=',', dtype=np.float32)
  2. Next.
    X_data = np.expand_dims(data[:, [0]], axis=1)
    Y_data = np.expand_dims(data[:, [1]], axis=1)

    I guess it should be

    X_data = np.expand_dims(data[:, [1]], axis=1)
    Y_data = np.expand_dims(data[:, [0]], axis=1)

    or am i wrong?

  3. When launching with these fixes i'm getting

Training error: 0.051316608186617714 Test error: 0.052949286276803606

It's quite big. Moreover, when i'm trying to make plot to compare real and output i'm getting following picture on "test" data

5000 test outputs 5000_outputs

Closer look (100 outputs) 100_outputs closer_look

Am i doing something wrong?

CICS-Oleg commented 5 years ago

I've faced the very same problems.

stefanonardo commented 5 years ago
  1. You're right. I had a different local configuration and I forgot to fix it. Thank you.
  2. No, first version is ok. Take a look at the file. The second column is one step ahead the first. Why would you change it?
  3. Without your fixes (which are wrong), this is my output:
Training error: 2.2575365622118302e-32
Test error: 2.479526951321681e-32
Ended in 2.1474649906158447 seconds.
DaddyWesker commented 5 years ago

No, first version is ok. Take a look at the file. The second column is one step ahead the first. Why would you change it?

Well, in file mg17.csv it can be seen that first column is some numbers different to each other. Second column is all consists of same numbers all over again "1.236445196138708791e-01". You are sending these 1.236445196138708791e-01 to Y, then sending it to your model and getting just the same result in the output "1.236445196138708791e-01". So it was obvious to me that it's somehow wrong. What the point to send array of "1.236445196138708791e-01" to model getting same "1.236445196138708791e-01" array as output and getting 0 error? So i thought that second column is delta X and first column is Y. And because of that i've changed those columns. And with that assumption it is possible to get graph like green on pictures but not possible to get normal predictions.

stefanonardo commented 5 years ago

Ok, I see your point now! The dataset is the problem, second column is wrong. I don't how it happened. I will fix the repo ASAP, in the meantime, try this file: https://gist.github.com/stefanonardo/e216b13b21d07d31ca557058028c1198

DaddyWesker commented 5 years ago

Ok, I see your point now! The dataset is the problem, second column is wrong. I don't how it happened. I will fix the repo ASAP, in the meantime, try this file: https://gist.github.com/stefanonardo/e216b13b21d07d31ca557058028c1198

Great. That worked. Thanks