https://www.baeldung.com/java-inner-interfaces
interface Regression { interface Data { // ... } interface Result { // ... } } Le ven. 19 juil. 2019 à 01:20, Alex Herbert <alex.d.herb...@gmail.com> a écrit : > > > > > On 18 Jul 2019, at 23:49, Eric Barnhill <ericbarnh...@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 > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org