Facemorph.Stats
Class Model

java.lang.Object
  extended by Facemorph.Stats.Model
All Implemented Interfaces:
IniHandler, java.lang.Runnable

public class Model
extends java.lang.Object
implements java.lang.Runnable, IniHandler

Loads, processes and regresses two sets of data.


Nested Class Summary
protected  class Model.DataDescription
           
protected  class Model.ImageSetDescription
           
 class Model.ModelException
           
 
Field Summary
static java.lang.String all
           
protected  Model.DataDescription dependentVariables
           
static java.lang.String equals
           
static java.lang.String greaterthan
           
protected  Model.DataDescription independentVariables
           
protected  iniFile iniFile
          INI data
static java.lang.String kFolds
           
static java.lang.String leaveOneOut
           
static java.lang.String lessthan
           
static java.lang.String MOLS
           
static java.lang.String none
           
static java.lang.String notEqual
           
protected  boolean outputStatistics
          We are expected to provide output statistics on the methods used
protected  java.io.File outputStatisticsFile
          File to use in providing the output statistics
protected  Model.DataDescription outputVariables
           
static java.lang.String PCA
           
static java.lang.String PLS
           
protected  DataReducer preprocessor
          A preprocessor for Data-reduction e.g.
static java.lang.String range
           
protected  Regressor regressor
          A regression method to apply to the data.
 
Constructor Summary
Model()
           
Model(iniFile in)
           
 
Method Summary
protected  boolean fillIniFile(iniFile in, java.lang.String name)
           
 boolean initialiseFromIniFile(iniFile in)
          Initialise the model using the data contained in an iniFile (i.e.
static void main(java.lang.String[] args)
           
protected  boolean outputResults()
           
 java.lang.StringBuffer outputStatistics()
           
protected  boolean postProcess()
           
 double[] predict(BigMat values)
          Using the Model previously generated, predict a set of values.
protected  boolean preprocess()
           
 void read(java.io.File f)
           
 boolean read(iniFile in)
          Read from the current position in an iniFile.
protected  boolean regress()
           
 void run()
           
 void write(java.io.File f)
           
 boolean write(iniFile file, java.lang.String name)
          Writes this Template to file (via a PrintStream)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

independentVariables

protected Model.DataDescription independentVariables

dependentVariables

protected Model.DataDescription dependentVariables

outputVariables

protected Model.DataDescription outputVariables

all

public static final java.lang.String all
See Also:
Constant Field Values

range

public static final java.lang.String range
See Also:
Constant Field Values

equals

public static final java.lang.String equals
See Also:
Constant Field Values

lessthan

public static final java.lang.String lessthan
See Also:
Constant Field Values

greaterthan

public static final java.lang.String greaterthan
See Also:
Constant Field Values

notEqual

public static final java.lang.String notEqual
See Also:
Constant Field Values

none

public static final java.lang.String none
See Also:
Constant Field Values

PLS

public static final java.lang.String PLS
See Also:
Constant Field Values

PCA

public static final java.lang.String PCA
See Also:
Constant Field Values

MOLS

public static final java.lang.String MOLS
See Also:
Constant Field Values

leaveOneOut

public static final java.lang.String leaveOneOut
See Also:
Constant Field Values

kFolds

public static final java.lang.String kFolds
See Also:
Constant Field Values

preprocessor

protected DataReducer preprocessor
A preprocessor for Data-reduction e.g. for decorrelation


regressor

protected Regressor regressor
A regression method to apply to the data.


outputStatistics

protected boolean outputStatistics
We are expected to provide output statistics on the methods used


outputStatisticsFile

protected java.io.File outputStatisticsFile
File to use in providing the output statistics


iniFile

protected iniFile iniFile
INI data

Constructor Detail

Model

public Model()

Model

public Model(iniFile in)
      throws java.io.IOException
Throws:
java.io.IOException
Method Detail

initialiseFromIniFile

public boolean initialiseFromIniFile(iniFile in)
                              throws java.io.IOException
Initialise the model using the data contained in an iniFile (i.e. the one produced by a RegressionForm

Parameters:
in - iniFile containing the data to used, the iniFile must already be in an appropriately typed Block
Returns:
true if successful initialised
Throws:
java.io.IOException

fillIniFile

protected boolean fillIniFile(iniFile in,
                              java.lang.String name)

run

public void run()
Specified by:
run in interface java.lang.Runnable

preprocess

protected boolean preprocess()

regress

protected boolean regress()

postProcess

protected boolean postProcess()

predict

public double[] predict(BigMat values)
Using the Model previously generated, predict a set of values.

Parameters:
values - Input variables for the prediction
Returns:
the output values of the prediction

read

public void read(java.io.File f)
          throws java.io.FileNotFoundException,
                 java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

outputResults

protected boolean outputResults()

outputStatistics

public java.lang.StringBuffer outputStatistics()

write

public void write(java.io.File f)
           throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

read

public boolean read(iniFile in)
Description copied from interface: IniHandler
Read from the current position in an iniFile. assumes that the iniFile is already in the object's root block

Specified by:
read in interface IniHandler
Returns:
true if successfully read.

write

public boolean write(iniFile file,
                     java.lang.String name)
Description copied from interface: IniHandler
Writes this Template to file (via a PrintStream)

Specified by:
write in interface IniHandler
Parameters:
file - The output ini file to fill with class data
Returns:
if written successfully

main

public static void main(java.lang.String[] args)