diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index f93420f..3098a77 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..9eff919 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..bf47b2a 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..83a6de2 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,10 @@ # 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..d1edcd3 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..f09f9ef 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..b695140 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..77b5193 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..a6ed6fb 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,10 @@ # Your Code Here +def data_splitter(df): + + X = df.iloc[:,:-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..3ac08fc 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..36fb892 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..8c527bd 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..5e93c04 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..49f3267 100644 --- a/q03_linear_regression/build.py +++ b/q03_linear_regression/build.py @@ -1,5 +1,7 @@ +# %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 import linear_model from sklearn.linear_model import LinearRegression dataframe = load_data('data/house_prices_multivariate.csv') @@ -7,4 +9,12 @@ # Write your code here : +def linear_regression(X,y): + + lm = linear_model.LinearRegression() + lm.fit(X,y) + + return lm + + diff --git a/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc b/q03_linear_regression/tests/__pycache__/__init__.cpython-36.pyc index 739e010..fd24ec6 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..acafa71 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..dbcec4e 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..4ce3137 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..5315887 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,9 @@ # Your code here +def linear_predictor(lm,X,y): + y_pred = lm.predict(X) + + return y_pred,mean_squared_error(y_pred,y),mean_absolute_error(y_pred,y),r2_score(y,y_pred) + + diff --git a/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc b/q04_linear_predictor/tests/__pycache__/__init__.cpython-36.pyc index 8abd4d2..4a697e5 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..8e4f5ab 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..681def2 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..5361001 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..b275bde 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,9 @@ # Your code here +def residuals(y,y_pred): + + return y-y_pred + + + diff --git a/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q05_residuals/tests/__pycache__/__init__.cpython-36.pyc index 95e65cc..572b596 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..c027b49 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..2471daf 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..146dd81 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..3540fc8 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,8 @@ # Your code here +def plot_residuals(y,error_residuals): + plt.scatter(y,error_residuals) + + diff --git a/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc b/q06_plot_residuals/tests/__pycache__/__init__.cpython-36.pyc index 3ce3f60..d82cc2a 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..cfe99a0 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..57df9d2 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..d2dd2ce 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..6b9ef01 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,7 @@ 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..cd44016 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..f41e1a2 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..97d8b64 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..e2ae8ff 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..8e82fbf 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,plot=plt) + plt.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..bbbd062 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..ffd7384 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