annotate examples/sound/sampled/ICABundle.java @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents bf79fb79ee13
children
rev   line source
samer@0 1 package samer.models;
samer@0 2 import samer.tools.*;
samer@0 3 import samer.core.*;
samer@0 4 import samer.maths.*;
samer@0 5
samer@0 6
samer@0 7 public class ICABundle extends AnonymousTask
samer@0 8 {
samer@0 9 public ICA ica;
samer@0 10 public DiffScaler scaler;
samer@0 11 public GeneralisedExponential genexp;
samer@0 12 public BatchedTrainer tscaler, tica, tgenexp;
samer@0 13
samer@0 14 public ICABundle(Vec x) {
samer@0 15 ica=new ICA(x);
samer@0 16 scaler=new DiffScaler(ica.output());
samer@0 17 genexp=new GeneralisedExponential(scaler.output());
samer@0 18
samer@0 19 ica.setOutputModel(scaler);
samer@0 20 scaler.setOutputModel(genexp);
samer@0 21
samer@0 22 tscaler=new BatchedTrainer(scaler.getScaleTrainer(),4);
samer@0 23 tgenexp=new BatchedTrainer(genexp.getTrainer(),256);
samer@0 24 tica =new BatchedTrainer(ica.getTrainer(),x.size());
samer@0 25 }
samer@0 26
samer@0 27 public void setFlushTask(Task t) { tica.setFlushTask(t); }
samer@0 28
samer@0 29 public Task getSyncTask() {
samer@0 30 return new AnonymousTask() {
samer@0 31 ICAScalerSync sync=new ICAScalerSync(ica,scaler);
samer@0 32 public void run() {
samer@0 33 sync.run();
samer@0 34 ica.execute("basis",Shell.env());
samer@0 35 }
samer@0 36 };
samer@0 37 }
samer@0 38
samer@0 39 public void run() throws Exception {
samer@0 40 ica.infer();
samer@0 41 scaler.infer();
samer@0 42 genexp.compute();
samer@0 43 scaler.compute();
samer@0 44 tgenexp.run();
samer@0 45 tscaler.run();
samer@0 46 tica.run();
samer@0 47 }
samer@0 48
samer@0 49 public void dispose() {
samer@0 50 tica.dispose();
samer@0 51 tscaler.dispose();
samer@0 52 tgenexp.dispose();
samer@0 53 genexp.dispose();
samer@0 54 scaler.dispose();
samer@0 55 ica.dispose();
samer@0 56 }
samer@0 57 }