Search in sources :

Example 1 with FunctionVector

use of org.apache.ignite.ml.math.impls.vector.FunctionVector in project ignite by apache.

the class LinearRegressionQRTrainer method extractInputs.

/**
 * Extracts all inputs from data set matrix and updates matrix so that first column contains value 1.0.
 *
 * @param data data to build model
 * @return Inputs matrix
 */
private Matrix extractInputs(Matrix data) {
    data = data.copy();
    data.assignColumn(0, new FunctionVector(data.rowSize(), row -> 1.0));
    return data;
}
Also used : Trainer(org.apache.ignite.ml.Trainer) FunctionVector(org.apache.ignite.ml.math.impls.vector.FunctionVector) Vector(org.apache.ignite.ml.math.Vector) Matrix(org.apache.ignite.ml.math.Matrix) QRDecomposition(org.apache.ignite.ml.math.decompositions.QRDecomposition) QRDSolver(org.apache.ignite.ml.math.decompositions.QRDSolver) FunctionVector(org.apache.ignite.ml.math.impls.vector.FunctionVector)

Example 2 with FunctionVector

use of org.apache.ignite.ml.math.impls.vector.FunctionVector in project ignite by apache.

the class GradientDescent method extractInputs.

/**
 * Extracts all inputs from data set matrix and updates matrix so that first column contains value 1.0.
 *
 * @param data data to build model
 * @return Inputs matrix
 */
private Matrix extractInputs(Matrix data) {
    data = data.copy();
    data.assignColumn(0, new FunctionVector(data.rowSize(), row -> 1.0));
    return data;
}
Also used : FunctionVector(org.apache.ignite.ml.math.impls.vector.FunctionVector) SparseDistributedMatrixMapReducer(org.apache.ignite.ml.optimization.util.SparseDistributedMatrixMapReducer) Vector(org.apache.ignite.ml.math.Vector) IgniteFunction(org.apache.ignite.ml.math.functions.IgniteFunction) Matrix(org.apache.ignite.ml.math.Matrix) SparseDistributedMatrix(org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix) StorageConstants(org.apache.ignite.ml.math.StorageConstants) DenseLocalOnHeapVector(org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector) FunctionVector(org.apache.ignite.ml.math.impls.vector.FunctionVector)

Aggregations

Matrix (org.apache.ignite.ml.math.Matrix)2 Vector (org.apache.ignite.ml.math.Vector)2 FunctionVector (org.apache.ignite.ml.math.impls.vector.FunctionVector)2 Trainer (org.apache.ignite.ml.Trainer)1 StorageConstants (org.apache.ignite.ml.math.StorageConstants)1 QRDSolver (org.apache.ignite.ml.math.decompositions.QRDSolver)1 QRDecomposition (org.apache.ignite.ml.math.decompositions.QRDecomposition)1 IgniteFunction (org.apache.ignite.ml.math.functions.IgniteFunction)1 SparseDistributedMatrix (org.apache.ignite.ml.math.impls.matrix.SparseDistributedMatrix)1 DenseLocalOnHeapVector (org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector)1 SparseDistributedMatrixMapReducer (org.apache.ignite.ml.optimization.util.SparseDistributedMatrixMapReducer)1