0.7.0 • Published 7 years ago

kohonen v0.7.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

kohonen Build Status

A basic implementation of a Kohonen map in JavaScript

`We are still on an early stage of dev. Do not use this package until v1.0.0 has been released.

Usage

Import lib

npm i kohonen --save

Then, in your JS script :

import Kohonen, {hexagonHelper} from 'kohonen';

API

Kohonen

The Kohonen class is the main class.

Constructor
param namedefinitiontypemandatorydefault
neuronsgrid of neuronsArrayyes
datadatasetArray of Arrayyes
maxStepstep max to clampNumberno10000
maxLearningCoefNumberno1
minLearningCoefNumberno.3
maxNeighborhoodNumberno1
minNeighborhoodNumberno.3
// instanciate your Kohonen map
const k = new Kohonen({data, neurons});

// you can use the grid helper to generate a grid with 10x10 hexagons
const k = new Kohonen({data, neurons: hexagonHelper.generateGrid(10,10)});

neurons parameter should be a flat array of { pos: [x,y] }. pos array being the coordinate on the grid.

data parameter is an array of the vectors you want to display. There is no need to standardize your data, that will be done internally by scaling each feature to the 0,1 range.

Basically the constructor do :

  • standardize the given data set
  • initialize random weights for neurons using PCA's largests eigenvectors
training method
param namedefinitiontypemandatorydefault
logfunc called after each step of learning processFunctionno()=>{}
k.training();

training method iterates on random vectors picked on normalized data. If a log function is provided as a parameter, it will receive instance neurons and step as params.

mapping method

mapping method returns grid position for each data provided on the constructor.

const myPositions = k.mapping();
umatrix method

umatrix method returns the U-Matrix of the grid (currently only with standardized vectors).

const umatrix = k.umatrix();

Example

We've developed a full example on a dedicated repository

capture

(Re)sources

0.7.0

7 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago