Ejemplo n.º 1
0
 def create_from_mojo(path_to_mojo):
     spark_session = SparkSession.builder.getOrCreate()
     # We need to make sure that Sparkling Water classes are available on the Spark driver and executor paths
     Initializer.load_sparkling_jar(spark_session._sc)
     return H2OMOJOModel(
         spark_session._jvm.org.apache.spark.ml.h2o.models.
         JavaH2OMOJOModelHelper.createFromMojo(path_to_mojo))
Ejemplo n.º 2
0
 def __init__(self, spark_session):
     """
      This constructor is used just to initialize the environment. It does not start H2OContext.
      To start H2OContext use one of the getOrCreate methods. This constructor is internally used in those methods
     """
     try:
         self.__do_init(spark_session)
         _monkey_patch_H2OFrame(self)
         # loads sparkling water jar only if it hasn't been already loaded
         Initializer.load_sparkling_jar(self._sc)
     except:
         raise
Ejemplo n.º 3
0
 def __init__(self, spark_session):
     """
      This constructor is used just to initialize the environment. It does not start H2OContext.
      To start H2OContext use one of the getOrCreate methods. This constructor is internally used in those methods
     """
     try:
         self.__do_init(spark_session)
         _monkey_patch_H2OFrame(self)
         # Load sparkling water jar only if it hasn't been already loaded
         Initializer.load_sparkling_jar(self._sc)
     except:
         raise
Ejemplo n.º 4
0
    def __init__(self, spark):
        try:
            spark_session = spark
            if isinstance(spark, SparkContext):
                warnings.warn("Method H2OContext.getOrCreate with argument of type SparkContext is deprecated and " +
                              "parameter of type SparkSession is preferred.")
                spark_session = SparkSession.builder.getOrCreate()

            Initializer.load_sparkling_jar(spark_session._sc)
            self._do_init(spark_session)
        except:
            raise
Ejemplo n.º 5
0
    def __init__(self, spark):
        try:
            spark_session = spark
            if isinstance(spark, SparkContext):
                warnings.warn("Method H2OContext.getOrCreate with argument of type SparkContext is deprecated and " +
                              "parameter of type SparkSession is preferred.")
                spark_session = SparkSession.builder.getOrCreate()

            Initializer.load_sparkling_jar(spark_session._sc)
            self._do_init(spark_session)
        except:
            raise
Ejemplo n.º 6
0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from pysparkling.ml.algos import *
from pysparkling.ml.algos.classification import *
from pysparkling.ml.algos.regression import *
from pysparkling.ml.features import *
from pysparkling.ml.models import *

__all__ = ["ColumnPruner", "H2OGBM", "H2ODeepLearning", "H2OAutoML", "H2OXGBoost", "H2OGLM", "H2OCoxPH", "H2OGAM", "H2OMOJOModel",
           "H2OSupervisedMOJOModel", "H2OTreeBasedSupervisedMOJOModel", "H2OUnsupervisedMOJOModel", "H2OCoxPHMOJOModel",
           "H2OTreeBasedUnsupervisedMOJOModel", "H2OMOJOPipelineModel", "H2OGridSearch", "H2OMOJOSettings", "H2OKMeans",
           "H2OTargetEncoder", "H2ODRF", "H2OAutoMLClassifier", "H2OGLMClassifier", "H2OGAMClassifier", "H2OGBMClassifier", "H2OXGBoostClassifier",
           "H2ODeepLearningClassifier", "H2ODRFClassifier", "H2OAutoMLRegressor", "H2OGLMRegressor", "H2OGBMRegressor",
           "H2OGAMRegressor", "H2OXGBoostRegressor", "H2ODeepLearningRegressor", "H2ODRFRegressor", "H2OBinaryModel",
           "H2OIsolationForest", "H2OKMeansMOJOModel", "H2OGLMMOJOModel", "H2OGAMMOJOModel", "H2OGBMMOJOModel", "H2OXGBoostMOJOModel",
           "H2ODeepLearningMOJOModel", "H2ODRFMOJOModel", "H2OIsolationForestMOJOModel", "H2OWord2Vec"]

from pysparkling.initializer import Initializer

Initializer.load_sparkling_jar()
Ejemplo n.º 7
0
 def __init__(self, spark_context):
     try:
         Initializer.load_sparkling_jar(spark_context)
         self._do_init(spark_context)
     except:
         raise