Skip to content

Commit 29ea43d

Browse files
authored
[GH-5729] Update H2O to 3.46.0.2 (#5730)
* [GH-5729] Update H2O to 3.46.0.2 * [GH-5729] Add Linear constraints to GLM
1 parent 7d2b5d9 commit 29ea43d

File tree

4 files changed

+79
-2
lines changed

4 files changed

+79
-2
lines changed

api-generation/src/main/scala/ai/h2o/sparkling/api/generation/common/AlgorithmConfigurations.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,15 @@ class AlgorithmConfigurations extends MultipleAlgorithmsConfiguration {
8686
val calibrationDataFrame = ExplicitField("calibration_frame", "HasCalibrationDataFrame", null)
8787
val plugValues = ExplicitField("plug_values", "HasPlugValues", null)
8888
val betaConstraints = ExplicitField("beta_constraints", "HasBetaConstraints", null)
89+
val linearConstraints = ExplicitField("linear_constraints", "HasLinearConstraints", null)
8990
val userPoints = ExplicitField("user_points", "HasUserPoints", null)
9091
val randomCols = ExplicitField("random_columns", "HasRandomCols", null)
9192
val gamCols = ExplicitField("gam_columns", "HasGamCols", null, None, Some("HasGamColsOnMOJO"))
9293
val validationLabelCol = ExplicitField("validation_response_column", "HasValidationLabelCol", "label")
9394
val interactionPairs = ExplicitField("interaction_pairs", "HasInteractionPairs", null)
9495

9596
val xgboostFields = Seq(monotonicity, calibrationDataFrame, ignoredCols)
96-
val glmFields = Seq(randomCols, ignoredCols, plugValues, betaConstraints, interactionPairs)
97+
val glmFields = Seq(randomCols, ignoredCols, plugValues, betaConstraints, interactionPairs, linearConstraints)
9798
val gamFields = Seq(ignoredCols, betaConstraints, gamCols)
9899
val gbmFields = Seq(monotonicity, calibrationDataFrame, ignoredCols)
99100
val drfFields = Seq(calibrationDataFrame, ignoredCols)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ h2oMajorVersion=3.46.0
55
# Name of H2O major version
66
h2oMajorName=3.46.0
77
# H2O Build version, defined here to be overriden by -P option
8-
h2oBuild=1
8+
h2oBuild=2
99
# Version of Mojo Pipeline library
1010
mojoPipelineVersion=2.8.1
1111
# Defines whether to run tests with Driverless AI mojo pipelines
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
*/
17+
18+
package ai.h2o.sparkling.ml.params
19+
20+
import ai.h2o.sparkling.H2OFrame
21+
import ai.h2o.sparkling.utils.DataFrameSerializationWrappers._
22+
import org.apache.spark.sql.DataFrame
23+
24+
trait HasLinearConstraints extends H2OAlgoParamsBase with HasDataFrameSerializer {
25+
private val linearConstraints = new NullableDataFrameParam(
26+
this,
27+
"linearConstraints",
28+
"Data frame used to specify linear constraints involving more than one coefficients in standard form.")
29+
30+
setDefault(linearConstraints -> null)
31+
32+
def getLinearConstraints(): DataFrame = $(linearConstraints)
33+
34+
def setLinearConstraints(value: DataFrame): this.type = set(linearConstraints, toWrapper(value))
35+
36+
private[sparkling] def getLinearConstraintsParam(trainingFrame: H2OFrame): Map[String, Any] = {
37+
Map("linear_constraints" -> convertDataFrameToH2OFrameKey(getLinearConstraints()))
38+
}
39+
40+
override private[sparkling] def getSWtoH2OParamNameMap(): Map[String, String] = {
41+
super.getSWtoH2OParamNameMap() ++ Map("linearConstraints" -> "linear_constraints")
42+
}
43+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
#
17+
18+
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
19+
from pyspark.ml.param import *
20+
21+
22+
class HasLinearConstraints(Params):
23+
linearConstraints = Param(
24+
Params._dummy(),
25+
"linearConstraints",
26+
"Data frame used to specify linear constraints involving more than one coefficients in standard form.",
27+
H2OTypeConverters.toNullableDataFrame())
28+
29+
def getLinearConstraints(self):
30+
return self.getOrDefault(self.linearConstraints)
31+
32+
def setLinearConstraints(self, value):
33+
return self._set(linearConstraints=value)

0 commit comments

Comments
 (0)