Package adams.ml.data
Class DatasetUtils
- java.lang.Object
-
- adams.data.spreadsheet.SpreadSheetUtils
-
- adams.data.spreadsheet.SpreadSheetHelper
-
- adams.ml.data.DatasetUtils
-
public class DatasetUtils extends SpreadSheetHelper
Helper methods forDataset
objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
-
Fields inherited from class adams.data.spreadsheet.SpreadSheetUtils
PREFIX_COL
-
-
Constructor Summary
Constructors Constructor Description DatasetUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
getNumericColumns(Dataset data)
Determines the numeric columns in a dataset.static SpreadSheet
matrixAlgoToSpreadSheet(com.github.waikatodatamining.matrix.core.Matrix data, String colPrefix)
Returns the matrix as spreadsheet.static List<double[]>
numericToArrays(Dataset data)
Turns all the numeric columns into a list of double arrays.static List<double[]>
numericToArrays(Dataset data, int[] cols)
Turns the specified numeric columns into a list of double arrays.static Jama.Matrix
numericToJama(Dataset data)
Turns all the numeric columns into a Jama Matrix.static Jama.Matrix
numericToJama(Dataset data, int[] cols)
Turns the specified numeric columns into a Jama Matrix.static com.github.waikatodatamining.matrix.core.Matrix
numericToMatrixAlgo(Dataset data)
Turns all the numeric columns into a Jama Matrix.static com.github.waikatodatamining.matrix.core.Matrix
numericToMatrixAlgo(Dataset data, int[] cols)
Turns the specified numeric columns into a Jama Matrix.-
Methods inherited from class adams.data.spreadsheet.SpreadSheetHelper
append, compare, compareCells, convertToNumeric, mapToSpreadSheet
-
Methods inherited from class adams.data.spreadsheet.SpreadSheetUtils
createHeader, getCellLocation, getCellPosition, getColumn, getColumn, getColumnPosition, getMinMax, getMinMax, getNumericColumn, getNumericRow, getNumericRow, split, split, split, uniqueValues
-
-
-
-
Method Detail
-
getNumericColumns
public static int[] getNumericColumns(Dataset data)
Determines the numeric columns in a dataset.- Parameters:
data
- the dataset to inspect- Returns:
- the indices of the numeric columns
-
numericToJama
public static Jama.Matrix numericToJama(Dataset data)
Turns all the numeric columns into a Jama Matrix.- Parameters:
data
- the data to convert- Returns:
- the generated matrix
-
numericToJama
public static Jama.Matrix numericToJama(Dataset data, int[] cols)
Turns the specified numeric columns into a Jama Matrix.- Parameters:
data
- the data to convertcols
- the numeric columns to use- Returns:
- the generated matrix
-
numericToMatrixAlgo
public static com.github.waikatodatamining.matrix.core.Matrix numericToMatrixAlgo(Dataset data)
Turns all the numeric columns into a Jama Matrix.- Parameters:
data
- the data to convert- Returns:
- the generated matrix
-
numericToMatrixAlgo
public static com.github.waikatodatamining.matrix.core.Matrix numericToMatrixAlgo(Dataset data, int[] cols)
Turns the specified numeric columns into a Jama Matrix.- Parameters:
data
- the data to convertcols
- the numeric columns to use- Returns:
- the generated matrix
-
numericToArrays
public static List<double[]> numericToArrays(Dataset data)
Turns all the numeric columns into a list of double arrays.- Parameters:
data
- the data to convert- Returns:
- the generated arrays
-
numericToArrays
public static List<double[]> numericToArrays(Dataset data, int[] cols)
Turns the specified numeric columns into a list of double arrays.- Parameters:
data
- the data to convertcols
- the numeric columns to use- Returns:
- the generated arrays
-
matrixAlgoToSpreadSheet
public static SpreadSheet matrixAlgoToSpreadSheet(com.github.waikatodatamining.matrix.core.Matrix data, String colPrefix)
Returns the matrix as spreadsheet.- Parameters:
data
- the matrix to convertcolPrefix
- the prefix for the columns- Returns:
- the generated spreadsheet
-
-