Hot answers tagged

8

The performance on in-sample data almost does not count. The performance on out-of-sample data is more indicative of how you should expect your model to perform on future inputs. The second model has better out-of-sample performance. With just that information, I would prefer the second model.


3

There are at least two reasons why the split should be made first: In theory at least, there is a true distribution of the data for the target task. Any model should always be evaluated on the true distribution of the data, because the goal is to predict on this distribution. Since data augmentation modifies this distribution, it's as if the model is ...


2

Based on how the EarlyStopping callback is implemented there doesn't seem to be way to accomplish this. After an epoch ends (in your case more specifically the end of the first epoch) it checks if the value at the end of the epoch is an improvement over the current value (see this function, where the current value is stored in self.best. When the training of ...


2

Linking to the same paper as @scholle but explaining the process differently (book and paper). You do not need to train the model multiple times. The algorithm described in the links above require a trained model to begin with. Given a trained model, compute the metric of interest on some dataset (the book discusses pros/cons of using training set vs test ...


1

For anyone else who might be facing the same question, here's a solution. Basically, it's answered here. But I'm going to repeat the answer for the sake of completeness. You can use a callback and combine the already calculated metrics into a new one. This means that the metric for each individual output should already be calculated using an entry in the ...


1

This is quite easy to do using the keras functional API. Assuming you have an image of size 28 by 28 and 5 additional features, your model could look something like this: from tensorflow.keras import Model, Input from tensorflow.keras.layers import Conv2D, MaxPool2D, Dense, Flatten, concatenate input_image = Input(shape=(28, 28, 3)) input_features = Input(...


1

To clear this, we need to understand the difference between input_dim and input_shape, both are useful for two main reasons: Ensuring proper shapes are always passed. Initializing the weights without passing any dummy tensors(can call model.summary() after defining the architecture). input_shape is used to tell the model what tensor shape should it expect. ...


1

This is simply how the tokenizer works given the defaults that are defined, see also the documentation. By default the value for the split argument is ' ', meaning that it splits the sentences on every space character to get the tokens for that sentence. You can change this to get other multi-character tokens from a sentence. In addition, there is the ...


1

Often words are used as tokens as they carrie a meaning. This meaning is translated into "machine readable" format, which happens to be a number. So one distinct word will be one distinct token (or variable if you want to say so). Per docs you can change the TF/Keras default behaviour of "choosing words" by adding the option char_level=...


1

I think the issue is mostly with your network architecture. You are using only one convolutional layers and you are using all sigmoid activiations. Adding more convolutional layers, changing the activations from sigmoid to relu, and changing the optimizer to Adam gives me a loss below 5 after 30 epochs: model = tf.keras.Sequential([ tf.keras.layers.Conv2D(...


Only top voted, non community-wiki answers of a minimum length are eligible