问题描述
我对这个话题很陌生,所以我不确定从哪里开始。我有大量的训练数据,基本上只是一系列的相框,每个相框对应一个数字。序列本身就像是一个视频,只会一点一点地变化,这也反映在相应的数字中,这些数字从不发生任何“大跃进”,并且仅根据各种因素(例如,像素改变或进入屏幕的像素再次退出。
我已经尝试过使用keras进行设置的方法,但是很多术语和语法对我来说还是陌生的,这就是为什么我不确定在哪里可以找到可以用于特定问题的示例的原因
解决方法
尝试改用tensorflow:
#We start by importing everything that we will need
import tensorflow #This will train our model
import pandas #Pandas is to read the data
import keras
import numpy #Numpy will build the matrices
import sklearn #sklearn is to choose the model that we will be using
from sklearn import linear_model
from sklearn.utils import shuffle
import matplotlib.pyplot as pyplot
import pickle #pickle is used to save the model
from matplotlib import style
data = pandas.readcsv("path to the data",sep = ';') #You need to change the sep = ';'
#if your data is not separated with a ';'
data = data["Whatever","Label","you want","to include"]
predict = ["Label you want to predict"]
x = numpy.array(data.drop([predict],1))
y = numpy.array(data[predict])
x_train,x_test,y_train,y_test = sklearn.model_selection.train_test_split(x,y,test_size=0.3)
linear = linear_model.LinearRegression()
linear.fit(x_train,y_train)
acc = linear.score(x_test,y_test)
print(acc)
predictions = linear.predict[x_test]
for x in range(len(predictions)):
print("Prediction:",predictions[x],"reality:",y_test[x]