neural-network

Keras: How to stop training with the lowest observed metric value?

折月煮酒 提交于 2019-12-13 09:47:20
问题 With Keras, I would like to stop the training at the epoch which returns the best (in most cases: lowest) observed metric (such as val_loss for example). I would not like to use the state of the network after the patience "ran out". How can I do that? 回答1: Well.... you can't really "stop" at the best accuracy, because you need to know the future values to decide if there will be better values! But you can use another callback, the ModelCheckpoint, to save your model after each epoch. You can

Why does my neural network never overfit?

眉间皱痕 提交于 2019-12-13 09:42:37
问题 I am training a deep residual network with 10 hidden layers with game data. Does anyone have an idea why I don't get any overfitting here? Training and test loss still decreasing after 100 epochs of training. https://imgur.com/Tf3DIZL 回答1: Just a couple of advice: for deep learning is recommended to do even 90/10 or 95/5 splitting (Andrew Ng) this small difference between curves means that your learning_rate is not tuned; try to increase it (and, probably, number of epochs if you will

Output for an RNN

谁说我不能喝 提交于 2019-12-13 07:29:13
问题 I'm taking the Coursera course Neural Networks for Machine Learning hosted by Geoffrey Hinton from the University of Toronto and there is a quiz question in week 7 for which my answer differs from the right one. The question goes like this: One question is, how should I get a probability between 0 and 1 if the Whh weight is negative and the logistic h unit gives values between 0 and 1. Given the above, their linear combination will allways be negative. A second question would be if we also

How to compute the sum of the values of elements in a vector using cblas functions?

巧了我就是萌 提交于 2019-12-13 07:19:42
问题 I need to sum all the elements of a matrix in caffe, But as I noticed, the caffe wrapper of the cblas functions ( 'math_functions.hpp' & 'math_functions.cpp' ) is using cblas_sasum function as caffe_cpu_asum that computes the sum of the absolute values of elements in a vector. Since I'm a newbie in cblas, I tried to find a suitable function to get rid of absolute there, but it seems that there is no function with that property in cblas. Any suggestion? 回答1: There is a way to do so using cblas

Predicting Neural Network Input From it's Output

假装没事ソ 提交于 2019-12-13 05:36:07
问题 Assume you have a Neural Network, with no activation function, only known biases, weights, and an Output. Assuming it is possible, which I see no reason it wouldn't be, the first step you would do would be to subtract the biases from the Neural Network's Output, and after that, you would have to use some method to take the Outputs without the biases and with the weights to find the values of the Hidden Layer. On paper, you could use substitution to find the values of the Hidden Layer, but I

Training neural network using particle swarm optimization in matlab

时光总嘲笑我的痴心妄想 提交于 2019-12-13 04:29:12
问题 I want to train a neural network using Particle Swarm Optimization algorithm, but matlab toolbox doesn't have any function for train network with this algorithm, I've searched and founded some PSO toolboxes but they didn't work. Can anybody help me please? Thanks 回答1: you can use George Ever's toolbook for trainng neural network using PSO: http://www.georgeevers.org/pso_research_toolbox.htm and download tricia sample code: http://www.mathworks.com/matlabcentral/fileexchange/29565-neural

InvalidType: Invalid operation is performed

风流意气都作罢 提交于 2019-12-13 03:58:33
问题 I am trying to write a stacked autoencoder. Since this a stacked autoencoder we need to train the first autoencoder and pass the weights to the second autoencoder. So during training we need to define train_data_for_next_layer. Here I am getting error: InvalidType: Invalid operation is performed in: LinearFunction (Forward) Expect: x.shape[1] == W.shape[1] Actual: 784 != 250 I am having issue with the last line. Is this problem due to incorrect model layer, I want to know what is the issue

Input contains NaN, infinity or a value too large for dtype('float64') in Tensorflow

元气小坏坏 提交于 2019-12-13 03:46:39
问题 I am trying to train a LSTM and in my model I have an exponential learning rate decay and a dropout layer. In order to deactivate the dropout layer when testing and validating, I have put a placeholder for the dropout rate and given it a default value of 1.0 and when training i am setting it to 0.5. The dropou_rate placeholder value is passed to the tf.layers.dropout(). When I run this during the validation I get the following error. ValueError: Input contains NaN, infinity or a value too

How to make a piecewise activation function with Python in TensorFlow?

最后都变了- 提交于 2019-12-13 03:22:13
问题 The active function in my CNN has the form: abs(X)< tou f = 1.716tanh(0.667x) x >= tou f = 1.716[tanh(2tou/3)+tanh'(2tou/3)(x-tou)] x <= -tou f = 1.716[tanh(-2tou/3)+tanh'(-2tou/3)(x+tou)] tou is a constant. So, in TensorFlow it is possible to make your own activation function. I don't want to write it in C++ and recompile the whole of TensorFlow. How can I use the function available in TensorFlow to achieve it? 回答1: In tensorflow it is easy to write your own activation function if it's

How to set up LSTM network for predict multi-sequence?

断了今生、忘了曾经 提交于 2019-12-13 03:18:49
问题 I am learning how to set up the RNN-LSTM network for prediction. I have created the dataset with one input variable. x y 1 2.5 2 6 3 8.6 4 11.2 5 13.8 6 16.4 ... By the following python code, I have created the window data, like [x(t-2), x(t-1), x(t)] to predict [y(t)]: df= pd.read_excel('dataset.xlsx') # split a univariate dataset into train/test sets def split_dataset(data): train, test = data[:-328], data[-328:-6] return train, test train, test = split_dataset(df.values) # scale train and