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
- 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 - what should the gbdt objective variable be designed based on?
- python - error from sample number setting in fourier transform of wav
- Python sample code for implementing a simple graduate information management system
- Detailed explanation of sample code using grpc in python golang
- Python writes a sample code that will account for the script
- Python sample code for implementing poker licensing with classes
- Python selenium loads and saves QQ group members, removes the sample code of its group owner and administrator information
- Python sample code for scanning sensitive directories
- python 3x - i get a keterror with a key that should be in the dictionary
- python - error in cnn implementation in keras
- python - dimensional error when discriminating handwritten characters using learning model of mnist
- python - i want to initialize the learning results of the sequential object multiple times
- i want the gpu to calculate python processing
- python - i want to create my own activation function called siren with keras
- python - keras/tensorflow custom layer call method cannot be called
- os - i want to run keras on a computer that can only use old tensorflow
- gpu in python-path doesn't pass-
- python - tensorflow importerror
- python - i want to visualize fitting of regression problem using keras