source: src/main/java/agents/anac/y2019/harddealer/math3/stat/regression/UpdatingMultipleLinearRegression.java

Last change on this file was 204, checked in by Katsuhide Fujita, 5 years ago

Fixed errors of ANAC2019 agents

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package agents.anac.y2019.harddealer.math3.stat.regression;
18
19import agents.anac.y2019.harddealer.math3.exception.MathIllegalArgumentException;
20import agents.anac.y2019.harddealer.math3.exception.NoDataException;
21
22/**
23 * An interface for regression models allowing for dynamic updating of the data.
24 * That is, the entire data set need not be loaded into memory. As observations
25 * become available, they can be added to the regression model and an updated
26 * estimate regression statistics can be calculated.
27 *
28 * @since 3.0
29 */
30public interface UpdatingMultipleLinearRegression {
31
32 /**
33 * Returns true if a constant has been included false otherwise.
34 *
35 * @return true if constant exists, false otherwise
36 */
37 boolean hasIntercept();
38
39 /**
40 * Returns the number of observations added to the regression model.
41 *
42 * @return Number of observations
43 */
44 long getN();
45
46 /**
47 * Adds one observation to the regression model.
48 *
49 * @param x the independent variables which form the design matrix
50 * @param y the dependent or response variable
51 * @throws ModelSpecificationException if the length of {@code x} does not equal
52 * the number of independent variables in the model
53 */
54 void addObservation(double[] x, double y) throws ModelSpecificationException;
55
56 /**
57 * Adds a series of observations to the regression model. The lengths of
58 * x and y must be the same and x must be rectangular.
59 *
60 * @param x a series of observations on the independent variables
61 * @param y a series of observations on the dependent variable
62 * The length of x and y must be the same
63 * @throws ModelSpecificationException if {@code x} is not rectangular, does not match
64 * the length of {@code y} or does not contain sufficient data to estimate the model
65 */
66 void addObservations(double[][] x, double[] y) throws ModelSpecificationException;
67
68 /**
69 * Clears internal buffers and resets the regression model. This means all
70 * data and derived values are initialized
71 */
72 void clear();
73
74
75 /**
76 * Performs a regression on data present in buffers and outputs a RegressionResults object
77 * @return RegressionResults acts as a container of regression output
78 * @throws ModelSpecificationException if the model is not correctly specified
79 * @throws NoDataException if there is not sufficient data in the model to
80 * estimate the regression parameters
81 */
82 RegressionResults regress() throws ModelSpecificationException, NoDataException;
83
84 /**
85 * Performs a regression on data present in buffers including only regressors
86 * indexed in variablesToInclude and outputs a RegressionResults object
87 * @param variablesToInclude an array of indices of regressors to include
88 * @return RegressionResults acts as a container of regression output
89 * @throws ModelSpecificationException if the model is not correctly specified
90 * @throws MathIllegalArgumentException if the variablesToInclude array is null or zero length
91 */
92 RegressionResults regress(int[] variablesToInclude) throws ModelSpecificationException, MathIllegalArgumentException;
93}
Note: See TracBrowser for help on using the repository browser.