Skip to content

Commit

Permalink
GH-15809: add dispersion_estimated parameter to GLM mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
syzonyuliia-h2o authored and wendycwong committed Feb 5, 2024
1 parent 25ba898 commit db5463a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions h2o-algos/src/main/java/hex/glm/GLMMojoWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ protected void writeModelData() throws IOException {

if (GLMModel.GLMParameters.Family.tweedie.equals(model._parms._family))
writekv("tweedie_link_power", model._parms._tweedie_link_power);

writekv("dispersion_estimated", model._parms._compute_p_values ? model._parms._dispersion_estimated : 0);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public abstract class GlmMojoModelBase extends MojoModel {

String _family;
boolean _versionSupportOffset;

double _dispersion_estimated;

GlmMojoModelBase(String[] columns, String[][] domains, String responseColumn) {
super(columns, domains, responseColumn);
Expand All @@ -26,6 +28,10 @@ public abstract class GlmMojoModelBase extends MojoModel {
public double[] getBeta() {
return _beta;
}

public double getDispersionEstimated() {
return _dispersion_estimated;
}

void init() {
_versionSupportOffset = _mojo_version >= 1.1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ protected void readModelData() throws IOException {

_model._beta = readkv("beta");
_model._family = readkv("family");
_model._dispersion_estimated = readkv("dispersion_estimated");

if (_model instanceof GlmMojoModel) {
GlmMojoModel m = (GlmMojoModel) _model;
Expand Down

0 comments on commit db5463a

Please sign in to comment.