This is a model
model = Sequential()
model.add(LSTM(units=50, return_sequences=True, input_shape=(x_train.shape[1], 1)))
model.add(Dropout(0.2))
model.add(LSTM(units=50, return_sequences=True))
model.add(Dropout(0.2))
model.add(LSTM(units=50))
model.add(Dropout(0.2))
model.add(Dense(units=1))
model.compile(optimizer='adam', loss='mean_squared_error')
model.fit(x_train, y_train, epochs=25, batch_size=32)
this is x_train
[[0.04617442 0.05656144 0.04546953 ... 0.04695716 0.04734586 0.04784481]
[0.05656144 0.04546953 0.04765075 ... 0.04734586 0.04784481 0.04834719]
[0.04546953 0.04765075 0.04634855 ... 0.04784481 0.04834719 0.04655457]
...
[0.60952264 0.61613748 0.60684502 ... 0.40746766 0.41835101 0.40486853]
[0.61613748 0.60684502 0.6252772 ... 0.41835101 0.40486853 0.39453283]
[0.60684502 0.6252772 0.61798941 ... 0.40486853 0.39453283 0.39521655]]
and this is y_train
[0.04834719 0.04655457 0.0376515 0.05167056 0.05245748 0.05324171
0.05216517 0.05863119 0.05741312 0.05259106 0.05299962 0.052746
0.05458153 0.05838135 0.06751278 0.06506946 0.06582629 0.06984874
0.07154225 0.06549558 0.06493836 0.06617143 0.06475118 0.0586059
0.06089464 0.0714996 0.06963213 0.0726755 0.07353708 0.07340649
0.07889471 0.15394023 0.16362583 0.15840337 0.17024544 0.17265126
0.18711347 0.19656302 0.18774378 0.2001797 0.17313691 0.17574187
0.17647469 0.18387175 0.17340942 0.19092584 0.19262895 0.19745882
0.19802312 0.20156629 0.19913772 0.20795919 0.22594831 0.21477037
0.18832164 0.1954792 0.19432942 0.19608138 0.19215213 0.20290149
0.20830567 0.21897313 0.24632183 0.2528602 0.24917299 0.24408798
0.25268696 0.26859211 0.28856467 0.30981095 0.39569459 0.37152846
0.45914045 0.47780588 0.49972095 0.46641879 0.41016142 0.402603
0.49894329 0.476131 0.47457315 0.44511819 0.46610034 0.47707336
0.48385032 0.54839096 0.56217549 0.55325186 0.5469634 0.51160693
0.53812619 0.53703587 0.55564311 0.50011891 0.44799906 0.46010921
0.45987961 0.4829568 0.47361652 0.44595119 0.4784208 0.4708699
0.49355353 0.50239917 0.55053484 0.56556506 0.58179852 0.61568356
0.59087376 0.61081382 0.63718847 0.70138853 0.75932226 0.77530266
0.79149641 0.87258552 1. 0.80935109 0.93668352 0.89010224
0.77132878 0.74699413 0.76971935 0.89029965 0.81274421 0.78810207
0.81202809 0.83722326 0.92406242 0.95399501 0.91060204 0.82763744
0.87519236 0.83114349 0.71298307 0.77943282 0.63203928 0.65451682
0.75566105 0.74154506 0.7661279 0.74865484 0.72203475 0.67603809
0.66679986 0.67718964 0.6728703 0.63204304 0.63986091 0.63635507
0.6455347 0.69526082 0.72791641 0.74023926 0.77180413 0.78724155
0.87411788 0.84006437 0.88829266 0.89083389 0.88007448 0.82715519
0.84478635 0.83012831 0.77950979 0.69173324 0.71875293 0.72528246
0.71045473 0.72231594 0.78161275 0.76572161 0.70071191 0.69998463
0.72877906 0.70299034 0.70076055 0.72491658 0.70564603 0.66082041
0.63542489 0.64457284 0.64795134 0.66118934 0.72241475 0.75119568
0.74817523 0.74620368 0.72309502 0.7401436 0.73224297 0.72118916
0.69841652 0.70490483 0.72900389 0.7238483 0.72358854 0.72251376
0.71513924 0.71144553 0.70697163 0.71405999 0.70524481 0.68840704
0.69367657 0.65821053 0.54291621 0.52902658 0.49075741 0.50457474
0.50395804 0.48922028 0.50894445 0.51408217 0.51925705 0.50542185
0.49980117 0.49414033 0.4771549 0.50392767 0.50217658 0.54033465
0.53937106 0.51184445 0.51338331 0.51176636 0.51734835 0.49974187
0.48332861 0.48919174 0.47560051 0.477197 0.50147935 0.50372986
0.48651849 0.42791962 0.42571689 0.54708952 0.60784517 0.6397418
0.60900729 0.6268448 0.60376416 0.60312552 0.60952264 0.61613748
0.60684502 0.6252772 0.61798941 0.6198978 0.61019408 0.56208217
0.56298696 0.58814557 0.55718522 0.56320326 0.56243383 0.55201785
0.5295464 0.53565746 0.53848739 0.51054769 0.4998226 0.481222
0.44123784 0.40524106 0.41576636 0.37938405 0.38959714 0.39710875
0.42968651 0.42255753 0.45355942 0.43363444 0.41852151 0.40788339
0.40769177 0.40060926 0.42101873 0.43128091 0.43224186 0.43308491
0.41608898 0.40332171 0.3970106 0.39968375 0.40244458 0.38736562
0.39023852 0.36738037 0.33702032 0.40318477 0.39549418 0.39715505
0.39427906 0.42759903 0.41138147 0.40793996 0.40301351 0.39925039
0.40456628 0.40746766 0.41835101 0.40486853 0.39453283 0.39521655
0.37289052]
When I run the program it gives this error:
ValueError: Input 0 of layer sequential is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 60)
I saw this code in youtube it seems work but I checked many times but it doesn't work for me .I am new to Tensorflow
, and thanks for your help