Code Monkey home page Code Monkey logo

supervisedelm's Introduction

SupervisedELM

Implementation of Supervised Extreme Learning Machine for binary classification

Binary Classification Examples for Synthetically Generated data

Example 1: Linear Classification

# Inporting the Supervised_ELM class, numpy and scikit learn libraries
from SELM.supervised_elm import Supervised_ELM
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import MinMaxScaler

Create synthetic data of class 1 containing 2D random points from 0 to 50 and class 2 containing 2D random points from 60 to 100

data = np.concatenate((np.random.randint(0, 50, size = (30, 2)), np.random.randint(60, 100, size = (30, 2))), axis = 0)
labels = np.concatenate((np.full(30, 0), np.full(30, 1)), axis = 0)
traindata, testdata, trainlabels, testlabels = train_test_split(data, labels, test_size = 0.1)
scaler = MinMaxScaler()
traindata = scaler.fit_transform(traindata)
testdata = scaler.fit_transform(testdata)
traindata = np.array(traindata)
testdata = np.array(testdata)

Create an object of the Supervised_ELM class and pass the required parameters

selm = Supervised_ELM(traindata, trainlabels, "sigmoid", 5)

Train the model using the train() function

selm.train()

Test the model using the test data

prediction = selm.test(testdata)
# Print the accuracy of the tarined model
print("Accuracy = {}".format(accuracy_score(testlabels, prediction)))

supervisedelm's People

Contributors

sumanth-bmsce avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.