吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 7193|回复: 21
收起左侧

[Python 转载] Python预测石油的未来价格的模型 (论文 + 源码)

  [复制链接]
WyattHuang 发表于 2018-9-19 23:20
本帖最后由 WyattHuang 于 2018-9-20 07:46 编辑

post on 20180919

FBI WARNING

此模型仅供参考 !!!

This model is for reference only !!




因为这个预测模型是我刚接触到机器学习的时候和同学sao做的,
所以论文和代码里面可能会有一些错误的观点,请谅解


此帖的意义只是给想大家分享一下
人工智能给我们生活带来的的便利


代码是用我大Python编写的





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://pan.baidu.com/s/1k2p28HysPTWXGrfzqZ-Krw
密码:og8k





源码
[Python] 纯文本查看 复制代码
'''
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],0)
learn_y=np.delete(learn_y,[0],0)

pre_y=np.delete(data_cur.values,['0',"1",'5','6'],axis=1)
pre_y=np.delete(pre_y,[0],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()

免费评分

参与人数 3吾爱币 +4 热心值 +4 收起 理由
陌尚 + 2 + 2 我很赞同!
浓痰咬不断 + 1 + 1 广州海湾石油前来贺电!
jiehu + 1 + 1 用心讨论,共获提升!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| WyattHuang 发表于 2018-9-20 00:14
本帖最后由 WyattHuang 于 2018-9-20 07:35 编辑
Right_Hai 发表于 2018-9-19 23:58
代码这么短就能当论文了?不是喷,不懂问的

有两个原因:

1. 一篇论文的关键是模型,而模型的核心思想是用算法解决问题,编程在建模中只能算是一个工具罢了。所以,并不能说代码少了,就不是论文了。

2. 因为时间和技术的限制(这个模型是我和同学刚学machine learning的时候做的),所以并没有考虑数据清理、过拟合以及使用其他算法模型... 的情况,如果把这些都考虑进去,代码应该就长了。
eyi59 发表于 2018-9-19 23:45
9527huang 发表于 2018-9-19 23:31
厉害了,楼主!  可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛

这个可以有,,这个想法不错哦
9527huang 发表于 2018-9-19 23:31
厉害了,楼主!  可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛
 楼主| WyattHuang 发表于 2018-9-19 23:35
9527huang 发表于 2018-9-19 23:31
厉害了,楼主!  可以预测一下单身狗的存活寿命嘛 可以预测一下单身狗的存活寿命嘛

以后试一下
Right_Hai 发表于 2018-9-19 23:58
代码这么短就能当论文了?不是喷,不懂问的
365milesroad 发表于 2018-9-20 00:30
明显工作量不够,中期答辩都过不了
wangqiustc 发表于 2018-9-20 01:12
操作很6 啊
值得学习
紫寒秋 发表于 2018-9-20 06:13
厉害了,谢谢哦!!
sdaza 发表于 2018-9-20 06:33 来自手机
有意思。。。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-17 08:47

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表