Class LARS_LassoCoeffVectorApproximator

    • Constructor Detail

      • LARS_LassoCoeffVectorApproximator

        public LARS_LassoCoeffVectorApproximator​(double lambda,
                                                 LassoMode mode)
        Constructor
        Parameters:
        lambda - Depending on mode, lambda is used differently. If mode 1, then lambda min amount of correlation between a coefficient in A and signal b for the algorithm to proceed. If mode 2, max L1 norm of the coefficient vector.
        mode - What mode to use PENALTY or L1COEFF. See lambda for differences.
    • Method Detail

      • solve

        public void solve​(double[] b,
                          smile.math.matrix.DenseMatrix A,
                          double[] x)
                   throws VectorDimensionMismatch,
                          MatrixDimensionMismatch
        Computes a sparse vector x, such that b = Ax using the LARS algorithm.
        Specified by:
        solve in interface ISparseVectorApproximator
        Parameters:
        b - vector on LHS of equation, which is assumed to have mean 0.
        A - Matrix A to use in the solution, which is assumed to have had its columns normalized to have zero mean and unit l2 norm.
        x - vector to compute and return
        Throws:
        VectorDimensionMismatch - If there is some sort of internal error.
        MatrixDimensionMismatch
      • solve

        public void solve​(double[] b,
                          smile.math.matrix.DenseMatrix A,
                          smile.math.matrix.DenseMatrix AtA,
                          double[] x)
                   throws VectorDimensionMismatch,
                          MatrixDimensionMismatch
        Computes a sparse vector x, such that b = Ax using the LARS algorithm. Use this method when computing several vectors against the same matrix A to avoid computing AtA every method call.
        Specified by:
        solve in interface ISparseVectorApproximator
        Parameters:
        b - vector on LHS of equation, which is assumed to have mean 0.
        A - Matrix A to use in the solution, which is assumed to have had its columns normalized to have zero mean and unit l2 norm.
        AtA - The Gram Matrix of A used in the solution.
        x - vector to compute and return
        Throws:
        VectorDimensionMismatch - If there is some sort of internal error.
        MatrixDimensionMismatch