Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

vivekpadia70 vivekpadia70

🏠
Working from home
Block or report user

Report or block vivekpadia70

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View house_prediction.py
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k')
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Regionname"])
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.2)
plt.title("Lattitude to Longitude for Regionname")
View house_prediction.py
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k')
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Type"])
plt.title("Lattitude to Longitude for Type of room")
View house_prediction.py
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k')
sns.scatterplot(full_df["Longtitude"], full_df["Lattitude"], hue=full_df["Price"], size=full_df["Landsize"])
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.2)
plt.title("Lattitude to Longitude with Price and Landsize")
View house_prediction.py
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k')
sns.violinplot(full_df['Type'], full_df['Price'])
plt.title("Violin plot for Type to Price")
View house_prediction.py
plt.figure(figsize=(10,7), facecolor='w', edgecolor='k')
sns.violinplot(full_df['Regionname'], full_df['Price'])
plt.title("Violin plot for Regionname to Price")
plt.xticks(rotation=45)
View house_prediction.py
knr = KNeighborsRegressor(weights='distance', n_neighbors=200)
knr.fit(X_train, Y_train)
print("KNN Score: ", knr.score(X_train, Y_train))
print("KNN Test Score: ", knr.score(X_test, Y_test))
View house_prediction.py
params = {'n_estimators':[500, 1000, 1500, 2000], 'max_depth':[3, 5, 8]}
gbr = GradientBoostingRegressor()
gbr_grid = GridSearchCV(gbr, params, cv=5)
gbr_grid.fit(X_train, Y_train)
print("Grid Search Gradient Boosting Score: ", gbr_grid.score(X_train, Y_train))
print("Grid Search Gradient Boosting Test Score: ", gbr_grid.score(X_test, Y_test))
print("Grid Search Gradient Boosting Best Parameters: ", gbr_grid.best_params_)
View house_prediction.py
gbr = GradientBoostingRegressor(n_estimators=1000, max_depth=5, random_state=22)
gbr.fit(X_train, Y_train)
print("Gradient Boosting R^2 Score: ", gbr.score(X_train, Y_train))
print("Gradient Boosting Test R^2 Score: ", gbr.score(X_test, Y_test))
y_pred = gbr.predict(X_test)
print("Mean Squared Error: ", mean_squared_error(y_pred, Y_test))
print("Mean Absolute Error: ", mean_absolute_error(y_pred, Y_test))
print("Cross Validation Score: ", cross_val_score(gbr, X_test, Y_test, cv=5))
You can’t perform that action at this time.