after three calculations, found that the results of the calculation is not small, so that the prediction algorithm is not perfect, and now do not know how to use other methods to predict, so can only calculate the average error of each prediction, in the time of prediction with this error mean, look at the effect ( PS : Today 4 Month Ten Day forecast out of 1 the ball is actually 0 ···· That's why we're trying to fix it with an average error).
Modified by Python The code is as follows:
#查询误差数据cursor. Execute (' select * from Tb_error ') errors = Cursor.fetchall () red1error = 0red2error = 0red3error = 0red4error = 0red5error = 0red6error = 0blueError = 0# accumulate each ball error for I in errors: print I[2:9] red1error = red1error + i[2]
red2error = Red2error + i[3] red3error = red3error + i[4] red4error = red4error + i[5] red5error = Red5error + i[6] red6error = red6error + i[7] blueerror = blueerror + i[8] #调用预测算法, then add the error mean of the corresponding ball pred1=int (prdct.prediction (red1)) + Red1error/len (Errors) Pred2=int (Prdct.prediction (RED2)) + Red2error/len (Errors) Pred3=int (Prdct.prediction (RED3)) + Red3error/len (Errors) Pred4=int (Prdct.prediction (red4)) + Red4error/len (Errors) Pred5=int (Prdct.prediction (Red5)) + Red5error/len (Errors) Pred6=int (Prdct.prediction (RED6)) + Red6error/len (Errors) pblue=int (Prdct.prediction (blue)) + Blueerror/len (Errors)
The method of correcting the predicted result by using the error mean of two times is not good (probably less than the number of trials), and the number of two predictions is reduced to 1 , it is considered whether the error mean correction is reasonable, whether the algorithm predicted the results and the error mean on the use of weighting to calculate.
problem found: TakePred2=int (Prdct.prediction (RED2)) +red2error/len (Errors), today's Testprdct.prediction (RED2)The result is2.0, turn it intointtype is alsoInt (prdct.prediction (red2))and then the result turns out to be1, and tested a few of the problems that had arisen, turned intointthe type is small after1, don't know why. Simply press float to save it. The process of discovering this error was that I accidentally printed the predicted numbers separately from the error averages and found that they turned intointless after the type1, which is then positioned to reduce the number when the floating-point number predicted by the algorithm is converted to an integer.1. But the strange thing is, pred1 It's not a problem, maybe because this time prdct.prediction (red1) itself is equal to 1.0 .
An attempt to predict color ball--correction