Comments (12)
This is related to issue #13. Basically, a brand-new object is created every time you call train
. I decided yesterday that this issue will not be resolved for a while, because I am creating a C wrapper around the training methods to interface Somoclu with Julia (issue #11). Since release 1.6.2, there is very little memory copy done in single-process execution, which makes calling train
repeatedly more efficient.
The second problem is that Somoclu was initially designed for supercomputers and GPU clusters, and the wrappers were an afterthought. So it is quintessentially batch-oriented.
In short, your hack is bound to be somewhat inefficient, but it should work in principle. Let me do some tests to see if it is a bug, because it looks like one.
from somoclu.
Oh, I guess it works if I create a matrix from the pattern vector and send that.
So if all my patterns are called patterns
but I just want to train on patterns[0]
if I send train()
np.matrix(train_patterns[0])
it works.
I think this is not a bug. Indeed it's a feature as perhaps only I would like to do online training! 😉 So it stops you sending a non-matrix to train with, which is sensible.
Do you think there is any use for an option to train internally in an online pattern-wise manner? I assume me doing it in a loop outside the SOM object is not efficient for larger SOMs than the one I am currently playing with.
from somoclu.
Hmm, so I can't actually tell if it works. I am having trouble using the standard code to get the BMUs, i.e., it doesn't seem to think there are any, which makes me think hack is not working. I'll let somebody who knows more get back to me.
from somoclu.
This works for me:
new_data = np.array([[0.2, 0.3]])
som.update_data(new_data)
som.train(epochs=1, scale0=0.001, radius0=5)
som.view_umatrix(bestmatches=True)
from somoclu.
Thanks for that. Mine code is similar. It loops through every pattern and does a single epoch like yours above, but mine basically returns no BMUs/has not managed to train meaningfully in most cases. I just tried running train(epochs=1, scale0=0.001, radius0=5)
with those parameters and it actually trains it, so obviously you know what good values to choose!
I am doing something like this now, but my U-matrix and quantization errors look terrible (close to untrained):
for pattern in patterns:
som.update_data(data=np.matrix(pattern))
som.train(epochs=1, scale0=0.001, radius0=5)
from somoclu.
This is what U-matrix looks like after above:
This is what it should look like, I think:
from somoclu.
Edit: Actually no - below does not work.
Holy crap! I got it. Looks bad(?) but this works:
radii = range(min(n_columns, n_rows)/2, 0, -1)
for pattern in patterns:
som.update_data(data=np.matrix(pattern))
for radius in radii:
som.train(epochs=1, scale0=0.001, radius0=radius)
from somoclu.
Getting the parameters right for a continued training is an incredible pain. Try setting scaleN too, perhaps with two epochs, with a very small starting radius. I never really understood why a trained map is so fragile, but it is.
from somoclu.
Argh, yeah, I am seeing this. Very small implies below 0.001?
from somoclu.
Haha OK, I am only making it worse each time. I'll switch to batch for now and try again tomorrow or soon.
from somoclu.
Hi, do you think we can add something to your questions? A release is planned for 30 Sept, and I would like to close some pending issues till then. Thanks.
from somoclu.
I can't comment on this further as I haven't has time to try anything out – but please feel free to close this issue!
from somoclu.
Related Issues (20)
- /home/docker/R/Rsomoclu/libs/Rsomoclu.so: undefined symbol: _ZTI8Snapshot
- Licensing and GPL HOT 6
- MATLAB interfece Batch algorithm HOT 4
- (core dumped) HOT 3
- Attempting to use an MPI routine before initializing MPI HOT 4
- single dimensional clustering
- upgradation problem HOT 1
- errors importing native C library (python 3.8.6 & swig 4.0.1) HOT 4
- update official repos (pypi and conda) HOT 3
- TypeError: train expected 23 arguments, got 22 HOT 2
- Can I set the random seed? HOT 4
- Get bmu of testing data HOT 2
- Numpy requirement in setup.py HOT 5
- conda-forge PackagesNotFoundError HOT 6
- How can I assign a cluster to new data? HOT 1
- Batch mode and learning rate HOT 3
- Can't build wheel with somoclu and pip 23.1 HOT 2
- Warning: the binary library cannot be imported. You cannot train maps, but you can load and analyze ones that you have already saved. If you installed Somoclu with pip on Windows, this typically means missing DLLs. Please refer to the documentation. HOT 4
- linux/arm64 for conda-forge
- About UMatrix visualization (question)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from somoclu.