首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用机器学习预测金融符号(EURUSD)的收盘价?

如何使用机器学习预测金融符号(EURUSD)的收盘价?
EN

Stack Overflow用户
提问于 2016-12-22 05:09:50
回答 1查看 628关注 0票数 0

我使用EURUSD OHLC 1天数据做了一个简单的实验。

我的特点是公开价格,低价,高价,我试图预测未来的收盘价。

代码正常工作,正如预期的那样,但结果非常误导。

我得到了99%的准确率,我们都知道这是不可能的。

1)那么我做错了什么呢?

2)如何改正错误?

我正在建设的官方系统将有BoP,购买力平价,利率,国内生产总值,以及许多动量指标,等等,作为功能,超过60个功能。

代码语言:javascript
复制
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#import pickle

# 1. Read the EURUSD csv data.
# 2. Process the DataFrame, using only the Open, High, Low, Close columns.
df = pd.read_csv( 'EURUSD1440.csv', index_col= 'Date' )
df = df[['Open','High','Low','Close']]
array = df.values

# Features consist of Open, High, Low column, and stored in x.
# Label is the Close column stored in y.
x = array[:,0:3]
y = array[:,3]


# Split Data into Test and Train.
# 60% Train and 40% Test.
from sklearn.cross_validation import train_test_split
x_train, x_test, y_train, y_test = train_test_split( x, y, test_size = 0.4 )


# 1. Train the Model using .fit method.
# 2. Predict the future Closing prices using the .predict method.
# 3. Know how Accurate the Model is using the .score method.
from sklearn.linear_model import LinearRegression
from sklearn.metrics import accuracy_score

model = LinearRegression()
model.fit( x_train, y_train )
forecast = model.predict( x_test )
accuracy = model.score( x_test, y_test )

print( forecast, accuracy )
EN

回答 1

Stack Overflow用户

发布于 2018-07-11 00:25:50

user3666197对这一概念缺陷的讨论恰到好处。

经过广泛的研究,我要证明,利用机器学习的基本模型,即load > transform> fit > predict,使用sklearn或keras甚至tbot自动进行模型参数优化的唯一选择是结合一些未来预测/计算的“某种关系的数据”。

为了给你指明正确的方向,可以尝试以下几点:

  • 占星术数据,由美国宇航局地平线系统提供,太阳风和地磁数据由美国宇航局提供。

此外,更实际的做法是将工作重点放在功能工程和选择上,而不是模型选择上。

祝你好运。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41271947

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档