edu.udo.cs.yale.operator.features.transformation
Class PCAModel

java.lang.Object
  extended by edu.udo.cs.yale.operator.AbstractIOObject
      extended by edu.udo.cs.yale.operator.ResultObjectAdapter
          extended by edu.udo.cs.yale.operator.AbstractModel
              extended by edu.udo.cs.yale.operator.IOModel
                  extended by edu.udo.cs.yale.operator.features.transformation.PCAModel
All Implemented Interfaces:
ComponentWeightsCreatable, IOObject, Model, ResultObject, Saveable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.util.EventListener

public class PCAModel
extends IOModel
implements java.awt.event.ActionListener, java.awt.event.ItemListener, ComponentWeightsCreatable

This is the transformation model of the principal components analysis. The number of components is initially specified by the PCA. Additionally you can specify the number of components in the ModelApplier. You can add two prediction parameter:

Version:
$Id: PCAModel.java,v 1.14 2006/09/30 00:05:31 ingomierswa Exp $
Author:
Daniel Hakenjos
See Also:
PCA

Field Summary
private  int[] att_index
           
private  java.lang.String[] attname
           
private  double[] cumvariance
           
(package private)  javax.swing.JRadioButton cumvariance_plot
           
(package private)  javax.swing.JRadioButton eigenvalue_table
           
private  double[] eigenvalues
           
(package private)  javax.swing.JRadioButton eigenvector_table
           
private  double[][] eigenvectors
           
private  boolean keep_attributes
           
private  int last_selected_index
           
private  boolean manual_number
           
private  double[] mean
           
private  int nr_components
           
private  double[][] sorted_eigenvectors
           
private  int sortindex
           
private  double variance_threshold
           
private  java.awt.Component[] viscomp
           
private  javax.swing.JPanel vispanel
           
 
Constructor Summary
PCAModel()
           
PCAModel(ExampleSet eSet, double[] eigenvalues, double[][] eigenvectors)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
           
 void apply(ExampleSet eSet)
          Applies the model on the given example set.
private  void calculateCumulativeVariance()
          Calculates the cumulative variance.
 java.lang.String[] getAttributeNames()
           
 double[] getEigenvalues()
           
private  java.awt.Component getEigenvalueTable()
           
 double[][] getEigenvectors()
           
private  java.awt.Component getEigenvectorTable()
           
 double[] getMean()
           
 double getNrOfComponents()
           
private  javax.swing.JComponent getVariancePlot()
           
 double getVarianceThreshold()
           
 java.awt.Component getVisualisationComponent(IOContainer container)
          Returns a label that displays the ResultObjectAdapter.toResultString() result encoded as html.
 AttributeWeights getWeightsOfComponent(int component)
           
private  void initSortedEigenvectors()
           
 void itemStateChanged(java.awt.event.ItemEvent event)
           
private  void quickSort(double[] array, int links, int rechts)
          Order the subarry from index anfang to index ende with QuickSort
private  void quickSort2(double[][] array, int index, int links, int rechts)
          Order the subarry from index anfang to index ende with QuickSort
 void readData(java.io.ObjectInputStream in)
          Reads the model data from the stream.
 void setNrOfComponents(int nr_components)
           
 void setParameter(java.lang.String name, java.lang.Object object)
          Throws a UserError since most models should not allow additional parameters during application.
 void setVarianceThreshold(double threshold)
           
 void writeData(java.io.ObjectOutputStream out)
          Writes the model to a stream.
 
Methods inherited from class edu.udo.cs.yale.operator.AbstractModel
equals, getExtension, getFileDescription, readModel, readModel, save, writeModel, writeModel
 
Methods inherited from class edu.udo.cs.yale.operator.ResultObjectAdapter
addAction, getActions, getName, toHTML, toResultString
 
Methods inherited from class edu.udo.cs.yale.operator.AbstractIOObject
copy, read, read, read, write, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.udo.cs.yale.operator.ResultObject
getActions, getName, toResultString
 
Methods inherited from interface edu.udo.cs.yale.operator.IOObject
copy, write, write
 

Field Detail

mean

private double[] mean

attname

private java.lang.String[] attname

eigenvalues

private double[] eigenvalues

eigenvectors

private double[][] eigenvectors

manual_number

private boolean manual_number

nr_components

private int nr_components

variance_threshold

private double variance_threshold

cumvariance

private double[] cumvariance

viscomp

private java.awt.Component[] viscomp

vispanel

private javax.swing.JPanel vispanel

eigenvalue_table

javax.swing.JRadioButton eigenvalue_table

eigenvector_table

javax.swing.JRadioButton eigenvector_table

cumvariance_plot

javax.swing.JRadioButton cumvariance_plot

last_selected_index

private int last_selected_index

att_index

private int[] att_index

sorted_eigenvectors

private double[][] sorted_eigenvectors

sortindex

private int sortindex

keep_attributes

private boolean keep_attributes
Constructor Detail

PCAModel

public PCAModel()

PCAModel

public PCAModel(ExampleSet eSet,
                double[] eigenvalues,
                double[][] eigenvectors)
Method Detail

getAttributeNames

public java.lang.String[] getAttributeNames()

getMean

public double[] getMean()

getEigenvalues

public double[] getEigenvalues()

getEigenvectors

public double[][] getEigenvectors()

getVarianceThreshold

public double getVarianceThreshold()

getNrOfComponents

public double getNrOfComponents()

setVarianceThreshold

public void setVarianceThreshold(double threshold)

setNrOfComponents

public void setNrOfComponents(int nr_components)

apply

public void apply(ExampleSet eSet)
           throws OperatorException
Description copied from interface: Model
Applies the model on the given example set.

Specified by:
apply in interface Model
Throws:
OperatorException


calculateCumulativeVariance

private void calculateCumulativeVariance()
Calculates the cumulative variance.


quickSort

private void quickSort(double[] array,
                       int links,
                       int rechts)
Order the subarry from index anfang to index ende with QuickSort

Parameters:
array -
links -
rechts -


writeData

public void writeData(java.io.ObjectOutputStream out)
               throws java.io.IOException
Description copied from class: AbstractModel
Writes the model to a stream.

Specified by:
writeData in class AbstractModel
Throws:
java.io.IOException


readData

public void readData(java.io.ObjectInputStream in)
              throws java.io.IOException
Description copied from class: IOModel
Reads the model data from the stream.

Specified by:
readData in class IOModel
Throws:
java.io.IOException


setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object object)
                  throws OperatorException
Description copied from class: AbstractModel
Throws a UserError since most models should not allow additional parameters during application. However, subclasses may overwrite this method.

Specified by:
setParameter in interface Model
Overrides:
setParameter in class AbstractModel
Throws:
OperatorException


getEigenvalueTable

private java.awt.Component getEigenvalueTable()

getEigenvectorTable

private java.awt.Component getEigenvectorTable()

getVariancePlot

private javax.swing.JComponent getVariancePlot()

getVisualisationComponent

public java.awt.Component getVisualisationComponent(IOContainer container)
Description copied from class: ResultObjectAdapter
Returns a label that displays the ResultObjectAdapter.toResultString() result encoded as html. Please note that the returned label is already enclosed by a scroll pane. If you overwrite this method you should again ensure that the returned component is scrollable. The given container is totally ignored.

Specified by:
getVisualisationComponent in interface ResultObject
Overrides:
getVisualisationComponent in class ResultObjectAdapter


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

quickSort2

private void quickSort2(double[][] array,
                        int index,
                        int links,
                        int rechts)
Order the subarry from index anfang to index ende with QuickSort

Parameters:
array -
links -
rechts -


initSortedEigenvectors

private void initSortedEigenvectors()

getWeightsOfComponent

public AttributeWeights getWeightsOfComponent(int component)
                                       throws OperatorException
Specified by:
getWeightsOfComponent in interface ComponentWeightsCreatable
Throws:
OperatorException


Copyright © 2001-2006