Why should each sample in model.fit have the same size?
Before, with the link https://www.tutorialfor.com/go.php?id=141258
model.fit ([inputs_train, queries_train], answers_train, batch_size = 30, epochs = 100, validation_data = ([inputs_test, queries_test], answers_test))
I asked you that there was an error in the line. As a result, it turned out that an error appears because the list size of inputs_test and queries_test is different.
But why should the data sizes of the two trains and the two tests be the same? Why does the error occur otherwise?
I can't understand that.
Answer # 1
fit is a method for learning a model, but it may be easy to understand what it means to learn.
Basically, learning proceeds by inputting one learning data (x, train data) for one teacher data (y, target data, label data) (calculating weights) Go). Each piece of data is represented by a single line, and multiple items of data are specified together.
So the teacher data and learning data lines must match.
In this case, it is normal that the columns are different, and it is common to obtain a single result for multiple training data.
This is the same when specifying with validation_data. Using the data specified there, we can see what kind of result is obtained by giving a set similar to the training data, but it is specified in validation_data. The rows must match to evaluate it row by row. (Aside) In the case of validation_split, evaluation is performed by picking up the ratio specified from x and y, but the ratio to the total number of rows is specified.
Answer # 2
In order to perform arithmetic operations between tenors, both types must match.
However, you can increase or decrease the column depending on the model structure, so you don't have to worry too much about the input value. On the other hand, the row (number of samples) generally retains the value at the time of input, so it cannot be calculated unless it is matched in advance
- are there any programming ideas you should learn to learn python?
- the number that should have been applied to if in the conditional expression of python has gone to else help me!
- ruby beginner i'm wondering if i should switch to python
- python - the sample program attached with text does not work properly
- python - i want to run the nfcpy sample program "tagtoolpy" on raspberry pi
- what should i do with json of private key when creating windows app using gspread in python?
- python - which row or column should be clumped together in a multidimensional array?
- python - i want to solve the phenomenon that should not occur when the solution of the cubic equation is obtained
- python - module can't be imported even though the path should pass
- python 3x - error in sample program of anaphora analysis of natural language processing using spacy and neuralcoref
- i cannot resolve the error in the python sample code non-ascii character
- python - is it ideal that cms and scraping language should be unified?
- python - there is a delay in the result predicted by keras lstm and i want to improve it
- python - keras cannot be imported
- python - environment preparation for using keras
- python - about keras maxpooling2d
- python - 'functional' object has no attribute'predict_classes' cannot be fixed
- python - i cannot start tensorboard (i get an error, i was able to do it before)
- python - understanding hidden layers and parameters of lstm
- python - please tell me the solution of yolov3 error [filenotfounderror: [errno 2] no such file or directory:'traintxt']
- python - error converting to tpu model
- python: want to download mnist from tensorflow_datasets