Giter Site home page Giter Site logo

som's Introduction

SOM Build Status codecov.io

A simple Self Organizing Map for Scala and Apache Spark.

Usage

Make sure you have an implicit SparkSession and your data RDD ready.

implicit val sparkSession = ???
val data: RDD[Vector] = ???

Compose your own SOM instance, with either predefined or custom implementations of decay functions, neighborhood kernels or error metrics...

val SOM = new SelfOrganizingMap with CustomDecay with GaussianNeighborboodKernel with QuantizationErrorMetrics {
    override val shape: Shape = (24, 24)
    override val learningRate: Double = 0.3
    override val sigma: Double = 0.5
  }

... or just use an off-the-shelf SOM for your convenience.

val SOM = GaussianSelfOrganizingMap(24, 24, sigma = 0.5, learningRate = 0.3)

Initialization and training:

val (som, params) = SOM.initialize(data).train(data, 20)

Classification of datapoints:

val dataPoint: DenseVector = ???
val (bmu, distance) = som.classify(dataPoint)

You can find more examples using the SOM library in the tests and complete applications in the examples directory.

Build and publish the SOM library locally

➜  som git:(master) ✗ sbt
...
> publishLocal
...
> project macros
...
> publishLocal
...
[success] Total time: 10 s, completed Dec 18, 2016 4:02:19 PM
>

Some parts of the implementation are inspired by the spark-som project. Credits to @jxieeducation / PragmaticLab.

som's People

Contributors

shokuninsan avatar

Watchers

James Cloos avatar zsj_thu 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.