From 300d0b80ed73cb7bc9f874bf177ab9a8549d495c Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 5 Jul 2018 07:30:15 +0200 Subject: [PATCH] rogueviz::kohonen:: number of displayed observations per cell dependent on the number of total observations there --- rogueviz-kohonen.cpp | 50 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 6e6701ac..ffb237c8 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -21,14 +21,16 @@ vector samples_shown; int whattodraw[3] = {-2,-2,-2}; +int min_group = 10, max_group = 10; + struct neuron { kohvec net; cell *where; double udist; int lpbak; int col; - int allsamples, drawn_samples, csample, bestsample; - neuron() { drawn_samples = allsamples = bestsample = 0; } + int allsamples, drawn_samples, csample, bestsample, max_group_here; + neuron() { drawn_samples = allsamples = bestsample = 0; max_group_here = max_group; } }; vector colnames; @@ -560,8 +562,6 @@ void uninit(int initto) { if(inited > initto) inited = initto; } -int max_group = 10; - vector bdiffs; vector bids; vector bdiffn; @@ -571,7 +571,7 @@ int showsample(int id) { if(samples_shown[i] == id) return i; if(bids.size()) { - if(net[bids[id]].drawn_samples >= max_group) { + if(net[bids[id]].drawn_samples >= net[bids[id]].max_group_here) { ld bdist = 1e18; int whichid = -1; for(int i=0; i void load_raw(string fname, vector& v) { fclose(f); } +bool groupsizes_known = false; + void do_classify() { sominit(1); if(bids.empty()) { @@ -993,9 +995,41 @@ void do_classify() { for(int i=0; i neurons_to_sort; + for(int i=0; i samples_to_sort; + for(int i=0; i