Loan Status Prediction Machine Learning Model Exercise

3–4 minutes

read

Predicting whether a loan application will be approved or rejected is a critical task for financial institutions. In this blog, we’ll walk through a hands-on machine learning exercise to build a loan status prediction model using real-world data. By the end, you’ll understand how to clean the data, select the right features, and train a model that can help automate loan decisions with accuracy and confidence.

workflow: data > data pre processing > split the data into train test split > SVM( supervised learning :Machine learning model)

new data > trained support vector machine model > approved or rejected

  • #loading the dataset to pandas dataframe

link to practice the dataset :

https://www.kaggle.com/datasets/altruistdelhite04/loan-prediction-problem-dataset

  • # printing the first 5 rows of the dataframe
  • # no of rows and columns
  • # statistical measures
  • # number of missing values in each column
  • # dropping the missing values
  • # dependent column values
  • # dependent values
  • # education and loan status
  • # married and loan status
  • # convert categorical data into numerical data
  • # separating the data and label
  • #training the support Vector Macine model
  • # accuracy score on training data
  • X_train_prediction = classifier.predict(X_train)
  • training_data_accuray = accuracy_score(X_train_prediction,Y_train)
  • print(‘Accuracy on training data : ‘, training_data_accuray)
  • # accuracy score on testing data
  • X_test_prediction = classifier.predict(X_test)
  • test_data_accuracy = accuracy_score(X_test_prediction,Y_test)
  • print(‘Accuracy on testing data : ‘, training_data_accuracy)
  • # changing the input_data to numpy array
  • # reshape the array as we are predicting for one instance
  • # standardize the input data
  • # scaler.transform(input_data_reshaped)

Disclaimer: All information provided on www.academicbrainsolutions.com is for general educational purposes only. While we strive to provide accurate and up-to-date information, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability of the information contained on the blog/website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. The information provided on www.academicbrainsolutions.com is not intended to be a substitute for professional educational advice, diagnosis, or treatment. Always seek the advice of your qualified educational institution, teacher, or other qualified professional with any questions you may have regarding a particular subject or educational matter. In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this blog/website. Our blog/website may contain links to external websites that are not provided or maintained by us. We do not guarantee the accuracy, relevance, timeliness, or completeness of any information on these external websites. Comments are welcome and encouraged on www.academicbrainsolutions.com is but please note that we reserve the right to edit or delete any comments submitted to this blog/website without notice due to: Comments deemed to be spam or questionable spam, Comments including profanity, Comments containing language or concepts that could be deemed offensive, Comments that attack a person individually.By using www.academicbrainsolutions.com you hereby consent to our disclaimer and agree to its terms. This disclaimer is subject to change at any time without prior notice

Leave a comment