wzchen / stock_market_prediction Goto Github PK
View Code? Open in Web Editor NEWTeam Buffalox8 predicts directional movement of stock prices.
Home Page: https://sites.google.com/site/predictingstockmovement
Team Buffalox8 predicts directional movement of stock prices.
Home Page: https://sites.google.com/site/predictingstockmovement
Hi, I try your scripts and get 50% AUC. If I try it with reversed dataframe,it will works as expected as your results. Did I do something false in my codes?
import pandas as pd
import numpy as np
from Score import auc
from sklearn.ensemble import RandomForestClassifier,AdaBoostClassifier,VotingClassifier
from sklearn.metrics import accuracy_score,classification_report
def MakeDataframe(csv,reverse):
df = pd.read_csv(csv)
if reverse:
df = df[::-1]
df = df[['open','close']]
#print df.head(12)
return df.values
def Window(dataset):
dataX,dataY = [],[]
for i in range(len(dataset) - 9):
item = dataset[i:(i+10),0:2]
item = item.ravel()
if item[19] >= item[18]:
target = 1
else:
target = 0
dataY.append(target)
item = item[:19]
item = item / item[0]
dataX.append(item)
return np.array(dataX), np.array(dataY)
reverse = True
train = MakeDataframe('./CSV/EURUSD-2016-10-1W_1M.csv',reverse)
test = MakeDataframe('./CSV/EURUSD-2016-10-2W_1M.csv',reverse)
X,Y = Window(train)
X_test,Y_test = Window(test)
Y = Y.astype('int')
Y_test = Y_test.astype('int')
model = RandomForestClassifier(n_jobs=-1,n_estimators=100,oob_score=True,verbose=False)
#model2 = AdaBoostClassifier()
#model = VotingClassifier([('RF',model1),('Ada',model2)],n_jobs=-1,voting='soft')
model.fit(X,Y)
Y_pred = model.predict_proba(X_test)[:,1]
predicted = model.predict(X_test)
score = accuracy_score(Y_test,predicted)
report = classification_report(Y_test,predicted)
print score
print auc(Y_test,Y_pred)
print report
print model.oob_score_
I also attach two CSV files I used in the script.
Thank you so much and best regards
IndexError: too many indices for array
@wzchen how are these calculated (i thought it was the past 9 days and calculating for the 10th) however i have just been informed that it's 25 time segments, how are you calculating and what sort of data?
thanks
Hi, We're graduate student from Dalian University of Technology. we are doing a research project relate to stock prediction, and incorporate your method described in this github project. But we met some issues, which described as below.
So, could you give me any suggestions about my issues? we are waiting for your response.
My email is: [email protected]
Wechat account is: gkdlll
Thanks and best regards for you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.