commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Herbert <alex.d.herb...@gmail.com>
Subject Re: [statistics] Proposed OLS grammar
Date Thu, 18 Jul 2019 23:20:08 GMT


> On 18 Jul 2019, at 23:49, Eric Barnhill <ericbarnhill@gmail.com> wrote:
> 
> I suggested the following grammar to aim for in our meeting today with the
> developing OLS module. If you see anything you'd prefer to change let's
> establish it now , if anyone doesn't like it later, it's on me.
> 
> RegressionData data = RegressionDataLoader.of(double[][] y, double[] x);

Maybe:

RegressionData data = Regressions.newRegressionData(double[][] y, double[] x);
RegressionData data = Regressions.newData(double[][] y, double[] x);

?

Note that the idea that either the x or y of the RegressionData may want to be changed was
also raised. This could use a Builder pattern:

RegressionData data = Regressions.newDataBuilder()
                                 .setY(double[][] y)
                                 .setX(double[] x)
                                 .build();

Or some variant of. Something for the future.


> Regression ols = new OLSRegression();
> RegressionResults results = ols.regress(data);
> betas = results.getBetas() ;
> 
> where:
> RegressionData is an interface
> RegressionDataLoader is a factory class and of() a (possibly overloaded)
> static method
> Regression is an interface, implemented by OLSRegression
> RegressionResults is an interface, the specific class returned is
> OLSResults which implements it.
> betas are the intercept and slopes of the regression model
> 
> I think this preserves abstraction at the levels desired, since we will
> want in future flexibility as to regression type, posslble state parameters
> set on the regression object, and results contents and format. But also
> doesn't take on any unnecessary abstractions.
> 
> Eric




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message