Coder Social home page Coder Social logo

joyhuang9473 / example-neural-network-som Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 138 KB

Example-Neural-Network-SOM is an implementation of self-organizing feature map (SOFM, SOM), which is a type of artificial neural network that is trained using unsupervised learning to produce a low-dimensional map, written in Java.

Java 100.00%

example-neural-network-som's Introduction

2ring@480

Example-Neural-Network-SOM

Example-Neural-Network-SOM is an implementation of self-organising feature map (SOFM, SOM), which is a type of artificial neural network that is trained using unsupervised learning to produce a low-dimensional map, written in Java.

Junior project in class "Neural Network". Last updated 11/25/2014.

How to use

  • Select input file from dataSet directory.
  • Field 學習率 (learning rate) and 學習次數 (count of learning loop) columns or Field blank to use the default value.
  • Field 神經元數目: (row*column) columns to set matrix topology's size or Field blank to use the default value.
  • Click 訓練 button to train.
  • Click 測驗 button to test.

Feature

Graphics

Black dots for data set.

Blue dots for weight vectors of neurons.

Console log

The leftmost field in gui is console log output.

It will show iteration number, best neuron number, winning number for each neuron.

// console log example

Iteration number: 1
...
Best neuron number: 51
...
神經元得勝次數
=============
neuron 1: 140000次
neuron 2: 60000次
neuron 3: 30000次
...

DataSet (Trainging Set, Testing Set)

// src/neural_network_pattern/Pattern.java
...
int num_training = 2*dataSize/3 + 1;
int num_testing = dataSize - num_training;

Default Setting

// src/neural_netowrk_som/Framework.java
...
int learningCount = (!jt_learningCount.getText().isEmpty()) ? Integer.parseInt(jt_learningCount.getText()) : 10000;
double learningRate = (!jt_learningRate.getText().isEmpty()) ? Double.parseDouble(jt_learningRate.getText()) : 0.1;
int neuron_row_Count = (!jt_neuron_row_Count.getText().isEmpty()) ? Integer.parseInt(jt_neuron_row_Count.getText()) : 10;
int neuron_column_Count = (!jt_neuron_column_Count.getText().isEmpty()) ? Integer.parseInt(jt_neuron_column_Count.getText()) : 10;

Topology

// src/neural_netowrk_topology/MatrixTopology.java
public MatrixTopology(MetricModel metric, int row, int col) {
    this.metric = metric;
    this.rowNumber = row;
    this.colNumber = col;
}
...

// src/neural_netowrk_topology/MatrixTopology.java
public Coords getNeuronCoordinate(int neuronNumber) {
    int x = ((neuronNumber - 1) / colNumber) + 1;
    int y = neuronNumber - ((x - 1) * colNumber);

    return new Coords(x, y);
}
...

// src/neural_netowrk_topology/MatrixTopology.java
public int getNeuronNumber(Coords coords) {
    if (coords.x < 1 || coords.y < 1) return -1;
    
    if ((coords.x < rowNumber) && (coords.y < colNumber)) {
        return (coords.x - 1) * colNumber + coords.y;
    }

    return -1;
}
...

Neighbourhood Function

// src/neural_netowrk_topology/MatrixTopology.java
public double gaussNeighbourhoodFunction(double distance) {
    return java.lang.Math.exp(-(java.lang.Math.pow(distance, 2)) / (2 * radius * radius));
}

Dependency

JDK

$ java -version

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Build and run

Compile

$ javac -d bin -sourcepath src src/neural_network_som/*.java

Run

$ java -cp bin neural_network_som.Main

Create jar file

$ jar cfe neural_network_som.jar neural_network_som.Main -C bin/ .

$ jar tf neural_network_som.jar # list table of contents for archive

META-INF/
META-INF/MANIFEST.MF
.gitkeep
neural_network_metric/
neural_network_metric/EuclidesMetric.class
neural_network_metric/MetricModel.class
neural_network_network/
neural_network_network/Network.class
neural_network_network/NetworkModel.class
neural_network_network/Neuron.class
neural_network_network/NeuronModel.class
neural_network_pattern/
neural_network_pattern/FileData.class
neural_network_pattern/Pattern.class
neural_network_som/
neural_network_som/Framework$CustomActionListener.class
neural_network_som/Framework.class
neural_network_som/Graph$TimerListener.class
neural_network_som/Graph.class
neural_network_som/Main.class
neural_network_som/SOM.class
neural_network_topology/
neural_network_topology/Coords.class
neural_network_topology/MatrixTopology.class
neural_network_topology/TopologyModel.class

Screenshot

2CS@480

5CloseS1@480

C3D@480

More details in http://imgur.com/a/3DeTU

Reference

[1]. Janusz Rybarski, Seweryn Habdank-Wojewódzki, "Java Kohonen Neural Network Library (JKNNL)", 2013

[2]. Jochen Fröhlich, "Kohonen Feature Map", 2004

[3]. MathWorks, "Cluster with Self-Organizing Map Neural Network", 2015

[4]. ifs.tuwien.ac.at, "SOM Visualisations available in the Java SOMToolbox", 2010

[5]. Jaakko Hollmen, "U-matrix", 1996

[6]. Bashir Magomedov, "Self-Organizing Feature Maps (Kohonen maps)", 2006

[7]. Sergiy Kovalchuk, "How to Compile and Run Java Code from a Command Line", 2011

[8]. StackOverFlow, "Create jar file from command line", 2012

example-neural-network-som's People

Contributors

joyhuang9473 avatar

Watchers

 avatar  avatar

Forkers

2php

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.