All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hydrosphere.spark_ml_serving.SpecificTransformerConversions.scala Maven / Gradle / Ivy

There is a newer version: 0.3.3
Show newest version
package io.hydrosphere.spark_ml_serving

import io.hydrosphere.spark_ml_serving.classification._
import io.hydrosphere.spark_ml_serving.common.LocalTransformer
import io.hydrosphere.spark_ml_serving.preprocessors.LocalWord2VecModel
import org.apache.spark.ml.Transformer
import org.apache.spark.ml.classification._
import org.apache.spark.ml.feature.Word2VecModel

object SpecificTransformerConversions extends DynamicTransformerConverter {

  implicit def transformerToLocal(transformer: Transformer): LocalTransformer[_] = {
    transformer match {
      case x: LogisticRegressionModel => new LocalLogisticRegressionModel(x)
      case x: Word2VecModel           => new LocalWord2VecModel(x)

      case x => throw new Exception(s"Unknown model: ${x.getClass}")
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy