Skip to content

Commit

Permalink
Update Stock.py
Browse files Browse the repository at this point in the history
Deals with the depreciation of the cross-validation library and deals with the introduction of train_test_split library.
  • Loading branch information
shawnpaul123 authored Oct 11, 2018
1 parent 3578193 commit cbc2c0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions demo/machine-learning/stock-prediction/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import datetime

from sklearn.linear_model import LinearRegression
from sklearn import preprocessing, cross_validation, svm
from sklearn import preprocessing, svm
#replacement for cross validation
from sklearn.model_selection import train_test_split


df = quandl.get("WIKI/AMZN")

Expand All @@ -22,8 +25,8 @@

y = np.array(df['Prediction'])
y = y[:-forecast_out]

X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size = 0.2)
# below sentencce has been modified for train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)

clf = LinearRegression()
clf.fit(X_train,y_train)
Expand Down

0 comments on commit cbc2c0c

Please sign in to comment.