Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console error expected dense_Dense1 to have shape [,57,10] #1

Open
Lipe991 opened this issue Jul 14, 2018 · 18 comments
Open

Console error expected dense_Dense1 to have shape [,57,10] #1

Lipe991 opened this issue Jul 14, 2018 · 18 comments

Comments

@Lipe991
Copy link

Lipe991 commented Jul 14, 2018

I've got an error trying to run your code,

Uncaught (in promise) Error: Error when checking target: expected dense_Dense1 to have shape [,57,10], but got array with shape [1,1960,1].

@hallvardkristiansen
Copy link

Same, I've tried changing a lot of parameters and modifying the data structure, but I can't get rid of it.
The error appears in model.fit (and also when testing model.evaluate) at line 105 in 2b_cnn.js

@hallvardkristiansen
Copy link

I would love a thorough explanation for why this happens in this case in particular. I've been banging my head against it for a while now and the head is losing.

@thzou
Copy link

thzou commented Jul 17, 2018

I implement this in Python and Js, same error with data shapes in Dense Layer.

@plska
Copy link

plska commented Jul 17, 2018

glad I'm not the only one seeing this error.

@Thoughtscript
Copy link

Thoughtscript commented Jul 21, 2018

I'm afraid it's my fault - I wrote the original (and as yet uncompleted) code! The CNN wasn't fully implemented yet!

NINJA EDIT - 9.30.18: Very sorry all please see the comment added below. Also, forgive the excessive !'s. Thanks!

@pabx06
Copy link

pabx06 commented Aug 1, 2018

no fix ?

@ashbeats
Copy link

did anyone manage to figure this out...

@ashbeats
Copy link

ashbeats commented Aug 17, 2018

There are major errors with the code. It is not in a functioning state and that makes me wonder it was even tested before the video was recorded?

Firstly, data.highs is mapped to epoch times here:

dates.push(new Date(data[i]['Date'] + 'T00:00:00.000').getTime())

then comes the reshaping part. Why not reshape it prior when the dates are being converted to epoch?

That does not make sense. ( https://js.tensorflow.org/api/0.12.5/#reshape )

and then the part that left me speechless was this...

Why would you map a price series that way? Not even sure what was the goal...

Could someone enlighten me. I'm not sure how the reshaped list should look like.

@hallvardkristiansen
Copy link

It wasn't tested, it's just an idea but that wasn't made very clear in the video.
I've played around with it a lot and gotten it to a state where it works fairly well with a simple NN consisting only of dense layers. Next step is to get my head around formatting the data as matrices and implementing a CNN, but I'm learning as I'm going and some of the maths is hard.

@hallvardkristiansen
Copy link

http://oracle.gigil.berlin/

@klosowsk
Copy link

Same problems here!

@craftgear
Copy link

Same here, kinda disappointment.

@craftgear
Copy link

@llSourcell Hi, do you notice this issue?

@Thoughtscript
Copy link

Thoughtscript commented Sep 30, 2018

There are major errors with the code. It is not in a functioning state and that makes me wonder it was even tested before the video was recorded?

Firstly, data.highs is mapped to epoch times here:

Financial_Forecasting_with_TensorflowJS/public/scripts/2a_cnn.js

Line 35 in 3244c20

dates.push(new Date(data[i]['Date'] + 'T00:00:00.000').getTime())
then comes the reshaping part. Why not reshape it prior when the dates are being converted to epoch?

Financial_Forecasting_with_TensorflowJS/public/scripts/2b_cnn.js

Line 94 in 3244c20

tdates.reshape([1, 1960, 1]),
That does not make sense. ( https://js.tensorflow.org/api/0.12.5/#reshape )

and then the part that left me speechless was this...

Financial_Forecasting_with_TensorflowJS/public/scripts/2b_cnn.js

Line 95 in 3244c20

thighs.reshape([1, 1960, 1]), {
Why would you map a price series that way? Not even sure what was the goal...

Could someone enlighten me. I'm not sure how the reshaped list should look like.

Hi All!

I'm @Thoughtscript - I wanted to apologize about the confusion this has caused! Yikes!

First, let me be very clear that I'm not in any way affiliated with @llSourcell.

This code was NOT PRODUCTION WORTHY and INCOMPLETE - as noted on the original repo listed here - it's a WORK IN PROGRESS.

Actually, I'm not sure how it ended up in a video or attracting any interest whatsoever.

The code was being completed for an article to be posted on the top-ranked consulting firm X-Team's blog. Unfortunately, the company decided to move in another direction with its writing and I've since moved over to Microsoft (though I remain affiliated with X-Team's great community).

Every other repo listed under my @Thoughtscript account without a WIP flag should be fully functional (with any issues, if they exist, noted). This particular project (which you'll note bears my name on in the pictures), is actually no longer maintained.

Any questions, feel free to send me an email at [email protected]. Sorry for any confusion this has caused.

Cheers!

@Thoughtscript
Copy link

PS - maybe try:

  1. Normalizing the values
  2. Correcting the shapes
  3. Correctly configuring the convolutional neural net
  4. Leveraging parallel processing and WebGL since that shit's gonna break on single-threaded JS

@craftgear
Copy link

craftgear commented Sep 30, 2018

Hi @Thoughtscript , thanks for your kind explanation and mostly for noticing this issue!

Now the big question is, what was the working demo which @llSourcell showed us in his Live stream.
https://youtu.be/5Uw1iSwvHH8?t=47m53s

Anyway, I think this is not a proper learning material after all.

@max-hans
Copy link

max-hans commented Jan 1, 2019

Anyway, I think this is not a proper learning material after all.

exactly - this is generating a lot of confusion. for beginners this whole subject is hard to grasp and it is made even harder with all the other backend stuff going on.

siraj makes stuff look really easy by skipping a lot of difficult and crucial steps and this repo here is the perfect example
i wasn't even aware that this is not his code - but maybe i just didn't pay attention
¯_(ツ)_/¯

@gognjanovski
Copy link

I tried to use the code but it didn't worked for me. So the closest working solution that I got was this one: https://towardsdatascience.com/stock-price-prediction-system-using-1d-cnn-with-tensorflow-js-machine-learning-easy-and-fun-fe5323e68ffb

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests