[英]Keras model predicting experience from hours
I am very new to Keras, neural networks and machine learning having just started to learn yesterday. 我对Keras,神经网络和机器学习非常陌生,昨天才开始学习。 I decided to try predicting the experience over an hour (0 to 23) (for a game and my own generated data-set) that a user would earn.
我决定尝试预测用户将获得的一个小时(0到23)(对于游戏和我自己生成的数据集)的体验。 Currently running what I have the predictions seem to be very low and very poor.
目前,我所预测的结果似乎很低而且很差。 I have tried a relu activation, which produced predictions all to be zero and from a bit of research, LeakyReLU.
我尝试了relu激活,通过一些研究LeakyReLU得出的预测全为零。
This is the code I have for the prediction model so far: 到目前为止,这是我用于预测模型的代码:
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LeakyReLU
import numpy
numpy.random.seed(7)
dataset = numpy.loadtxt("experience.csv", delimiter=",")
X = dataset[: ,0]
Y = dataset[: ,1]
model = Sequential()
model.add(Dense(12, input_dim = 1, activation=LeakyReLU(0.3)))
model.add(Dense(8, activation=LeakyReLU(0.3)))
model.add(Dense(1, activation=LeakyReLU(0.3)))
model.compile(loss = 'mean_absolute_error', optimizer='adam', metrics = ['accuracy'])
model.fit(X, Y, epochs=120, batch_size=10, verbose = 0)
predictions = model.predict(X)
rounded = [round(x[0]) for x in predictions]
print(rounded)
I have also tried playing around with the hidden levels of the network, but honestly have no idea how many there should be or a good way to justify an amount. 我也尝试过使用网络的隐藏层,但是老实说,我不知道应该有多少个或一个合理的方法来证明其合理性。
If it helps here is the data-set I have been using: 如果有帮助,这里是我一直在使用的数据集:
https://raw.githubusercontent.com/NightShadeII/xpPredictor/master/experience.csv https://raw.githubusercontent.com/NightShadeII/xpPredictor/master/experience.csv
Thankyou for any help 感谢您的任何帮助
Looking at your data it does not seem like a classification problem. 查看您的数据似乎不是分类问题。 You have two options:
您有两种选择:
-> Look at the second column and bucket them depending on the ranges and make classes that can be predicted, for instance: 0, 1, 2 etc. Now it tries to train but does not have enough examples for millions of classes that it thinks you are trying to predict. ->查看第二列,并根据范围对它们进行分类,并创建可以预测的类,例如:0、1、2等。现在它尝试进行训练,但没有足够的示例来说明它认为的数百万个类您正在尝试预测。
-> If you want real valued output and not classes, try using linear regression. ->如果要输出实值而不是类,请尝试使用线性回归。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.