Giter VIP home page Giter VIP logo

knn-.-multilayer-perceptron-from-scratch---python's Introduction

#Report Q1)

1)Abstractions : a)distance_list - stores the distances of all the train set data from the test set data. b)neighbors - stores the k nearest neighbors in the test set c)all the other absatractions are given in the initialize function in the class

Ideology: Knn- a)By finding the K data points in the training set that are closest to the new data point, and using those K data points to make a prediction. For example, in a binary classification task, KNN might predict that a new data point belongs to the "positive" class if the majority of the K nearest neighbors belong to the "positive" class. b)Knn algorithm is also called as Lazy learner because there is no training that happens in the algorithm , it just calculates the distance of a test set point to all the train set data points during the testing.

Metrics : a)euclidean_distance : It is calculated as the square root of the sum of the squares of the differences between the x-coordinates and y-coordinates of the two points. b)manhattan_distance :The Manhattan distance is also known as the "taxi cab" or "rectilinear" distance, because it is the distance a taxi would have to travel in a city laid out in a grid pattern to get from one point to another. It is different from the Euclidean distance, which is the straight-line distance between two points

Q2)

#Report: a)Abstractions : 1)_h_weights - Weights of the hidden layer ->I Initialized the hidden weights 2)_h_bias - Bias of the hidden layer 3)_o_weights - Weights of the output layer 4)_o_bias - Bias of the output layer 5)The remaining absatractions arem given in comments

b)Ideology : A multilayer perceptron (MLP) is a type of feedforward artificial neural network. It consists of an input layer, one or more hidden layers, and an output layer. Each layer consists of a set of neurons, which are connected to the neurons in the previous and next layers. The input layer receives the input data, which is then passed through the hidden layers where it is transformed by a series of computations. Activation Function : Each layer is passed through a activation function which processes the In artificial neural networks, the activation function is a key component of a neuron. It takes in the weighted sum of all the inputs to the neuron, along with a bias term, and produces an output. We Defined activation functions like sigmoid , tanh , identity , ReLu etc in utiils.py file.

c)Work Flow: 1)We Initialize weights , bias. 2)Fit :In the fit method we run each row of the train set and pass it through hidden layer , output layer , we calculate the error of the actual y value and the predicted y value. 3)Backpropogation : We use this error to back propogate the layers and to update weights. 4)In the same way we update weighs for every train set record and update weights through all the iterations 5)Predict :We use the final values of the weights and bias values to run through the test set data and calculate the pedictions.

knn-.-multilayer-perceptron-from-scratch---python's People

Contributors

anuragsangem avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.