Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup imports #5741

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
# limitations under the License.
#

from pyspark.ml.param import *
from ai.h2o.sparkling.ml.models.H2OMOJOModelBase import H2OMOJOModelBase

import warnings


class H2OAlgorithmMOJOModelBase(H2OMOJOModelBase):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#

from ai.h2o.sparkling.Initializer import Initializer
from pyspark.ml.param import *
from pyspark.ml.util import _jvm


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#

from pyspark.ml.param import *
from pyspark.ml.util import JavaMLWritable
from pyspark.ml.wrapper import JavaModel
from ai.h2o.sparkling.ml.util.H2OJavaMLReadable import H2OJavaMLReadable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from ai.h2o.sparkling.Initializer import Initializer
from ai.h2o.sparkling.ml.models import H2OMOJOSettings
from ai.h2o.sparkling.ml.models.H2OAlgorithmMOJOModelBase import H2OAlgorithmMOJOModelBase
from pyspark.ml.param import *
from pyspark.ml.util import _jvm
from pyspark.sql.column import Column

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#

from pyspark.ml.param import *
from pyspark.ml.wrapper import JavaWrapper


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

from ai.h2o.sparkling.ml.params.H2OCommonParams import H2OCommonParams
from ai.h2o.sparkling.ml.params.H2OAlgorithmMOJOParams import H2OAlgorithmMOJOParams
from pyspark.ml.param import *
import warnings


class H2OAlgorithmCommonParams(H2OCommonParams, H2OAlgorithmMOJOParams):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from ai.h2o.sparkling.ml.params.H2OBaseMOJOParams import H2OBaseMOJOParams
from pyspark.ml.param import *
import warnings
from pyspark.ml.param import Param, Params


class H2OAlgorithmMOJOParams(H2OBaseMOJOParams):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

from pyspark.ml.param import *
from pyspark.ml.param import Param, Params
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from ai.h2o.sparkling.ml.params.HasInputCols import HasInputCols
from ai.h2o.sparkling.ml.params.HasOutputCol import HasOutputCol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#

from pyspark.ml.param import *
from ai.h2o.sparkling.ml.params.HasInputColsOnMOJO import HasInputColsOnMOJO
from ai.h2o.sparkling.ml.params.HasOutputColOnMOJO import HasOutputColOnMOJO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from ai.h2o.sparkling.ml.params.H2OAutoMLStoppingCriteriaParams import H2OAutoMLStoppingCriteriaParams
from ai.h2o.sparkling.ml.params.H2OCommonParams import H2OCommonParams
from ai.h2o.sparkling.ml.params.HasMonotoneConstraints import HasMonotoneConstraints
from pyspark.ml.param import *


class H2OAutoMLParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class H2OBaseMOJOParams(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ai.h2o.sparkling.ml.params.H2OBaseMOJOParams import H2OBaseMOJOParams
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from h2o.utils.typechecks import assert_is_type
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class H2OCommonParams(H2OBaseMOJOParams):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

from pyspark.ml.param import *
from pyspark.ml.param import Param, Params
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from ai.h2o.sparkling.ml.params.H2ODimReductionExtraParams import H2ODimReductionExtraParams

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#

from pyspark.ml.param import *
from ai.h2o.sparkling.ml.params.H2ODimReductionExtraParamsOnMOJO import H2ODimReductionExtraParamsOnMOJO


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ai.h2o.sparkling.ml.params.H2OGridSearchRandomDiscreteCriteriaParams import \
H2OGridSearchRandomDiscreteCriteriaParams
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class H2OGridSearchParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from ai.h2o.sparkling.H2ODataFrameConverters import H2ODataFrameConverters
from ai.h2o.sparkling.ml.metrics.H2OMetricsFactory import H2OMetricsFactory
from pyspark.ml.param import *


class H2OMOJOModelParams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class H2OTargetEncoderMOJOParams(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pyspark.ml.linalg import DenseVector, DenseMatrix
from pyspark.ml.param import TypeConverters
from pyspark.ml.util import _jvm
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql import DataFrame


class H2OTypeConverters(object):
Expand Down Expand Up @@ -228,7 +228,7 @@ def convert(value):

if TypeConverters._can_convert_to_list(valueForConversion):
valueForConversion = TypeConverters.toList(valueForConversion)
if all(map(lambda v: type(v) == bool, valueForConversion)):
if all(map(lambda v: isinstance(v, bool), valueForConversion)):
return [bool(v) for v in valueForConversion]
raise TypeError("Could not convert %s to list of booleans" % valueForConversion)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasBaseAlgorithms(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasBetaConstraints(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasBlendingDataFrame(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasCalibrationDataFrame(Params):
Expand Down
3 changes: 1 addition & 2 deletions py-scoring/src/ai/h2o/sparkling/ml/params/HasGamCols.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# limitations under the License.
#

from pyspark.ml.param import *

from pyspark.ml.param import Param, Params
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasIgnoredCols(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasInitialBiases(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasInitialWeights(Params):
Expand Down
2 changes: 1 addition & 1 deletion py-scoring/src/ai/h2o/sparkling/ml/params/HasInputCol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params

class HasInputCol(Params):
inputCol = Param(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasInputCols(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
# limitations under the License.
#

from pyspark.ml.param import *
import warnings

from pyspark.ml.param import Param, Params
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasLeaderboardDataFrame(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasLinearConstraints(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasLossByColNames(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasMonotoneConstraints(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasOutputCol(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasPlugValues(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasRandomCols(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasUserPoints(Params):
Expand Down
2 changes: 1 addition & 1 deletion py-scoring/src/ai/h2o/sparkling/ml/params/HasUserX.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasUserX(Params):
Expand Down
2 changes: 1 addition & 1 deletion py-scoring/src/ai/h2o/sparkling/ml/params/HasUserY.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
from pyspark.ml.param import Param, Params


class HasUserY(Params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# limitations under the License.
#

from pyspark.ml.param import *

from pyspark.ml.param import Param, Params
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters


Expand Down
5 changes: 3 additions & 2 deletions py-scoring/src/pysparkling/ml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# limitations under the License.
#

from pysparkling.ml.models import *

from pysparkling.initializer import Initializer


__all__ = ["H2OMOJOModel", "H2OSupervisedMOJOModel", "H2OTreeBasedSupervisedMOJOModel", "H2OUnsupervisedMOJOModel",
"H2OTreeBasedUnsupervisedMOJOModel", "H2OMOJOPipelineModel", "H2OMOJOSettings", "H2OBinaryModel",
Expand All @@ -24,6 +26,5 @@
"H2OExtendedIsolationForestMOJOModel", "H2OPCAMOJOModel", "H2OGLRMMOJOModel", "H2OCoxPHMOJOModel",
"H2ORuleFitMOJOModel", "H2OWord2VecMOJOModel"]

from pysparkling.initializer import Initializer

Initializer.load_sparkling_jar()
2 changes: 1 addition & 1 deletion py/src/ai/h2o/sparkling/ml/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ def fieldDeprecationWarning(kwargs, old, new=None):
@staticmethod
def __deprecationWarning(old, type, new=None):
if new is None:
warnings.warn("The {} '{}' is deprecated without replacement!".format(type, old, new))
warnings.warn("The {} '{}' is deprecated without replacement!".format(type, old))
else:
warnings.warn("The {} '{}' is deprecated. Use '{}' instead!".format(type, old, new))
Loading