Posts

Showing posts with the label future prediction

Polynomial Regression Python Code - Loan Default Prediction

Image
Import necessary libraries import pandas import numpy import matplotlib.pyplot from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures Importing data into project data = pandas.read_csv('loan_default_rate_dataset.csv') print(data) Assign Input Columns to X variable and Output column to Y Variable x = data[['Credit_Score','Annual_Income','Loan_Amount']] y = data['Loan_Default_Probability'] Importing Polynomial Features to do cross connections, squares in x data. So data will expand and model can learn unpredictable patterns poly = PolynomialFeatures(degree=2) training the X variable using the polynomial feature. So it will do cross connections, squares in x data and learn the complex patterns. x_poly = poly.fit_transform(x) Now, since we learned the complex patterns and expanded the x values into x_poly variable, we can do linear regression from the Polynomial X data and Y data. model = LinearRegres...

Linear Regression Prediction of future values in Python using Scatter Plot - Machine Learning

Image
We are Importing Necessary Libraries for this project  import pandas as pandas  import numpy as numpy  import matplotlib.pyplot as pyplot  from sklearn.linear_model import LinearRegression Importing Data using Pandas library and creating table dataframe data = pandas.read_csv('python_linear_regression_prediction_python_data.csv')  print(data) Assigning Input / Independent columns to X variable and Assigning Output / Dependent Column to Y Variable x = data[['Experience_Years','Calls_Made','Meetings_Conducted']]  y = data['Sales_Amount'] Asking Linear Regression Model to learn data from X and Y variables model = LinearRegression() model.fit(x,y) Printing Coefficient and Intercept to check their values print("Coefficient:",model.coef_)  print("Intercept",model.intercept_) Adding New Inputs / Independent Values to predict Output / Dependent values new_data = pandas.DataFrame({ 'Experience_Years': [8, 12, 15], '...

Commonly used Prediction Models in Machine Learning? Explain Each Model and How it Works?

Image
Regression models are a type of machine learning model used to predict. It tries to find a relationship between columns.  Regression Models are ready-made mathematical formulas created to make life easier . 1. Linear Regression: Linear Regression is a model that checks whether there is a relationship between two or more columns. The relationship means: if one column value increases, will the other column value also increase or decrease. If you study more hours, your marks will increase. If you have more work experience, your salary will increase. These are called positive relationships. Example: Students Mark - It can change over time, It is a Numerical score. Sales - It can change over time, It is a Numerical Count. Temperature - It can change over time. It is Number based. Here is a Simple Linear Regression Graph: If you have a Students Marks & Study time data for past 1 year, you can predict future marks using Linear Regression. 2. Logistic Regression: It is used for Pr...