mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	rogueviz::kohonen:: bestsample -1
This commit is contained in:
		| @@ -197,6 +197,7 @@ void coloring() { | |||||||
|         besttofind = false; |         besttofind = false; | ||||||
|         for(neuron& n: net) { |         for(neuron& n: net) { | ||||||
|           double bdiff = 1e20; |           double bdiff = 1e20; | ||||||
|  |           n.bestsample = -1; | ||||||
|           for(auto p: sample_vdata_id) { |           for(auto p: sample_vdata_id) { | ||||||
|             double diff = vnorm(n.net, data[p.first].val); |             double diff = vnorm(n.net, data[p.first].val); | ||||||
|             if(diff < bdiff) bdiff = diff, n.bestsample = p.second; |             if(diff < bdiff) bdiff = diff, n.bestsample = p.second; | ||||||
| @@ -205,7 +206,10 @@ void coloring() { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|       for(int i=0; i<cells; i++) { |       for(int i=0; i<cells; i++) { | ||||||
|  |         if(net[i].bestsample >= 0) | ||||||
|           part(net[i].where->landparam_color, pid) = part(vdata[net[i].bestsample].cp.color1, pid+1); |           part(net[i].where->landparam_color, pid) = part(vdata[net[i].bestsample].cp.color1, pid+1); | ||||||
|  |         else | ||||||
|  |           part(net[i].where->landparam_color, pid) = 128; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @@ -1192,6 +1196,7 @@ void do_classify() { | |||||||
|   if(bdiffn.empty()) { |   if(bdiffn.empty()) { | ||||||
|     printf("Finding samples...\n"); |     printf("Finding samples...\n"); | ||||||
|     bdiffn.resize(cells, 1e20); |     bdiffn.resize(cells, 1e20); | ||||||
|  |     for(int i=0; i<cells; i++) net[i].bestsample = -1; | ||||||
|     for(int s=0; s<samples; s++) { |     for(int s=0; s<samples; s++) { | ||||||
|       int n = bids[s]; |       int n = bids[s]; | ||||||
|       double diff = bdiffs[s]; |       double diff = bdiffs[s]; | ||||||
| @@ -1322,6 +1327,7 @@ void klistsamples(const string& fname_samples, bool best, bool colorformat) { | |||||||
|       if(best) |       if(best) | ||||||
|         for(int n=0; n<cells; n++) { |         for(int n=0; n<cells; n++) { | ||||||
|           if(!net[n].allsamples && !net[n].drawn_samples) { if(!colorformat) fprintf(f, "\n"); continue; } |           if(!net[n].allsamples && !net[n].drawn_samples) { if(!colorformat) fprintf(f, "\n"); continue; } | ||||||
|  |           if(net[n].bestsample >= 0) | ||||||
|             klistsample(net[n].bestsample, n); |             klistsample(net[n].bestsample, n); | ||||||
|           } |           } | ||||||
|       else |       else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue