Python预测石油的未来价格的模型 (论文 + 源码)
本帖最后由 WyattHuang 于 2018-9-20 07:46 编辑post on 20180919
FBI WARNING
此模型仅供参考 !!!
This model is for reference only !!
https://static.52pojie.cn/static/image/hrline/line3.png
因为这个预测模型是我刚接触到机器学习的时候和同学sao做的,所以论文和代码里面可能会有一些错误的观点,请谅解{:1_890:}
此帖的意义只是给想大家分享一下人工智能给我们生活带来的的便利
代码是用我大Python编写的
https://static.52pojie.cn/static/image/hrline/line3.png
Abstract:
To predict the future gasoline price to help the consumer select the amount of
the oil he should purchase in advance, accroding to our analysis, we decide to
use python with Sk-learn base to write a program. This program is able to
"learn" the law through a large amount of inf ormation, then use the same law to
inf er and predict the details of those probable changes in the f uture. Theref ore,
we just provide various historical databef ore 2012 about the gasoline price f rom
the wabsites to the program. Af ter we run the code 9 times by respctively using
9 kinds of f unctions that is used to predict this type of data which is
continuious and compare those figures which are tested and can only be seen
by us with the ture figure of oil price, we finally get the most eff ective f unction-
-"SVM", which off ers the figure that has the highest similarity. Then, it becomes
the core algorithm of our model. Finally, the consumer can make decisions with
the help of our figure which is the simplified version of tested figures easily, no
matter how long the consumer is going to drive per week.
Keywords: Gasoline; Price; Prediction; Sk-learn; Historical data;
https://static.52pojie.cn/static/image/hrline/line3.png
论文 + 数据 下载链接:https://pan.baidu.com/s/1k2p28HysPTWXGrfzqZ-Krw密码:og8k
https://static.52pojie.cn/static/image/hrline/line3.png
源码'''
You'd better execute this code in Linux!
'''
from __future__ import print_function
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys
sys.setrecursionlimit(99999)
import time
'''
同学的骚操作
'''
from progressbar import *
total = 1000
def dosomework():
time.sleep(0.01)
progress = ProgressBar()
for i in progress(range(1000)):
dosomework()
'''
载入数据
'''
data_his=pd.read_excel("bin\history.xlsx")#历史
data_his.fillna(value=-99999,inplace=True)
data_cur=pd.read_excel("current.xlsx")#当前
data_cur.fillna(value=-99999,inplace=True)
'''
拆分数据
'''
learn_x=np.delete(data_his.values,['0','1','5','6',],axis=1)
learn_y=np.delete(data_his.values,['0','2','3','4','5','6'],axis=1)
learn_x=np.delete(learn_x,,0)
learn_y=np.delete(learn_y,,0)
pre_y=np.delete(data_cur.values,['0',"1",'5','6'],axis=1)
pre_y=np.delete(pre_y,,0)
'''
载入学习模型
'''
from sklearn import svm
model_SVR = svm.SVR()
'''
学习历史数据
'''
model_SVR.fit(learn_x,learn_y)
'''
预测数据
'''
result=model_SVR.predict(pre_y)
'''
输出结果及绘图
'''
print(result)
plt.figure()
plt.title('Predict Value: '+str(result))
plt.plot(np.arange(len(result)),result,'ro-',label='predict value')
plt.legend()
plt.show() 本帖最后由 WyattHuang 于 2018-9-20 07:35 编辑
Right_Hai 发表于 2018-9-19 23:58
代码这么短就能当论文了?不是喷,不懂问的
有两个原因:
1. 一篇论文的关键是模型,而模型的核心思想是用算法解决问题,编程在建模中只能算是一个工具罢了。所以,并不能说代码少了,就不是论文了。
2. 因为时间和技术的限制(这个模型是我和同学刚学machine learning的时候做的),所以并没有考虑数据清理、过拟合以及使用其他算法模型... 的情况,如果把这些都考虑进去,代码应该就长了。 9527huang 发表于 2018-9-19 23:31
厉害了,楼主!可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛
这个可以有,,这个想法不错哦 厉害了,楼主!可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛 9527huang 发表于 2018-9-19 23:31
厉害了,楼主!可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛
以后试一下:lol 代码这么短就能当论文了?不是喷,不懂问的
明显工作量不够,中期答辩都过不了 操作很6 啊
值得学习 厉害了,谢谢哦!! 有意思。。。