Skip to content

Commit

Permalink
[SW-2573] Fix interactionConstraints on H2OXGBoostMOJOModel in Python…
Browse files Browse the repository at this point in the history
… API (#2554)

(cherry picked from commit dc35e1f)

# Conflicts:
#	py/tests/unit/with_runtime_sparkling/test_mojo_parameters.py
  • Loading branch information
mn-mikke committed Jul 28, 2021
1 parent 63df071 commit 5ab43ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Expand Up @@ -73,6 +73,7 @@ object MOJOModelTemplate
}

private def generateValueConversion(parameter: Parameter): String = parameter.dataType match {
case x if x.isArray && x.getComponentType.isArray() => "H2OTypeConverters.scala2DArrayToPython2DArray(value)"
case x if x.isArray => "H2OTypeConverters.scalaArrayToPythonArray(value)"
case _ => "value"
}
Expand Down
Expand Up @@ -501,6 +501,15 @@ def scalaArrayToPythonArray(array):
else:
raise TypeError("Invalid type.")

@staticmethod
def scala2DArrayToPython2DArray(array):
if array is None:
return None
elif isinstance(array, JavaObject):
return [H2OTypeConverters.scalaArrayToPythonArray(v) for v in array]
else:
raise TypeError("Invalid type.")

@staticmethod
def scalaToPythonDataFrame(jdf):
if jdf is None:
Expand Down

0 comments on commit 5ab43ac

Please sign in to comment.