Hot answers tagged

4

It actually depends on a couple of things here - How many output classes do you have? If you have only 2 or 3 classes, it is a very easy task for the classifier that you have built. So, it is highly possible that convergence has occurred. As @Djib2011 mentioned already, if your input training set is not balanced and is heavier with one of the output classes ...


4

This should make a difference, but how big is the difference heavily depends on your task. However generally speaking, a smaller batch size will have a lower speed if counted in sample/minutes, but have a higher speed in batch/minutes. If the batch size is too small the batch/minute will be very low and therefore decreasing training speed severely. However a ...


3

Some other details you could mention are: total number of model parameters (e.g. 1.2M or 0.15M) & depth of the network (e.g. 38-layered network) family/style of the network architecture (e.g. encoder-decoder arch., LSTM) specifics of connections between network layers (e.g. residual-, dense-, skip-connections) specifics of individual components of the ...


3

As @codeblooded said, you should set random seed for numpy and keras, and also set pythonhashseed. The seeds set the state of the random number generator which makes the results different. This method only works when you train the network on CPU. The problem with getting same result on GPU every single time is that cuDNN is not deterministic. Specifically, ...


3

No. Different batch sizes mean different gradients (check stochastic gradient descent concept you will get how loss calculated) are calculated in each step, and thus the gradient descent will likely end up in different places in parameter space. In addition, how this is actually parallelized might make a difference, including the order of operations and ...


2

I had a similar problem with a 2D convolution on a hexagonal grid while working on a diffusion problem and stumbled upon this question. Rather than using cube coordinates, you could use doubled coordinates, which I found much easier to save in a 2D array. An example kernel that only changes the direct neighbours and the cell itself would be this kernel = ...


2

It depends on the number of classes; we are getting good results with about 40 training examples per class. A good way to get an idea about this is to run a test with an increasing set of training data, evaluating the result as you go along. Obviously, with a small set (eg 3 sentences per class), it will be very poor, but the accuracy should quickly ...


2

First, I assume you've tuned your hyperparameters. Because, instead of re-train the network (use the weights that resulted from the previously training process) that needs more times, I'll invest more on hyperparameters tuning of the available network. Then, there are several methods and considerations: You can use the weight resulted from your first ...


2

Ok, I made a dumb mistake. Please disregard the above panicked ranting. In case anyone else bumps up against something like this however, the issue was resolved just by remembering to clear my session at the end of each run: from keras import backend as K ...code... K.clear_session()


2

This is probably the most major factor: model.compile(loss='categorical_crossentropy', optimizer='adam') you have set the loss function for a multiclass classifier. It is going to have some weird results when values - either predicted or target - are outside of range 0..1 You should use this instead: model.compile(loss='mean_squared_error', optimizer='...


2

A video attention model isn't only detecting the image itself, but it simulates the movement of the human eye on a given picture. It can't be realized as a technical algorithm alone but has to implemented as a cognitive model because the common goal is to replicate human eye movements. Creating a video attention model is usually done with the help of an eye‐...


2

Your question is really broad.. But there are many manuals and tutorials which describe how to do it step by step. My personal favorite would be: Practical Text Classification With Python and Keras - It has a very detailed explanation of every step of the implementation while remaining practical. You can also try: A Word2Vec Keras tutorial - This one ...


2

You can try using a multi-input model. Here is a recent post with a similar discussion, with the required architecture defined in the answer. Instead of combining the separate models, you can create a model which uses image and numerical data side by side. Keras allows you to use different types of data using multi input structure via functional API. And ...


2

I try to answer the things I know for sure: One effect of bigger images is the increasing computation time due to more pixels (input to your training) 4.Grayscaling reduces the information, which might decrease training time, but also model performance (accuracy, precision, recall). What I have seen is that grayscaling is used in for example face detection ...


2

Neural networks can have a lot of different structures. CNNs can have a number of parameters that ranges from a few thousands to several millions. In general you aim to increase the number of filters and reduce the first 2 dimensions, as you go deeper in the network. So if you had Conv -> pool -> Conv -> pool -> ... , you could do for example ...


2

A couple of points: Have you firstly scaled your data, e.g. using MinMaxScaler? This could be one reason why your loss readings remain high. Additionally, consider that while Dropout can be useful for reducing overfitting, it is not necessarily a panacea. Let's take an example of using LSTM to forecast fluctuations in weekly hotel cancellations. Model ...


2

Use seed for random functions. For example if you are using numpy random function from numpy.random import seed seed(1) Read more about reproducible results here, https://machinelearningmastery.com/reproducible-results-neural-networks-keras/ Set PYTHONHASHSEED environment variable at a fixed value import os os.environ['PYTHONHASHSEED'] = str(1) https://...


2

See comprehensive answer here; to paste a snippet, below is complete code for fixing a random seed: def reset_seeds(reset_graph_with_backend=None): if reset_graph_with_backend is not None: K = reset_graph_with_backend K.clear_session() tf.compat.v1.reset_default_graph() print("KERAS AND TENSORFLOW GRAPHS RESET") # ...


2

This question is very broad, so let me attempt to answer it using my own background in time series analysis. As an example, why would I continue using ARIMA to forecast a time series? Why not simply use an LSTM model by default, since this is a type of recurrent neural network that takes time-related dependencies into account? Well, an LSTM model is not ...


1

It can be normal and there might be nothing wrong with your model. If there is a very strong and clear correlation in your data(good separability) then a network can achive very high accuracy very fast. After reaching some value learning gets harder.


1

The answer (as detailed quite thoroughly here and here) is that specifying model.compile(optimizer = 'rmsprop', loss = 'binary_crossentropy', metrics=['accuracy']) causes keras to guess, incorrectly, that because I am using binary_crossentropy for the loss function, that I would want to use binary_accuracy as the way of reporting the accuracy metrics. ...


1

As you have trained your model in batch_size of 500. Weights has been updated for each batch therefore 600 times(300000/500) by the end of one epoch. So, Your model generalized well. Check the predictions. If Predictions are well. Your model is ready.


1

For the line featRaw = selectedLayer.output, when I print featRaw, I get the output: Tensor("block4_conv2/Relu:0", shape=(1, 64, 64, 512), dtype=float32). a) Relu:0 does this mean Relu activation has not yet been applied? It has been applied. b) Also I presume we're outputing the feature maps outputs from block4_conv2, not the filters/...


1

In order to have a configurable optimizer and configurable hyperparameters for it you need to make the function call in the following way: opt = tf.keras.optimizers.get({"class_name": hyperparams['optimizer'], "config": {"learning_rate": hyperparams['learning_rate']}}) where class_name is the name of the optimizer you want to ...


1

You can use LSTM in reinforcement learning, of course. You don't give actions to the agent, it doesn't work like that. The agent give actions to your MDP and you must return proper reward in order to teach the agent. For example if you implement trading bot, the policy(policy=the agent, which is your LSTM network) will say that at step T it is going to have ...


1

Your implementation of single-step Q-learning with neural network and experience replay is basically correct. There are a few blocking issues preventing you seeing it working correctly. Your main problem is a bug in your feature scaling routine. That is a Python issue, not really an AI one. In short, you scale the input features in-place multiple times, ...


1

This is an idea that I used for my model - Try using two RNN (GRU) Networks, one of them to manage current output state and the other to maintain context Say we are at timestamp $t$ and the two GRUCells are represented as $GRU_c$ and $GRU_s$ for GRU context network and state network. (Your output coming from the state network) At time stamp $t$ , the ...


1

I browsed through some other implementations of PPO and they all add small offset (1e-10) to prevent undefined log(0). I did that and the training works now.


1

The answer is that it's the size of the Adam optimizer state. When I change the optimizer to SGD (the vanilla optimizer), the size is not big anymore. As far as I know, the Adam optimizer maintains gradients information of previous training iterations. And the gradient size can be as big as the model size. That's why it causes the file size to be so big. ...


1

I cannot comment much on your setup for inputs and outputs. It seems adequate to get some control, but does not cover the fully Markov state for the game, so I would expect that will limit the agent from ever being truly optimal. I would expect it to learn to play the game though, if you were implementing Q learning with a neural network correctly. In your ...


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