neural-network

Why MSE calculated by Keras Compile is different from MSE calculated by Scikit-Learn?

与世无争的帅哥 提交于 2020-06-28 02:09:22
问题 I'm training a neural network model for forecasting. Loss function is Mean Squared Error (MSE). However, I found that MSE calculated by Keras is much different from one calculated by Scikit-learn. Epoch 1/10 162315/162315 [==============================] - 14s 87us/step - loss: 111.8723 - mean_squared_error: 111.8723 - val_loss: 9.5308 - val_mean_squared_error: 9.5308 Epoch 00001: loss improved from inf to 111.87234, saving model to /home/Model/2019.04.26.10.55 Scikit Learn MSE = 208.811126

Why MSE calculated by Keras Compile is different from MSE calculated by Scikit-Learn?

一世执手 提交于 2020-06-28 02:09:21
问题 I'm training a neural network model for forecasting. Loss function is Mean Squared Error (MSE). However, I found that MSE calculated by Keras is much different from one calculated by Scikit-learn. Epoch 1/10 162315/162315 [==============================] - 14s 87us/step - loss: 111.8723 - mean_squared_error: 111.8723 - val_loss: 9.5308 - val_mean_squared_error: 9.5308 Epoch 00001: loss improved from inf to 111.87234, saving model to /home/Model/2019.04.26.10.55 Scikit Learn MSE = 208.811126

JSONDecodeError: Expecting value: line 1 column 1 (char 0) while translating text

社会主义新天地 提交于 2020-06-27 16:48:28
问题 I am getting the following error while translating a column from spanish to English: JSONDecodeError: Expecting value: line 1 column 1 (char 0) My data frame looks like the following: case_id es fr 1234 - - 2345 Hola como estas? Encantada de conocerte comment vas-tu aujourd'hui 3456 Hola como estas? Encantada de conocerte - 123321 - comment vas-tu aujourd'hui '-' is something that shows that there are no comments. My data frame has a blank strings as well apart from comments so I have

Segnet in Keras: total size of new array must be unchanged error

不羁岁月 提交于 2020-06-27 11:19:20
问题 I am implementing Segnet in Python. Following is the code. img_w = 480 img_h = 360 pool_size = 2 def build_model(img_w, img_h, pool_size): n_labels = 12 kernel = 3 encoding_layers = [ Conv2D(64, (kernel, kernel), input_shape=(img_h, img_w, 3), padding='same'), BatchNormalization(), Activation('relu'), Convolution2D(64, (kernel, kernel), padding='same'), BatchNormalization(), Activation('relu'), MaxPooling2D(pool_size = (pool_size,pool_size)), Convolution2D(128, (kernel, kernel), padding='same

How to use custom activation function in neuralnet in R

你说的曾经没有我的故事 提交于 2020-06-27 05:00:24
问题 I am new to R and I am trying to build a neural network for a regression task. I am using neuralnet library to construct my neuralnet and I notice it accepts several arguments. act.fct being one of it. act.fct a differentiable function that is used for smoothing the result of the cross product of the covariate or neurons and the weights. Additionally the strings, 'logistic' and 'tanh' are possible for the logistic function and tangent hyperbolicus. By default a logistic activation function is

Difference between training function and learning function in MATLAB neural network

。_饼干妹妹 提交于 2020-06-27 04:15:13
问题 I am new to the deep learning toolbox in MATLAB and I am very confused about the difference between training function of network and the corresponding learning function of network parameters. For example, if I create a feedforward network with 7 hidden neurons and gradient descent training function: >> net = feedforwardnet(7,'traingd'); Then, we find what is the learning function of input weight for example: >> net.inputWeights{1}.learnFcn ans = 'learngdm' We find it gradient descent with

Neural Network unable to learn

丶灬走出姿态 提交于 2020-06-27 04:14:19
问题 I am following trask's article to build a bare bone neural network in Python. Though he builds 1 layer Network (that maps 3 inputs to a single output) and a 2 layer network (that has 3 inputs, 4 neuron hidden layer and output layer with single neuron). My task was to build a network that can approximate the function Y = X1 + X2 + X3 . I provide the network with Y and it guesses values of x1, x2 and x3. For this, I modified the above network. I tried to invert both above networks, i.e, tried

Keras: stacking multiple LSTM layer with

谁都会走 提交于 2020-06-26 07:24:09
问题 I have the following network which works fine: output = LSTM(8)(output) output = Dense(2)(output) Now for the same model, I am trying to stack a few LSTM layer like below: output = LSTM(8)(output, return_sequences=True) output = LSTM(8)(output) output = Dense(2)(output) But I got the following errors: TypeError Traceback (most recent call last) <ipython-input-2-0d0ced2c7417> in <module>() 39 40 output = Concatenate(axis=2)([leftOutput,rightOutput]) ---> 41 output = LSTM(8)(output, return

How to compute gradient of output wrt input in Tensorflow 2.0

早过忘川 提交于 2020-06-25 12:21:55
问题 I have a trained Tensorflow 2.0 model (from tf.keras.Sequential()) that takes an input layer with 26 columns (X) and produces an output layer with 1 column (Y). In TF 1.x I was able to calculate the gradient of the output with respect to the input with the following: model = load_model('mymodel.h5') sess = K.get_session() grad_func = tf.gradients(model.output, model.input) gradients = sess.run(grad_func, feed_dict={model.input: X})[0] In TF2 when I try to run tf.gradients(), I get the error:

How to compute gradient of output wrt input in Tensorflow 2.0

人盡茶涼 提交于 2020-06-25 12:20:36
问题 I have a trained Tensorflow 2.0 model (from tf.keras.Sequential()) that takes an input layer with 26 columns (X) and produces an output layer with 1 column (Y). In TF 1.x I was able to calculate the gradient of the output with respect to the input with the following: model = load_model('mymodel.h5') sess = K.get_session() grad_func = tf.gradients(model.output, model.input) gradients = sess.run(grad_func, feed_dict={model.input: X})[0] In TF2 when I try to run tf.gradients(), I get the error: