質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

2回答

445閲覧

model fit return ValueError ?

AliHassan

総合スコア351

Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2018/07/02 06:41

#Dataset divide into two x_val = x_features[:10000] partial_x_train = x_features[10000:] # Features y_val = y_samples[:10000] partial_y_train = y_samples[10000:] #Labels #Training on Dataset history = model.fit(x=partial_x_train,y=partial_y_train,batch_size=512,epochs=20,validation_data=(x_val,y_val))

Traceback (most recent call last):
File "BinaryClassification.py", line 55, in <module>
history = model.fit(x=partial_x_train,y=partial_y_train,batch_size=512,epochs=20,validation_data=(x_val,y_val))
File "C:\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 1143, in fit
batch_size=batch_size)
File "C:\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 765, in _standardize_user_data
exception_prefix='input')
File "C:\Python36\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training_utils.py", line 192, in standardize_input_data
' but got array with shape ' + str(data_shape))
ValueError: Error when checking input: expected dense_1_input to have shape (10000,) but got array with shape (1,)

i don't understand why fit function ValueError? Kindly help me to resolve this nasty error

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

The error resolve "whenever this error you can see in your console, always check where model take input from", this is because model expected something and provided input are according to the model expectation... in my case , my model expected 10,000 train_features and i pass by mistake list in which only 10 elements exit

投稿2018/07/04 06:19

AliHassan

総合スコア351

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

expected dense_1_input to have shape (10000,) but got array with shape (1,)

Something wrong with the shape of the input.
The code for making the model is needed for futher comment.

投稿2018/07/02 13:22

mkgrei

総合スコア8560

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

AliHassan

2018/07/04 05:04

i know this error, but how to resolve it
mkgrei

2018/07/04 05:48

I cannot say anything unless the code to construct the model is provided. What are the shapes of x and input?
AliHassan

2018/07/04 06:14

thanks for your help
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問