edu.udo.cs.yale.datatable
Class DataTableKernelModelAdapter

java.lang.Object
  extended by edu.udo.cs.yale.datatable.AbstractDataTable
      extended by edu.udo.cs.yale.datatable.DataTableKernelModelAdapter
All Implemented Interfaces:
DataTable

public class DataTableKernelModelAdapter
extends AbstractDataTable

This class can be used to use a kernel model as data table. The data is directly read from the kernel model instead of building a copy. Please note that the method for adding new rows is not supported by this type of data tables.

Version:
$Id: DataTableKernelModelAdapter.java,v 1.4 2006/08/03 14:39:33 ingomierswa Exp $
Author:
Ingo Mierswa

Nested Class Summary
private static class DataTableKernelModelAdapter.KernelModelIterator
          Helper class to iterated over the examples or support vectors of a KernelModel.
 
Field Summary
private  java.util.Map<java.lang.Integer,java.lang.String> index2LabelMap
           
private  KernelModel kernelModel
           
private  java.util.Map<java.lang.String,java.lang.Integer> label2IndexMap
           
private  int[] sampleMapping
           
 
Constructor Summary
DataTableKernelModelAdapter(KernelModel kernelModel)
           
 
Method Summary
 void add(DataTableRow row)
          Adds the given DataTableRow to the table.
 int getColumnIndex(java.lang.String name)
          Returns the column index of the column with the given name.
 java.lang.String getColumnName(int i)
          Returns the name of the i-th column.
 double getColumnWeight(int column)
          Returns the weight of the column or Double.NaN if no weight is available.
 java.lang.String getName()
          Returns the name of this data table.
 int getNumberOfColumns()
          Returns the total number of columns.
 int getNumberOfRows()
          Returns the total number of rows.
 int getNumberOfSpecialColumns()
          Returns the total number of special columns.
 int getNumberOfValues(int column)
          Returns the number of different values for the i-th column.
 DataTableRow getRow(int index)
          Returns the data table row with the given index.
 boolean isNominal(int index)
          Indicates if the column with the given index is nominal.
 boolean isSpecial(int index)
          Returns true if this column is a special column which might usually not be used for some plotters, for example weights or labels.
 boolean isSupportingColumnWeights()
          Returns true if this data table is supporting column weights.
 java.util.Iterator<DataTableRow> iterator()
          Returns an iterator over all DataTableRows.
 java.lang.String mapIndex(int column, int value)
          If a column is nominal, the index value must be mapped to the nominal value by this method.
 int mapString(int column, java.lang.String value)
          If a column is nominal, the nominal value must be mapped to a (new) index by this method.
 void sample(int newSize)
          Performs a sampling of this data table.
 
Methods inherited from class edu.udo.cs.yale.datatable.AbstractDataTable
addDataTableListener, containsMissingValues, fireEvent, getColumnNames, getValueAsString, removeDataTableListener, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kernelModel

private KernelModel kernelModel

sampleMapping

private int[] sampleMapping

index2LabelMap

private java.util.Map<java.lang.Integer,java.lang.String> index2LabelMap

label2IndexMap

private java.util.Map<java.lang.String,java.lang.Integer> label2IndexMap
Constructor Detail

DataTableKernelModelAdapter

public DataTableKernelModelAdapter(KernelModel kernelModel)
Method Detail

getNumberOfSpecialColumns

public int getNumberOfSpecialColumns()
Description copied from interface: DataTable
Returns the total number of special columns. Please note that these columns do not need to be in an ordered sequence. In order to make sure that a column is a special column the method DataTable.isSpecial(int) should be used.


isSpecial

public boolean isSpecial(int index)
Description copied from interface: DataTable
Returns true if this column is a special column which might usually not be used for some plotters, for example weights or labels.


isNominal

public boolean isNominal(int index)
Description copied from interface: DataTable
Indicates if the column with the given index is nominal. For numerical columns, the value false should be returned.


mapIndex

public java.lang.String mapIndex(int column,
                                 int value)
Description copied from interface: DataTable
If a column is nominal, the index value must be mapped to the nominal value by this method. If the given column is not nominal, this method might throw a NullPointerException.


mapString

public int mapString(int column,
                     java.lang.String value)
Description copied from interface: DataTable
If a column is nominal, the nominal value must be mapped to a (new) index by this method. If the given column is not nominal, this method might throw a NullPointerException.


getNumberOfValues

public int getNumberOfValues(int column)
Description copied from interface: DataTable
Returns the number of different values for the i-th column. Might return -1 or throw an exception if the specific column is not nominal.


getColumnName

public java.lang.String getColumnName(int i)
Description copied from interface: DataTable
Returns the name of the i-th column.


getColumnIndex

public int getColumnIndex(java.lang.String name)
Description copied from interface: DataTable
Returns the column index of the column with the given name.


isSupportingColumnWeights

public boolean isSupportingColumnWeights()
Description copied from interface: DataTable
Returns true if this data table is supporting column weights.


getColumnWeight

public double getColumnWeight(int column)
Description copied from interface: DataTable
Returns the weight of the column or Double.NaN if no weight is available.


getNumberOfColumns

public int getNumberOfColumns()
Description copied from interface: DataTable
Returns the total number of columns.


getNumberOfRows

public int getNumberOfRows()
Description copied from interface: DataTable
Returns the total number of rows.


getName

public java.lang.String getName()
Description copied from interface: DataTable
Returns the name of this data table.


add

public void add(DataTableRow row)
Description copied from interface: DataTable
Adds the given DataTableRow to the table.


getRow

public DataTableRow getRow(int index)
Description copied from interface: DataTable
Returns the data table row with the given index. Please note that this method is not guaranteed to be efficiently implemented. If you want to scan the complete data table you should use the iterator() method instead.


iterator

public java.util.Iterator<DataTableRow> iterator()
Description copied from interface: DataTable
Returns an iterator over all DataTableRows.


sample

public void sample(int newSize)
Description copied from interface: DataTable
Performs a sampling of this data table. Following operations should only work on the sample.



Copyright © 2001-2006