neural-network

Neural networks: avoid bias in any direction for output

醉酒当歌 提交于 2019-12-24 12:05:17
问题 I'm having difficulties with the CartPole problem. The input to the Cart takes either 0 or 1 as input; Either move left or right. Lets say we have a net with 4 inputs plus bias , 3 hidden layers with 1 neuron each and 1 output ; where all weights are randomized floats between 0 and 1 , and the inputs will also be randomized floats between -10 and 10 . Because i chose everything random, I inherently expect the output to be approximately 0.5 on average, and that the cart will go as much right

Residual Neural Network: Concatenation or Element Addition?

青春壹個敷衍的年華 提交于 2019-12-24 11:59:26
问题 With the residual block in residual neural networks, is the addition at the end of the block true element addition or is it concatenation? For example, would addition([1, 2], [3, 4]) produce [1, 2, 3, 4] or [4, 6] ? 回答1: It would result in [4, 6], and you can find out more in this paper 来源: https://stackoverflow.com/questions/46902386/residual-neural-network-concatenation-or-element-addition

col2im implementation in ConvNet

痞子三分冷 提交于 2019-12-24 10:59:05
问题 I'm trying to implement a CNN only using numpy. While doing the backpropagation, I found out that I had to use col2im in order to reshape dx , so I checked the implementation from https://github.com/huyouare/CS231n/blob/master/assignment2/cs231n/im2col.py. import numpy as np def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1): # First figure out what the size of the output should be N, C, H, W = x_shape assert (H + 2 * padding - field_height) % stride == 0 assert

TensorFlow: improve accuracy on training data

爷,独闯天下 提交于 2019-12-24 10:12:39
问题 I am experimenting with TensorFlow. One of my first tries consists on learning one of the features based on the data. Let's say my data is composed on the following values: 35, 2, 3, 4, 19, 31, 7, 9, 34, 10, 33, 12, 59, 6, 14, 31, 13 ... 35, 4, 7, 14, 9, 3, 17, 19, 42, 11, 3, 1, 53, 12, 17, 30, 15 I would like to predict the value of the last feature, in the example it is going to be the values 13 for the first row and 15 for the last row. I have around 10000 rows of data. I've written the

Convert Matlab code into Python using Neural Network Library

巧了我就是萌 提交于 2019-12-24 09:26:03
问题 I am trying to convert this code of matlab in python... parpool X = power; T = coi; net = feedforwardnet(10); net = train(net,X,T,'useParallel','no','showResources','yes'); Y = net(X); figure; plot(X,T,'o',X,Y,'x'); Here is Target File attached i.e Coi Here is Input File attached i.e Power I tried a little bit but getting error like assertion error when training input_data = power # Power is my input array of length 45 output_data = coi # Coi is my output array of length 60000 h = np.max

Dealing with textual data for classification

倖福魔咒の 提交于 2019-12-24 08:19:10
问题 Assuming we have input data that consists of discrete values as well as a string of text, and the output should be a set of tags. To turn this into data that can be fed into a neural net, I'm having trouble figuring out how to deal with the textual input. Using only the textual input, I assume a RNN producing a thought vector, could work, I am however a bit uncertain how to feed the rest of the input data along. 回答1: If you are using RNN to handle the textual input, then the output of RNN can

How to get the value from each output-node during eval MNIST testdata in TensorFlow?

。_饼干妹妹 提交于 2019-12-24 07:07:12
问题 I train a convolutional neural network (CNN) with TensorFlow. When the training is finished I calculate the accuracy with the following code: ... correct = tf.equal(tf.argmax(prediction, 1), tf.argmax(y, 1)) accuracy = tf.reduce_mean(tf.cast(correct, tf.float32)) eval_batch_size = 1 good = 0 total = 0 for i in range(int(mnist.test.num_examples/eval_batch_size)): testSet = mnist.test.next_batch(eval_batch_size, shuffle=False) good += accuracy.eval(feed_dict={ x: testSet[0], y: testSet[1]})

Backpropagation and batch training

那年仲夏 提交于 2019-12-24 06:38:04
问题 Backpropagation calculates dW (weight delta) per weight per pattern, so it's straightforward how to modify weights when doing stochastic training. How do I use it for batch training, though? Simply accumluate dW over the entire training set and then apply the modfication, or is there more to it? 回答1: Yes, just accumluate dW over the entire training set. At least that is how I coded it back in grad school... 回答2: You can do a lot with the different gradients from the different samples. That

Tensorflow neural network prediction is always the same

陌路散爱 提交于 2019-12-24 05:56:41
问题 I have a deep CNN that predicts a label between "0" and "2" for every pixel in a 3d image. I have trained the model on an image where every pixel is labeled "1". Therefore, when testing the model, I believe every prediction should be "1". Instead the model only predicts "0". Here is the repository for the whole model: https://github.com/dhasl002/Research-DeepLearning. Since the code is almost 300 lines, I will include only the relevant code below. x = tf.placeholder(tf.float32, shape=[None,

Tensorflow - Averaging model weights from restored models

孤街浪徒 提交于 2019-12-24 04:19:13
问题 Given that I trained several different models on the same data and all the neural networks I trained have the same architecture I would like to know if it's possible to restore those models, average their weights and initialise my weights using the average. This is an example of how the graph might look. Basically what I need is an average of the weights I am going to load. import tensorflow as tf import numpy as np #init model1 weights weights = { 'w1': tf.Variable(), 'w2': tf.Variable() } #