0% found this document useful (0 votes)
39 views15 pages

Machine Learning Presentaion

Uploaded by

vajojo8727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views15 pages

Machine Learning Presentaion

Uploaded by

vajojo8727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

House Price Prediction

Using Machine Learning


Models
Group Members

01 02 03
Nuzhat Tanzina Prova Faysal Mahmud Syed Foysal
Student ID: 20-43869-2 Student ID: 20-43800-2 Student ID: 20-42505-1
Objective
Utilizing linear regression, create an accurate predictive model to
estimate house prices with specific input features. This innovative tool
transforms property assessment for real estate professionals, buyers,
and sellers, ensuring reliability, data-driven insights, and well-informed
decisions. Enhanced real estate analytics empowers professionals,
buyers, and sellers, amplifying transaction transparency and satisfaction.
Classification Algorithms:
There are several machine learning algorithms that we have used to predict house price:

• Neural network
Neural networks, inspired by the human brain, use layered nodes to process data. For house price
prediction, they analyze inputs like location and size. These models grasp complex data patterns,
capturing nuances that simpler methods overlook. By iteratively adjusting parameters, neural
networks reduce prediction errors, but demand ample data and computational resources.

• Linear regression
Linear regression is a fundamental algorithm for predicting numerical outcomes, like house prices,
based on a linear relationship between input features and the target variable. It assumes a straight-
line relationship between variables. In house price prediction, linear regression analyzes how
changes in input features impact the price.
Classification Algorithms:
• Decision tree
Decision trees are tree-like structures that make sequential decisions to arrive at a prediction. In house
price prediction, a decision tree starts with a root node, where the most influential feature is chosen to
split the data. Each subsequent node further splits the data until terminal nodes (leaves) with predicted
outcomes are reached. Decision trees can handle nonlinear relationships and interactions effectively.
However, they are prone to overfitting, where they memorize the training data and struggle to generalize
to new data.

• Random forest model


Random Forest, an ensemble method, improves predictions and reduces overfitting by combining
decision trees. For house price prediction, it builds multiple trees on diverse data subsets and averages
their predictions. This method mitigates individual tree weaknesses, enhancing robustness by analyzing
various features and curbing overfitting.
Data Normalization
Normalizing the data to bring all the different features to a similar range to make it
easier for optimization algorithms to find minimal.

#Normalizing the data to bring all the different features to a similar range
#to make it easier for optimization algorithms to find minimas.
df = df.iloc[:,1:]
df_norm = (df - df.mean()) / df.std()
df_norm.head()
Neural Network Model
#Creating the Neural Network Model

def get_model():
model = Sequential([
Dense(10, input_shape = (6,), activation = 'relu'), #10 neurons, Input Layer
Dense(20, activation = 'relu'), #20 neurons, Hidden Layer
Dense(5, activation = 'relu'), #5 neurons, Hidden Layer
Dense(1) #Output Layer
]) #'relu' activation
model.compile(
loss='mse', #Trained using Mean square error loss (Cost function)
optimizer='adam' #Optimizer used is 'adam' (One of the Fastest optimizers)
)
return model
model = get_model()
model.summary()
Multiple Linear Regression Model

from sklearn.linear_model import LinearRegression


from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import explained_variance_score
from sklearn.metrics import confusion_matrix
mlr = LinearRegression()
mlr.fit(X_train,y_train)
mlr_score = mlr.score(X_test,y_test)
pred_mlr = mlr.predict(X_test)
expl_mlr = explained_variance_score(pred_mlr,y_test)
Decision Tree Model
tr_regressor = DecisionTreeRegressor(random_state=0)
tr_regressor.fit(X_train,y_train)
tr_regressor.score(X_test,y_test)
pred_tr = tr_regressor.predict(X_test)
decision_score=tr_regressor.score(X_test,y_test)
expl_tr = explained_variance_score(pred_tr,y_test)
Random Forest Regression Model

rf_regressor = RandomForestRegressor(n_estimators=28,random_state=0)
rf_regressor.fit(X_train,y_train)
rf_regressor.score(X_test,y_test)
rf_pred =rf_regressor.predict(X_test)
rf_score=rf_regressor.score(X_test,y_test)
expl_rf = explained_variance_score(rf_pred,y_test)
Training the Dataset
#Trainig the dataset into the model
early_stopping = EarlyStopping(monitor='val_loss', patience = 5)
#Defining early stopping parameter (optional, to save time)
model = get_model()
preds_on_untrained = model.predict(X_test) #Make predictions on the test set before training the
parameters
#Finally training the model-->
history = model.fit(
X_train, y_train,
validation_data = (X_test, y_test),
epochs = 100,
callbacks = [early_stopping]
Prediction and the Model Accuracy
print("Multiple Linear Regression Model Score is ",round(mlr.score(X_test,y_test)*100))
print("Decision tree Regression Model Score is ",round(tr_regressor.score(X_test,y_test)*100))
print("Random Forest Regression Model Score is ",round(rf_regressor.score(X_test,y_test)*100))

models_score =pd.DataFrame({'Model':['Multiple Linear Regression','Decision Tree','Random forest


Regression'],
'Score':[mlr_score,decision_score,rf_score],
'Explained Variance Score':[expl_mlr,expl_tr,expl_rf]
})
models_score.sort_values(by='Score',ascending=False)
Graphical Representation of Results
Graphical Representation of Results
Conclusion

In conclusion, this analysis underscores the comprehensive nature of our


exploration, covering a spectrum of predictive models including Neural Networks,
linear regression, decision trees, and random forests. The standout role of Neural
Networks in capturing intricate relationships among housing attributes for refined
price predictions attests to its efficacy. Through this process, we've pinpointed a
reliable approach for forecasting housing prices that works well in the real world.

You might also like