Skip to content

initial commit#1

Open
denkhan wants to merge 5 commits into
masterfrom
initial_stockPredicter
Open

initial commit#1
denkhan wants to merge 5 commits into
masterfrom
initial_stockPredicter

Conversation

@denkhan
Copy link
Copy Markdown

@denkhan denkhan commented Jun 6, 2020

No description provided.

Copy link
Copy Markdown
Member

@Lundez Lundez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wanted someone to chop your code to pieces, consider it done 🪓


def prepareData(stockData):
pd_data = pd.read_csv(stockData)
X = pd_data["Open"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about keep using pandas through the whole code...?

Comment thread python/createModels/createModels.py Outdated
return X, Y

if __name__ == "__main__":
baselineWithHistory("../generateStockData/data/EVO.ST_2020-01-01_2020-05-31.csv") No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty bad & dangerous pathing. Works for now though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y, only works if the other user has created that exact file together with the data folder. Any suggestions to make it pretty?

Comment thread python/createModels/helpFunctions.py Outdated
print("-----------------------------")

def createHistoryData(X, Y, days):
X = [[X[j] for j in range(i, i+days)] for i in range(0, len(X)-days)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ordo is not beautiful, you can do better ;)

@@ -0,0 +1,18 @@
def splitData(X, Y, amount):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use sklearn train_test_split
It's awesome :)

X, Y = hf.createHistoryData(X, Y, 10)
X_train, X_test, Y_train, Y_test = hf.splitData(X, Y, 0.75)
regr = LinearRegression()
regr.fit(X_train, Y_train)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this better by using sklearn tools to print the f1-score etc.


def generateData(stocks, start_date, end_date):
for stock in stocks:
panel_data = data.DataReader(stock, start=start_date, end=end_date, data_source='yahoo')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, didn't know pandas had this functionality!

if __name__ == "__main__":
start_date = "2019-01-01"
end_date = "2020-05-31"
generateData(["INVE-B.ST", "EVO.ST"], start_date, end_date) No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does those map too? I "enjoy" how you mix raw strings with named ones ;)

@@ -0,0 +1,30 @@
import pandas as pd
from sklearn.linear_model import LinearRegression
import helpFunctions as hf
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelCase? How about snake_case please

@@ -0,0 +1,30 @@
import pandas as pd
from sklearn.linear_model import LinearRegression
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should test more models! Take a look at my code (it's not good though, but it displays a little you might learn something from)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants