[英]Why does one input have much more weight than another
I am using the simple getting started network in Pybrain. 我正在使用Pybrain中的简单入门网络。 I trained it with my data (about 200 data points).
我用我的数据(大约200个数据点)对其进行了训练。 This data is 2 inputs and one output.
该数据为2输入1输出。
I did a test where I kept one input the same and iterated over a range of conceivable values for the other input. 我做了一个测试,我将一个输入保持不变,并对另一个输入的一系列可能值进行迭代。 The output was the same throughout the possible values of the second input.
在第二个输入的所有可能值中,输出都是相同的。 I had to go 234.17 times higher than the highest possible value to get it to change.
我必须比可能的最高值高234.17倍才能更改它。
I also did a test where i kept the second input the same and only changed the first one. 我还做了一个测试,我将第二个输入保持不变,只更改了第一个输入。 The output only changed for the first 0.12% of the possible data values for the first input.
对于第一个输入,输出仅更改了可能数据值的前0.12%。
Do I simply need to train the network with more data, or do I need to do something different with the way the network is set up? 我只是需要用更多的数据训练网络,还是需要对网络的设置方式做一些不同的事情?
Edit: 编辑:
Here is the code that sets up the NN and returns the prediction for one value: 这是设置NN并返回一个值的预测的代码:
net = buildNetwork(2, 3, 1)
ds = SupervisedDataSet(2, 1)
for each in train_data:
ds.addSample((each[0], each[1]), (each[2],)) #adds training data to Data Set
print len(ds)
trainer = BackpropTrainer(net, ds) #sets up trainer
print trainer.trainUntilConvergence(maxEpochs=2000, verbose=True) #Trains
print net.activate([(1420884000%86400),51.74]) #print prediction
One input is the time of day (in seconds since midnight). 一个输入是一天中的时间(自午夜以来的秒数)。 The other input is current temperature.
另一个输入是当前温度。 The output should be the predicted temperature in an arbitrary time based on the training data.
输出应该是根据训练数据在任意时间内的预测温度。
I get better results with neural networks if the inputs are all scaled to be between 0 and 1, with the maximum possible value (or guaranteed largest value in that dataset) as 1 and the minimum as 0. 如果所有输入都缩放到0到1之间,并且可能的最大值(或该数据集中的保证最大值)为1,最小值为0,则使用神经网络可以获得更好的结果。
This is particularly a good idea when there are multiple inputs, as there usually are, so that it is not as difficult for the network to start with roughly equal weight given to the two different inputs. 当有多个输入(通常有多个输入)时,这是一个特别好的主意,因此对于网络来说,从赋予两个不同输入大致相等的权重开始并不困难。 The objectively smaller input might be more important for the system in question, and scaling both inputs to be between 0 and 1 makes this easier to achieve.
客观上来说,较小的输入对于所讨论的系统可能更为重要,将这两个输入缩放到0到1之间将使其更容易实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.