view src/scheme/newica.scm @ 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
(import "samer.models.*")

(define (newica x)
	(define ica (ICA. x))
	(define scaler (DiffScaler. (.output ica)))
	(define genexp (GeneralisedExponential. (.output scaler)))

	;;; Training
	(define t-scaler (BatchedTrainer. (.getScaleTrainer scaler) 4))
	(define t-genexp (BatchedTrainer. (.getTrainer genexp) 256))
	(define t-ica    (BatchedTrainer. (.getTrainer ica) (.size x)))

	(.setOutputModel ica scaler)
	(.setOutputModel scaler genexp)

	;;; resync and compute basis every 16 ICA updates
	(.setFlushTask t-ica
		(sub 32 (seq
			(ICAScalerSync. ica scaler)
			(task (exec ica "basis")))))

	;;; Runnable tasks
	(addtasks
		ica
		scaler
		genexp
		(task (.compute scaler))
		t-genexp t-scaler t-ica
	)

	;;; return all bits and pieces
	(list ica scaler genexp t-ica t-scaler t-genexp)
)