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

org.pepstock.charba.client.ml.PolynomialRegression Maven / Gradle / Ivy

/**
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
      http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
*/
package org.pepstock.charba.client.ml;

import java.util.List;

import org.pepstock.charba.client.commons.ArrayDouble;
import org.pepstock.charba.client.enums.RegressionType;

/**
 * Polynomial Regression is a regression algorithm that models the relationship between a dependent(y) and independent variable(x) as nth degree polynomial.
* The Polynomial Regression equation is given below:
*
* y = b0 + b1x1 + b2x12 + * b2x13 +...... bnx1n
* * @author Andrea "Stock" Stocchero * */ public final class PolynomialRegression extends BasePolynomialRegression { /** * Default degree, {@value DEFAULT_DEGREE}. */ public static final int DEFAULT_DEGREE = 2; /** * Minimum degree, {@value MINIMUM_DEGREE}. */ static final int MINIMUM_DEGREE = 2; /** * Creates the polynomial regression object, using the passed regression descriptor. * * @param descriptor regression description used to create new regression */ PolynomialRegression(RegressionDescriptor descriptor) { super(RegressionType.POLYNOMIAL, NativePolynomialRegression.load(descriptor)); } /** * Creates the polynomial regression object, using the passed data to calculate the formula. * * @param x values bound to x * @param y values bound to y * @param degree the maximum degree of the polynomial */ PolynomialRegression(List x, List y, int degree) { super(RegressionType.POLYNOMIAL, new NativePolynomialRegression(ArrayDouble.fromOrEmpty(x), ArrayDouble.fromOrEmpty(y), degree)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy