Skip to content

Commit

Permalink
Merge pull request eriklindernoren#43 from miku/fix-deprecated-as-matrix
Browse files Browse the repository at this point in the history
df.as_matrix has been deprecated since 0.23.0
  • Loading branch information
eriklindernoren authored Aug 30, 2018
2 parents d8d8660 + 68182ad commit f278751
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mlfromscratch/examples/bayesian_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = np.atleast_2d(data["temp"].as_matrix()).T
time = np.atleast_2d(data["time"].values).T
temp = np.atleast_2d(data["temp"].values).T

X = time # fraction of the year [0, 1]
y = temp
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/decision_tree_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = np.atleast_2d(data["temp"].as_matrix()).T
time = np.atleast_2d(data["time"].values).T
temp = np.atleast_2d(data["temp"].values).T

X = standardize(time) # Time. Fraction of the year [0, 1]
y = temp[:, 0] # Temperature. Reduce to one-dim
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/elastic_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = data["temp"].as_matrix()
time = np.atleast_2d(data["time"].values).T
temp = data["temp"].values

X = time # fraction of the year [0, 1]
y = temp
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/gradient_boosting_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = np.atleast_2d(data["temp"].as_matrix()).T
time = np.atleast_2d(data["time"].values).T
temp = np.atleast_2d(data["temp"].values).T

X = time.reshape((-1, 1)) # Time. Fraction of the year [0, 1]
X = np.insert(X, 0, values=1, axis=1) # Insert bias term
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/lasso_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = data["temp"].as_matrix()
time = np.atleast_2d(data["time"].values).T
temp = data["temp"].values

X = time # fraction of the year [0, 1]
y = temp
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/polynomial_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = data["temp"].as_matrix()
time = np.atleast_2d(data["time"].values).T
temp = data["temp"].values

X = time # fraction of the year [0, 1]
y = temp
Expand Down
4 changes: 2 additions & 2 deletions mlfromscratch/examples/ridge_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def main():
# Load temperature data
data = pd.read_csv('mlfromscratch/data/TempLinkoping2016.txt', sep="\t")

time = np.atleast_2d(data["time"].as_matrix()).T
temp = data["temp"].as_matrix()
time = np.atleast_2d(data["time"].values).T
temp = data["temp"].values

X = time # fraction of the year [0, 1]
y = temp
Expand Down

0 comments on commit f278751

Please sign in to comment.