/MLP

MLP is a machine learning library programmed in Python after my 6th semester

Primary LanguagePython

MLP

MLP is a machine learning library implemented in Python.

Machine Learning algorithms MLP covers are as follows:

  • Multivarite Linear Regression (done)
  • Logistic Regression with multiclass classification (to do)
  • Neural Networks (to do)
  • Support Vector Machines (to do)

MLP also covers some functions to measure various metrics so that users can see their model's progress. These are as follows:

  • Sqaured error function to understand which parameters to the function are the best based on various model tries (to do)
  • Data visualization for every dimension in the dataset and dependent variable (to do)
  • Cost function - number of iterations graph (to do)
  • Confusion Matrix (to do)

Getting started with MLP

Multivariate Linear Regression

Importing necessary modules

from multi_variate_linear_regression import MultivariateLinearRegression 

import pandas as pd  # for preprocessing the data
import matplotlib.pyplot as plt  # for plotting the graph

Loading data, preparing it for the model using numpy

datas = pd.read_csv('getting started toy datasets/multivariate_linear_regression_data.txt').to_numpy()
X = datas[0:25,0]
Y = datas[0:25:,1]
X_test = datas[25:29, 0]
Y_test = datas[25:29, 1]

Training model with variables

mlr = MultivariateLinearRegression(0.0001, 'Gradient Descent', 1000000) 
mlr.train(X, Y)

Predicting different independent variables

Y_pred = []
for x in X_test:
    Y_pred.append(mlr.predict([x]))

Plotting the dataset and model's graph

plt.plot(X, Y, 'bs')
plt.plot(X_test, Y_pred, 'r') 

image

Prerequisites

  • numpy

Built With