 |
Build a bayesian Self-Organizing Map. Example II
Source code name: "neural_net_bsom2.py"
Programming language: Python
Topic: Artificial Intelligence/neural net
DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/neural_net_bsom2_2278.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from jhplot import *
from java.awt import Color
from java.util import Random
c1 = HPlot("Canvas")
c1.setGTitle("Bayesian Self-Organizing Map")
c1.visible()
c1.setAutoRange()
h1 = H1D("Data",20, -100.0, 300.0)
r = Random()
for i in range(2000):
h1.fill(100+r.nextGaussian()*100)
p1d=P1D(h1,0,0)
p1d.setErrToZero(1)
bs=HBsom()
bs.setNPoints(30)
bs.setData(p1d)
bs.run()
result=bs.getResult()
result.setStyle("pl")
result.setColor(Color.blue)
c1.draw(p1d)
c1.draw(result)
You see the box below because you did not login.