|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFacemorph.Stats.ImagePLS
public class ImagePLS
Implements an iterative version of PLS based on the method by Milidi and Reteria, "DPLS and PPLS: two PLS algorithms got large data sets." Computation Statisitics and Data Analysis vol.48 pp125-138 (2005)
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface Facemorph.Stats.DataReducer |
---|
DataReducer.DataReducerInformation |
Nested classes/interfaces inherited from interface Facemorph.Stats.Regressor |
---|
Regressor.RegressorException |
Field Summary | |
---|---|
protected FloatImage |
averageImage
Store the average of the input images for ZScoring |
protected Batch |
imageFiles
A set of image files to process. |
protected FloatImage |
stdevImage
Store the standard deviation for ZScoring |
protected double[] |
varX
records the variance of the dependent explained by each vector of the PLS |
protected double[] |
varY
records the variance of the dependent explained by each vector of the PLS |
protected BigMat |
Y
Set of independent values to decompose against |
Constructor Summary | |
---|---|
ImagePLS()
|
Method Summary | |
---|---|
BigMat |
apply(BigMat in)
Apply the statistical model on the input data supplied in Matrix form |
protected static void |
buildTestSet(java.lang.String directory)
|
double |
getEpsilon()
Get epsilon, the very small error margin used the determine if the function has finished minimising. |
int |
getInputDimensions()
|
void |
getModelInformation(ModelInformation mi)
Queries the statistical model about its abilities. |
void |
getModelInformation(ModelResults result)
Query the (previously built) model for information about the model's components |
int |
getOutputDimensions()
|
double |
getSumSquaredResiduals()
|
double |
getTargetDependentVariance()
|
double |
getTargetIndpendentVariance()
|
static void |
main(java.lang.String[] args)
|
java.lang.StringBuffer |
outputStatistics()
|
boolean |
outputStatistics(java.io.File statsFile)
|
double[] |
predict(BigMat values)
Predict using the model the values of the dependent from a set of independents |
boolean |
read(java.io.File f)
|
boolean |
read(iniFile file)
Read from the current position in an iniFile. |
BigMat |
reconstructDependent(BigMat in)
Reconstruct (approximately) a high dimensional input given the low dimensional output |
double[] |
reconstructDependent(double[] in)
|
FloatImage[] |
reconstructImage(double[] in)
Reconstruct an image from a set of parameters |
BigMat |
reconstructIndependent(BigMat in)
Reconstruct (approximately) a high dimensional input given the low dimensional output |
double[] |
reconstructIndependent(double[] in)
Reconstruct (approximately) a high dimensional input given the low dimensional output |
double[] |
reduce(FloatImage r,
FloatImage g,
FloatImage b)
Reduce an image to a (much) lower dimensional form |
BigMat |
reduceDependent(BigMat in)
Perform dimensionality reduction on the BigMat |
double[] |
reduceDependent(double[] in)
|
BigMat |
reduceIndependent(BigMat in)
Perform dimensionality reduction on the BigMat |
double[] |
reduceIndependent(double[] in)
Perform dimensionality reduction on a single sample of variables |
void |
setDependentData(BigMat data)
The dependent part of the regression |
void |
setDependentData(double[] data)
The dependent part of the regression |
void |
setEpsilon(double e)
Set epsilon, the very small error margin used the determine if the function has finished minimising. |
void |
setIndependentData(Batch images)
Supply a set of images to use as the dependent variables of the PLS decomposition |
void |
setIndependentData(BigMat data)
The independent part of the regression |
void |
setOutputDimensions(int d)
Set the maximum number of output dimensions in the model (pre-build, undefined if set after building some classes will alter the dimensionality of the reduction others will not) If d is greater than the number input variables, the model will truncate at the maximum number of variables. |
void |
setTargetDependentVariance(double var)
Stop calculating components when the variance explained in the dependent variable is greater than var |
void |
setTargetIndependentVariance(double var)
Stop calculating components when the variance explained in the independent variable is greater than var |
void |
setTargetKaiserGuttman()
|
boolean |
train(boolean stats)
Perform multi-linear regression using the Ordinary Least Squares method. |
boolean |
write(java.io.File s)
Writes to the file specified |
boolean |
write(iniFile file,
java.lang.String name)
Writes this Template to file (via a PrintStream) |
boolean |
write(java.io.PrintStream out)
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 |
---|
protected Batch imageFiles
protected BigMat Y
protected FloatImage averageImage
protected FloatImage stdevImage
protected double[] varX
protected double[] varY
Constructor Detail |
---|
public ImagePLS()
Method Detail |
---|
public void setIndependentData(Batch images)
setIndependentData
in interface ImageDataHandler
images
- a batch file containing the image file namespublic void setIndependentData(BigMat data)
StatisticalModel
setIndependentData
in interface StatisticalModel
public void setDependentData(BigMat data)
StatisticalModel
setDependentData
in interface StatisticalModel
public boolean train(boolean stats)
StatisticalModel
train
in interface StatisticalModel
stats
- calculate values for statistical analysis
public void setOutputDimensions(int d)
DataReducer
setOutputDimensions
in interface DataReducer
d
- target number of dimensions.public int getOutputDimensions()
getOutputDimensions
in interface StatisticalModel
public boolean read(iniFile file)
IniHandler
read
in interface IniHandler
public void setTargetDependentVariance(double var)
DataReducer
setTargetDependentVariance
in interface DataReducer
var
- variance to explainpublic double getTargetDependentVariance()
getTargetDependentVariance
in interface DataReducer
public void setTargetIndependentVariance(double var)
DataReducer
setTargetIndependentVariance
in interface DataReducer
var
- variance to explainpublic double getTargetIndpendentVariance()
getTargetIndpendentVariance
in interface DataReducer
public void setEpsilon(double e)
DataReducer
setEpsilon
in interface DataReducer
e
- error valuepublic double getEpsilon()
DataReducer
getEpsilon
in interface DataReducer
public double[] predict(BigMat values)
Regressor
predict
in interface Regressor
values
- the independent values
public void setDependentData(double[] data)
StatisticalModel
setDependentData
in interface StatisticalModel
public double getSumSquaredResiduals()
getSumSquaredResiduals
in interface Regressor
public boolean outputStatistics(java.io.File statsFile)
outputStatistics
in interface StatisticalModel
public java.lang.StringBuffer outputStatistics()
outputStatistics
in interface StatisticalModel
public boolean read(java.io.File f) throws java.io.FileNotFoundException
read
in interface Regressor
java.io.FileNotFoundException
public boolean write(java.io.File s)
Regressor
write
in interface Regressor
s
- the name of the file to write to
public boolean write(java.io.PrintStream out)
Regressor
write
in interface Regressor
out
- The output PrintStream
public double[] reduce(FloatImage r, FloatImage g, FloatImage b)
ImageDataHandler
reduce
in interface ImageDataHandler
r
- the red part of the imageg
- the green part of the imageb
- the blue part of the iamge
public FloatImage[] reconstructImage(double[] in)
ImageDataHandler
reconstructImage
in interface ImageDataHandler
in
- a vector of reconstuction parameters
protected static void buildTestSet(java.lang.String directory) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public boolean write(iniFile file, java.lang.String name)
IniHandler
write
in interface IniHandler
file
- The output ini file to fill with class data
public double[] reduceIndependent(double[] in)
DataReducer
reduceIndependent
in interface DataReducer
in
- vector to reduce
public double[] reconstructIndependent(double[] in)
DataReducer
reconstructIndependent
in interface DataReducer
in
- low dimensional vector
public double[] reduceDependent(double[] in)
reduceDependent
in interface DataReducer
public double[] reconstructDependent(double[] in)
reconstructDependent
in interface DataReducer
public BigMat reduceIndependent(BigMat in)
DataReducer
reduceIndependent
in interface DataReducer
in
- BigMat to reduce
public BigMat reconstructIndependent(BigMat in)
DataReducer
reconstructIndependent
in interface DataReducer
in
- low dimensional matrix
public BigMat reduceDependent(BigMat in)
DataReducer
reduceDependent
in interface DataReducer
in
- BigMat to reduce
public BigMat reconstructDependent(BigMat in)
DataReducer
reconstructDependent
in interface DataReducer
in
- low dimensional matrix
public int getInputDimensions()
getInputDimensions
in interface StatisticalModel
public void getModelInformation(ModelInformation mi)
StatisticalModel
getModelInformation
in interface StatisticalModel
public BigMat apply(BigMat in)
StatisticalModel
apply
in interface StatisticalModel
in
- matrix containing values for modeling
public void setTargetKaiserGuttman()
setTargetKaiserGuttman
in interface DataReducer
public void getModelInformation(ModelResults result)
StatisticalModel
getModelInformation
in interface StatisticalModel
result
- ModelResults object to fill with appropriate information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |