All Downloads are FREE. Search and download functionalities are using the official Maven repository.

maths.functions.regularizers.RidgeRegularizer Maven / Gradle / Ivy

The newest version!
package maths.functions.regularizers;

import datastructs.IVector;
import maths.functions.IRegularizerFunction;
import maths.functions.IVectorRealFunction;

public class RidgeRegularizer implements IRegularizerFunction {

    /**
     * Constructor.
     */
    public RidgeRegularizer(double lambda, int start_coeffs, IVectorRealFunction> hypothesis){

        this.start_coeffs = start_coeffs;
        this.lambda = lambda;
        this.hypothesis = hypothesis;
    }

    /**
     * Returns the value of the regularizer
     */
    @Override
    public Double evaluate(Void input){


        IVector coeffs = hypothesis.getCoeffs();

        if(coeffs == null){
            throw new IllegalStateException("Hypothesis coefficients are null");
        }

        double sum = 0.0;

        for(int c=start_coeffs; c> hypothesis;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy