Machine Learning Presentaion
Machine Learning Presentaion
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.
#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
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))