Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sircamp/simple-extreme-learning-machine
A Simple Extreme Learning Machine implementation in Scala With Breeze
https://github.com/sircamp/simple-extreme-learning-machine
datascience deep-learning extreme-learning-machine machine-learning scala
Last synced: 9 days ago
JSON representation
A Simple Extreme Learning Machine implementation in Scala With Breeze
- Host: GitHub
- URL: https://github.com/sircamp/simple-extreme-learning-machine
- Owner: sirCamp
- License: mit
- Created: 2019-08-19T19:59:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T06:40:57.000Z (over 5 years ago)
- Last Synced: 2024-11-19T13:46:04.551Z (2 months ago)
- Topics: datascience, deep-learning, extreme-learning-machine, machine-learning, scala
- Language: Scala
- Size: 125 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.com/sirCamp/simple-extreme-learning-machine.svg?branch=master)](https://travis-ci.com/sirCamp/simple-extreme-learning-machine)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Scala](https://img.shields.io/badge/scala-v2.12-blue)](https://img.shields.io/badge/scala-v2.12-blue)# A simple implementation of Extreme Learning Machine
This is a simple scala & Breeze implementation of an Extreme Learning Machine.
This library is designed to have great performances in scientific computation thanks to the linear algebra optimizations.
### How to
In order to use take a look to the following example:
```scala
import com.sircamp.elm.ExtremeLearningMachinevar featuresLength = 28*28 //MINST dataset
var hiddenLayerDimension = 1024
val elm = new ExtremeLearningMachine(featuresLength, hiddenLayerDimension)
/**
Initialize the weights of the hidden layer with random uniform distribution
Otherwise you can set the weights by your own.
Weights must be a DenseMatrix[Double] where rows are equal to the featuresLength
**/
elm.initializeWeights()/**
fit the model.
XTrain and yTrain must be DenseMatrix[Double].
yTrain must be the one hot encoded version of the original label
**/
elm.fit(XTrain, yTrain)/**
predictClasses return a DenseVector[Int] with the index of the predicted class
**/
var yPred = elm.predictClasses(XTest)/**
predict return a DenseMatrix[Double] where each row contains the probability of the element to belongs to the class
**/
var yProbabilityPred = elm.predict(XTest)println("Accuracy: "+Metrics.accuracy_score(yPlain,yPred))
```
Set a different Activation function
```scala
import com.sircamp.elm.ExtremeLearningMachinevar featuresLength = 28*28 //MINST dataset
var hiddenLayerDimension = 1024
val elm = new ExtremeLearningMachine(featuresLength, hiddenLayerDimension)
/**
Initialize the weights of the hidden layer with random uniform distribution
Otherwise you can set the weights by your own.
Weights must be a DenseMatrix[Double] where rows are equal to the featuresLength
**/
elm.initializeWeights()/**
This return the LeakyReLu function with the alpha param
**/
elm.setActivationFunction(ActivationFunctions.leakyReLu(0.2))/**
This return the Tanh function
**/
elm.setActivationFunction(ActivationFunctions.tanh)
```For more example take a look to the tests