Package com.rapidminer.belt.column
Class CategoricalColumn
- java.lang.Object
-
- com.rapidminer.belt.column.Column
-
- com.rapidminer.belt.column.CategoricalColumn
-
public abstract class CategoricalColumn extends Column
Column with data associated to integer categories. Data can be accessed via aCategoricalReaderor aNumericReadertogether with access to the mapping byColumn.getDictionary()or via aObjectReader.- Author:
- Gisa Meier, Michael Knopf
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.rapidminer.belt.column.Column
Column.Capability, Column.Category, Column.TypeId
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidfill(double[] array, int rowIndex)Fills the given array with column data starting with the given row index.voidfill(double[] array, int startIndex, int arrayOffset, int arrayStepSize)Fills the given array with column data starting with the given row index and using the given array offset and step size.voidfill(int[] array, int rowIndex)Fills the given array with column data starting with the given row index.voidfill(int[] array, int startIndex, int arrayOffset, int arrayStepSize)Fills the given array with column data starting with the given row index and using the given array offset and step size.voidfill(java.lang.Object[] array, int rowIndex)Fills the given array with column data starting with the given row index.voidfill(java.lang.Object[] array, int startIndex, int arrayOffset, int arrayStepSize)Fills the given array with column data starting with the given row index and using the given array offset and step size.protected abstract IntegerFormats.PackedIntegersgetByteData()Returns the underlyingbytecategory indices of this column.abstract IntegerFormats.FormatgetFormat()Returns the format of the underlying category indices.protected abstract int[]getIntData()Returns the underlyingintcategory indices of this column.protected abstract short[]getShortData()Returns the underlying unsignedshortcategory indices of this column.ColumnstripData()Strips the data from the column so that it has length 0 and no mapping or remapping.protected abstract CategoricalColumnswapDictionary(Dictionary newDictionary)Creates a new categorical column with the same data and the given dictionary.java.lang.StringtoString()ColumnType<java.lang.String>type()Returns theColumnTypeof this column.-
Methods inherited from class com.rapidminer.belt.column.Column
getDictionary, rows, size, sort
-
-
-
-
Method Detail
-
fill
public void fill(double[] array, int rowIndex)Description copied from class:ColumnFills the given array with column data starting with the given row index. Throws anUnsupportedOperationExceptionif this column has not the capabilityColumn.Capability.NUMERIC_READABLE.Please note that accessing rows outside of the columns bounds will lead to undefined results.
-
fill
public void fill(double[] array, int startIndex, int arrayOffset, int arrayStepSize)Description copied from class:ColumnFills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index256, the array offset4and a step size of8, the method writes the values at index256, 257, 258, ...to array positionsarray[4], array[12], array[20], ...respectively. Throws anUnsupportedOperationExceptionif this column has not the capabilityColumn.Capability.NUMERIC_READABLE.Please note that accessing rows outside of the columns bounds will lead to undefined results.
-
fill
public void fill(int[] array, int rowIndex)Description copied from class:ColumnFills the given array with column data starting with the given row index. Throws anUnsupportedOperationExceptionif the category of this column is notColumn.Category.CATEGORICAL.Please note that accessing rows outside of the columns bounds will lead to undefined results.
-
fill
public void fill(int[] array, int startIndex, int arrayOffset, int arrayStepSize)Description copied from class:ColumnFills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index256, the array offset4and a step size of8, the method writes the values at index256, 257, 268, ...to array positionsarray[4], array[12], array[20], ...respectively. Throws anUnsupportedOperationExceptionif the category of this column is notColumn.Category.CATEGORICAL.Please note that accessing rows outside of the columns bounds will lead to undefined results.
-
fill
public void fill(java.lang.Object[] array, int rowIndex)Description copied from class:ColumnFills the given array with column data starting with the given row index. Throws anUnsupportedOperationExceptionif this column has not the capabilityColumn.Capability.OBJECT_READABLE.
-
fill
public void fill(java.lang.Object[] array, int startIndex, int arrayOffset, int arrayStepSize)Description copied from class:ColumnFills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index256, the array offset4and a step size of8, the method writes the values at index256, 257, 268, ...to array positionsarray[4], array[12], array[20], ...respectively. Throws anUnsupportedOperationExceptionif this column has not the capabilityColumn.Capability.OBJECT_READABLE.
-
getFormat
public abstract IntegerFormats.Format getFormat()
Returns the format of the underlying category indices.- Returns:
- the index format
-
getByteData
protected abstract IntegerFormats.PackedIntegers getByteData()
Returns the underlyingbytecategory indices of this column. Returnsnullif the column is not of a format inIntegerFormats.BYTE_BACKED_FORMATS.- Returns:
- the index array or
null
-
getShortData
protected abstract short[] getShortData()
Returns the underlying unsignedshortcategory indices of this column. Returnsnullif the column is not of formatIntegerFormats.Format.UNSIGNED_INT16.- Returns:
- the index array or
null
-
getIntData
protected abstract int[] getIntData()
Returns the underlyingintcategory indices of this column. Returnsnullif the column is not of formatIntegerFormats.Format.SIGNED_INT32.- Returns:
- the index array or
null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
type
public final ColumnType<java.lang.String> type()
Description copied from class:ColumnReturns theColumnTypeof this column.
-
swapDictionary
protected abstract CategoricalColumn swapDictionary(Dictionary newDictionary)
Creates a new categorical column with the same data and the given dictionary. The new dictionary must be compatible with the data of the column in the sense that every category index in the data is mapped to a different non-null object value except for 0 which is mapped tonull. The compatibility is not checked by this method.- Parameters:
newDictionary- the new dictionary- Returns:
- a new categorical column
-
-