com.datumbox.framework.core.common.dataobjects
Class DataframeMatrix
- java.lang.Object
-
- com.datumbox.framework.core.common.dataobjects.DataframeMatrix
-
public class DataframeMatrix extends java.lang.ObjectThe DataframeMatrix class is responsible for converting a Dataframe object to a Matrix representation. Some of the methods on framework require working with matrices and this class provides the tools to achieve the necessary conversions.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description org.apache.commons.math3.linear.RealMatrixgetX()Getter for the X Matrix which contains the data of the Dataframe.org.apache.commons.math3.linear.RealVectorgetY()Getter for the Y vector with the values of the response variables.static DataframeMatrixnewInstance(Dataframe dataset, boolean addConstantColumn, java.util.Map<java.lang.Integer,java.lang.Integer> recordIdsReference, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)Method used to generate a training Dataframe to a DataframeMatrix and extracts its contents to Matrixes.static DataframeMatrixparseDataset(Dataframe newData, java.util.Map<java.lang.Integer,java.lang.Integer> recordIdsReference, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)Parses a testing dataset and converts it to DataframeMatrix by using an already existing mapping between feature names and column ids.static org.apache.commons.math3.linear.RealVectorparseRecord(Record r, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)Parses a single Record and converts it to RealVector by using an already existing mapping between feature names and column ids.
-
-
-
Method Detail
-
getX
public org.apache.commons.math3.linear.RealMatrix getX()
Getter for the X Matrix which contains the data of the Dataframe.- Returns:
-
getY
public org.apache.commons.math3.linear.RealVector getY()
Getter for the Y vector with the values of the response variables.- Returns:
-
newInstance
public static DataframeMatrix newInstance(Dataframe dataset, boolean addConstantColumn, java.util.Map<java.lang.Integer,java.lang.Integer> recordIdsReference, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)
Method used to generate a training Dataframe to a DataframeMatrix and extracts its contents to Matrixes. It populates the featureIdsReference map with the mappings between the feature names and the column ids of the matrix. Typically used to convert the training dataset.- Parameters:
dataset-addConstantColumn-recordIdsReference-featureIdsReference-- Returns:
-
parseDataset
public static DataframeMatrix parseDataset(Dataframe newData, java.util.Map<java.lang.Integer,java.lang.Integer> recordIdsReference, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)
Parses a testing dataset and converts it to DataframeMatrix by using an already existing mapping between feature names and column ids. Typically used to parse the testing or validation dataset.- Parameters:
newData-recordIdsReference-featureIdsReference-- Returns:
-
parseRecord
public static org.apache.commons.math3.linear.RealVector parseRecord(Record r, java.util.Map<java.lang.Object,java.lang.Integer> featureIdsReference)
Parses a single Record and converts it to RealVector by using an already existing mapping between feature names and column ids.- Parameters:
r-featureIdsReference-- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG