From 6b968cb968547f6b28f1c0a3ded3504bae714199 Mon Sep 17 00:00:00 2001 From: ShivamGoyal49 <116254457+ShivamGoyal49@users.noreply.github.com> Date: Thu, 20 Oct 2022 12:21:15 +0530 Subject: [PATCH 1/2] Update Bike_Price_Prediction Added Ridge Regression --- Bike_Price_Prediction | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Bike_Price_Prediction b/Bike_Price_Prediction index 3e108f8..9f82ed9 100644 --- a/Bike_Price_Prediction +++ b/Bike_Price_Prediction @@ -98,3 +98,21 @@ y_pred = pipe.predict(X_test) print('R2 score',r2_score(y_test,y_pred)) print('MAE',mean_absolute_error(y_test,y_pred)) + +step1 = ColumnTransformer(transformers=[ + ('col_tnf',OneHotEncoder(sparse=False,drop='first'),[1,2,5]) +],remainder='passthrough') + +step2 = Ridge(alpha=10) + +pipe = Pipeline([ + ('step1',step1), + ('step2',step2) +]) + +pipe.fit(X_train,y_train) + +y_pred = pipe.predict(X_test) + +print('R2 score',r2_score(y_test,y_pred)) +print('MAE',mean_absolute_error(y_test,y_pred)) From b393bd7a3265ed3702264eefe275b9df6d8a21fe Mon Sep 17 00:00:00 2001 From: ShivamGoyal49 <116254457+ShivamGoyal49@users.noreply.github.com> Date: Thu, 20 Oct 2022 12:24:27 +0530 Subject: [PATCH 2/2] Update Laptop Price Prediction Added Ridge regression --- Laptop Price Prediction | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Laptop Price Prediction b/Laptop Price Prediction index b851058..1baa96c 100644 --- a/Laptop Price Prediction +++ b/Laptop Price Prediction @@ -66,6 +66,24 @@ plt.show() sns.barplot(x=df['TypeName'],y=df['Price']) plt.xticks(rotation='vertical') plt.show() + +step1 = ColumnTransformer(transformers=[ + ('col_tnf',OneHotEncoder(sparse=False,drop='first'),[0,1,7,10,11]) +],remainder='passthrough') + +step2 = Ridge(alpha=10) + +pipe = Pipeline([ + ('step1',step1), + ('step2',step2) +]) + +pipe.fit(X_train,y_train) + +y_pred = pipe.predict(X_test) + +print('R2 score',r2_score(y_test,y_pred)) +print('MAE',mean_absolute_error(y_test,y_pred)) # Workstation type laptops are most expensive # laptop price also depends upon on type of laptop