Mercurial > hg > jslab
view 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 |
line wrap: on
line source
package samer.models; import samer.tools.*; import samer.core.*; import samer.maths.*; public class ICABundle extends AnonymousTask { public ICA ica; public DiffScaler scaler; public GeneralisedExponential genexp; public BatchedTrainer tscaler, tica, tgenexp; public ICABundle(Vec x) { ica=new ICA(x); scaler=new DiffScaler(ica.output()); genexp=new GeneralisedExponential(scaler.output()); ica.setOutputModel(scaler); scaler.setOutputModel(genexp); tscaler=new BatchedTrainer(scaler.getScaleTrainer(),4); tgenexp=new BatchedTrainer(genexp.getTrainer(),256); tica =new BatchedTrainer(ica.getTrainer(),x.size()); } public void setFlushTask(Task t) { tica.setFlushTask(t); } public Task getSyncTask() { return new AnonymousTask() { ICAScalerSync sync=new ICAScalerSync(ica,scaler); public void run() { sync.run(); ica.execute("basis",Shell.env()); } }; } public void run() throws Exception { ica.infer(); scaler.infer(); genexp.compute(); scaler.compute(); tgenexp.run(); tscaler.run(); tica.run(); } public void dispose() { tica.dispose(); tscaler.dispose(); tgenexp.dispose(); genexp.dispose(); scaler.dispose(); ica.dispose(); } }