diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index f93420f..4d7fa1c 100644 Binary files a/__pycache__/__init__.cpython-36.pyc and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/__pycache__/__init__.cpython-36.pyc b/q01_load_data/__pycache__/__init__.cpython-36.pyc index 29d3927..d2b4b59 100644 Binary files a/q01_load_data/__pycache__/__init__.cpython-36.pyc and b/q01_load_data/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/__pycache__/build.cpython-36.pyc b/q01_load_data/__pycache__/build.cpython-36.pyc index ef1e203..054dd3f 100644 Binary files a/q01_load_data/__pycache__/build.cpython-36.pyc and b/q01_load_data/__pycache__/build.cpython-36.pyc differ diff --git a/q01_load_data/build.py b/q01_load_data/build.py index 1fea6ca..b073fdc 100644 --- a/q01_load_data/build.py +++ b/q01_load_data/build.py @@ -1,3 +1,4 @@ +# %load q01_load_data/build.py # Default imports import pandas as pd @@ -5,4 +6,9 @@ # Write your code here : +def load_data(path): + df = pd.read_csv(path) + return df + + diff --git a/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc b/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc index b882452..2af89d6 100644 Binary files a/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc and b/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/tests/__pycache__/test_q01_load_data.cpython-36.pyc b/q01_load_data/tests/__pycache__/test_q01_load_data.cpython-36.pyc index 736de76..5cc1769 100644 Binary files a/q01_load_data/tests/__pycache__/test_q01_load_data.cpython-36.pyc and b/q01_load_data/tests/__pycache__/test_q01_load_data.cpython-36.pyc differ diff --git a/q02_data_splitter/__pycache__/__init__.cpython-36.pyc b/q02_data_splitter/__pycache__/__init__.cpython-36.pyc index 67f0b61..a0a5c1a 100644 Binary files a/q02_data_splitter/__pycache__/__init__.cpython-36.pyc and b/q02_data_splitter/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_data_splitter/__pycache__/build.cpython-36.pyc b/q02_data_splitter/__pycache__/build.cpython-36.pyc index 412515b..8be4673 100644 Binary files a/q02_data_splitter/__pycache__/build.cpython-36.pyc and b/q02_data_splitter/__pycache__/build.cpython-36.pyc differ diff --git a/q02_data_splitter/build.py b/q02_data_splitter/build.py index cf517fe..3f0ceb5 100644 --- a/q02_data_splitter/build.py +++ b/q02_data_splitter/build.py @@ -1,3 +1,4 @@ +# %load q02_data_splitter/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data import pandas as pd @@ -5,4 +6,11 @@ # Your Code Here +def data_splitter(df): + X = df.drop(['SalePrice'],1) + y = df['SalePrice'] + return X,y + + + diff --git a/q02_data_splitter/tests/__pycache__/__init__.cpython-36.pyc b/q02_data_splitter/tests/__pycache__/__init__.cpython-36.pyc index e7e9527..e4dca23 100644 Binary files a/q02_data_splitter/tests/__pycache__/__init__.cpython-36.pyc and b/q02_data_splitter/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_data_splitter/tests/__pycache__/test_q02_data_splitter.cpython-36.pyc b/q02_data_splitter/tests/__pycache__/test_q02_data_splitter.cpython-36.pyc index db949a7..2493ce7 100644 Binary files a/q02_data_splitter/tests/__pycache__/test_q02_data_splitter.cpython-36.pyc and b/q02_data_splitter/tests/__pycache__/test_q02_data_splitter.cpython-36.pyc differ diff --git a/q03_linear_regression/__pycache__/__init__.cpython-36.pyc b/q03_linear_regression/__pycache__/__init__.cpython-36.pyc index b8f4cc0..fd0abe6 100644 Binary files a/q03_linear_regression/__pycache__/__init__.cpython-36.pyc and b/q03_linear_regression/__pycache__/__init__.cpython-36.pyc differ diff --git a/q03_linear_regression/__pycache__/build.cpython-36.pyc b/q03_linear_regression/__pycache__/build.cpython-36.pyc index d3a347e..4d98af9 100644 Binary files a/q03_linear_regression/__pycache__/build.cpython-36.pyc and b/q03_linear_regression/__pycache__/build.cpython-36.pyc differ diff --git a/q03_linear_regression/build.py b/q03_linear_regression/build.py index 03ab5ff..878bb7f 100644 --- a/q03_linear_regression/build.py +++ b/q03_linear_regression/build.py @@ -1,3 +1,4 @@ +# %load q03_linear_regression/build.py from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter from sklearn.linear_model import LinearRegression @@ -6,5 +7,15 @@ X, y = data_splitter(dataframe) # Write your code here : +def linear_regression(X,y): + lin_reg = LinearRegression() + lin_reg.fit(X,y) + return lin_reg + + + + + + diff --git a/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc b/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc index 739e010..cefae03 100644 Binary files a/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc and b/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q03_linear_regression/tests/__pycache__/test_q03_linear_regression.cpython-36.pyc b/q03_linear_regression/tests/__pycache__/test_q03_linear_regression.cpython-36.pyc index fe5fba5..e01747f 100644 Binary files a/q03_linear_regression/tests/__pycache__/test_q03_linear_regression.cpython-36.pyc and b/q03_linear_regression/tests/__pycache__/test_q03_linear_regression.cpython-36.pyc differ diff --git a/q04_linear_predictor/__pycache__/__init__.cpython-36.pyc b/q04_linear_predictor/__pycache__/__init__.cpython-36.pyc index 3c623bd..c9fa823 100644 Binary files a/q04_linear_predictor/__pycache__/__init__.cpython-36.pyc and b/q04_linear_predictor/__pycache__/__init__.cpython-36.pyc differ diff --git a/q04_linear_predictor/__pycache__/build.cpython-36.pyc b/q04_linear_predictor/__pycache__/build.cpython-36.pyc index 2e68f8e..c0c3855 100644 Binary files a/q04_linear_predictor/__pycache__/build.cpython-36.pyc and b/q04_linear_predictor/__pycache__/build.cpython-36.pyc differ diff --git a/q04_linear_predictor/build.py b/q04_linear_predictor/build.py index e3c8357..9106b67 100644 --- a/q04_linear_predictor/build.py +++ b/q04_linear_predictor/build.py @@ -1,3 +1,4 @@ +# %load q04_linear_predictor/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter @@ -12,3 +13,13 @@ # Your code here +def linear_predictor(lm,X,y): + y_pred = lm.predict(X) + mse = mean_squared_error(y,y_pred) + mae = mean_absolute_error(y,y_pred) + r2 = r2_score(y,y_pred) + return y_pred,mse,mae,r2 + + + + diff --git a/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc b/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc index 8abd4d2..3b21834 100644 Binary files a/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc and b/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q04_linear_predictor/tests/__pycache__/test_q04_linear_predictor.cpython-36.pyc b/q04_linear_predictor/tests/__pycache__/test_q04_linear_predictor.cpython-36.pyc index 7b2e751..21e40fa 100644 Binary files a/q04_linear_predictor/tests/__pycache__/test_q04_linear_predictor.cpython-36.pyc and b/q04_linear_predictor/tests/__pycache__/test_q04_linear_predictor.cpython-36.pyc differ diff --git a/q05_residuals/__pycache__/__init__.cpython-36.pyc b/q05_residuals/__pycache__/__init__.cpython-36.pyc index 82a3d44..0a2a046 100644 Binary files a/q05_residuals/__pycache__/__init__.cpython-36.pyc and b/q05_residuals/__pycache__/__init__.cpython-36.pyc differ diff --git a/q05_residuals/__pycache__/build.cpython-36.pyc b/q05_residuals/__pycache__/build.cpython-36.pyc index 73e9d89..18858a6 100644 Binary files a/q05_residuals/__pycache__/build.cpython-36.pyc and b/q05_residuals/__pycache__/build.cpython-36.pyc differ diff --git a/q05_residuals/build.py b/q05_residuals/build.py index aaef679..64f93bc 100644 --- a/q05_residuals/build.py +++ b/q05_residuals/build.py @@ -1,3 +1,4 @@ +# %load q05_residuals/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter @@ -12,3 +13,14 @@ # Your code here +def residuals(y,y_pred): + error_residuals = y-y_pred + return error_residuals + + + + + + + + diff --git a/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc index 95e65cc..7a620a4 100644 Binary files a/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc and b/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q05_residuals/tests/__pycache__/test_q05_residuals.cpython-36.pyc b/q05_residuals/tests/__pycache__/test_q05_residuals.cpython-36.pyc index 4263cb0..675d04c 100644 Binary files a/q05_residuals/tests/__pycache__/test_q05_residuals.cpython-36.pyc and b/q05_residuals/tests/__pycache__/test_q05_residuals.cpython-36.pyc differ diff --git a/q06_plot_residuals/__pycache__/__init__.cpython-36.pyc b/q06_plot_residuals/__pycache__/__init__.cpython-36.pyc index cbab384..6d1f6ff 100644 Binary files a/q06_plot_residuals/__pycache__/__init__.cpython-36.pyc and b/q06_plot_residuals/__pycache__/__init__.cpython-36.pyc differ diff --git a/q06_plot_residuals/__pycache__/build.cpython-36.pyc b/q06_plot_residuals/__pycache__/build.cpython-36.pyc index 67ae5f6..b08f760 100644 Binary files a/q06_plot_residuals/__pycache__/build.cpython-36.pyc and b/q06_plot_residuals/__pycache__/build.cpython-36.pyc differ diff --git a/q06_plot_residuals/build.py b/q06_plot_residuals/build.py index cfd3722..57b5c6e 100644 --- a/q06_plot_residuals/build.py +++ b/q06_plot_residuals/build.py @@ -1,3 +1,4 @@ +# %load q06_plot_residuals/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter @@ -16,4 +17,10 @@ # Your code here +def plot_residuals(y,error_residuals): + plt.scatter(y,error_residuals) + plt.show() + + + diff --git a/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc index 3ce3f60..eb4bf92 100644 Binary files a/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc and b/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q06_plot_residuals/tests/__pycache__/test_q06_plot_residuals.cpython-36.pyc b/q06_plot_residuals/tests/__pycache__/test_q06_plot_residuals.cpython-36.pyc index 5f787c4..2ea63ff 100644 Binary files a/q06_plot_residuals/tests/__pycache__/test_q06_plot_residuals.cpython-36.pyc and b/q06_plot_residuals/tests/__pycache__/test_q06_plot_residuals.cpython-36.pyc differ diff --git a/q07_hist_residuals/__pycache__/__init__.cpython-36.pyc b/q07_hist_residuals/__pycache__/__init__.cpython-36.pyc index 4823574..3c6bed8 100644 Binary files a/q07_hist_residuals/__pycache__/__init__.cpython-36.pyc and b/q07_hist_residuals/__pycache__/__init__.cpython-36.pyc differ diff --git a/q07_hist_residuals/__pycache__/build.cpython-36.pyc b/q07_hist_residuals/__pycache__/build.cpython-36.pyc index e030b2b..4861b67 100644 Binary files a/q07_hist_residuals/__pycache__/build.cpython-36.pyc and b/q07_hist_residuals/__pycache__/build.cpython-36.pyc differ diff --git a/q07_hist_residuals/build.py b/q07_hist_residuals/build.py index 2f999aa..9fead09 100644 --- a/q07_hist_residuals/build.py +++ b/q07_hist_residuals/build.py @@ -1,3 +1,4 @@ +# %load q07_hist_residuals/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter @@ -19,3 +20,6 @@ def hist_residuals(error_residuals, bins=60): plt.figure(figsize=(15,8)) plt.hist(error_residuals, bins=bins) + + + diff --git a/q07_hist_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q07_hist_residuals/tests/__pycache__/__init__.cpython-36.pyc index f7acf95..144da01 100644 Binary files a/q07_hist_residuals/tests/__pycache__/__init__.cpython-36.pyc and b/q07_hist_residuals/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q07_hist_residuals/tests/__pycache__/test_q07_hist_residuals.cpython-36.pyc b/q07_hist_residuals/tests/__pycache__/test_q07_hist_residuals.cpython-36.pyc index 3919c93..b0bb5f7 100644 Binary files a/q07_hist_residuals/tests/__pycache__/test_q07_hist_residuals.cpython-36.pyc and b/q07_hist_residuals/tests/__pycache__/test_q07_hist_residuals.cpython-36.pyc differ diff --git a/q08_qq_residuals/__pycache__/__init__.cpython-36.pyc b/q08_qq_residuals/__pycache__/__init__.cpython-36.pyc index 8069022..33cf2b4 100644 Binary files a/q08_qq_residuals/__pycache__/__init__.cpython-36.pyc and b/q08_qq_residuals/__pycache__/__init__.cpython-36.pyc differ diff --git a/q08_qq_residuals/__pycache__/build.cpython-36.pyc b/q08_qq_residuals/__pycache__/build.cpython-36.pyc index d42be94..764b476 100644 Binary files a/q08_qq_residuals/__pycache__/build.cpython-36.pyc and b/q08_qq_residuals/__pycache__/build.cpython-36.pyc differ diff --git a/q08_qq_residuals/build.py b/q08_qq_residuals/build.py index bb05f08..0e2b05b 100644 --- a/q08_qq_residuals/build.py +++ b/q08_qq_residuals/build.py @@ -1,3 +1,4 @@ +# %load q08_qq_residuals/build.py # Default Imports from greyatomlib.linear_regression.q01_load_data.build import load_data from greyatomlib.linear_regression.q02_data_splitter.build import data_splitter @@ -20,3 +21,8 @@ # Your code here +def qq_residuals(error_residuals): + stats.probplot(error_residuals, dist='norm', plot=pylab) + pylab.show() + + diff --git a/q08_qq_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q08_qq_residuals/tests/__pycache__/__init__.cpython-36.pyc index 320d34e..2a1753c 100644 Binary files a/q08_qq_residuals/tests/__pycache__/__init__.cpython-36.pyc and b/q08_qq_residuals/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q08_qq_residuals/tests/__pycache__/test_q08_qq_residuals.cpython-36.pyc b/q08_qq_residuals/tests/__pycache__/test_q08_qq_residuals.cpython-36.pyc index bc94040..1b1d9b9 100644 Binary files a/q08_qq_residuals/tests/__pycache__/test_q08_qq_residuals.cpython-36.pyc and b/q08_qq_residuals/tests/__pycache__/test_q08_qq_residuals.cpython-36.pyc differ