2017-01-27 8 views
0

saveメソッドを使用して、PipelineModelをhdfsに保存する簡単な操作を実行しようとしています。 私は私のコードはかなりシンプルで、json4s PipelineModelを保存しようとしたときにNoSuchMethodError

import org.apache.spark.ml._ 
import org.apache.spark.ml.feature._ 
import org.scalatest.FunSuite 


class Foo extends FunSuite { 

... create spark context/session/sql context somewhere ... 

    test("bar") { 
     import sqlContext.implicits._ 
     val df = sparkContext.parallelize(
     (1, 4, "TH") :: 
     (2, 5, "TH") :: 
     (3, 6, "TH") :: 
     (4, 7, "TH") :: 
     (5, 8, "US") :: 
     (6, 9, "US") :: Nil).toDF("id", "x", "a") 

     val tr0 = new StringIndexer().setInputCol("a").setOutputCol("a_ind") 
     val tr1 = new OneHotEncoder().setInputCol("a_ind").setOutputCol("a_vec").setDropLast(false) 
     val tr2 = new PolynomialExpansion().setDegree(3).setInputCol("x").setOutputCol("x_vec") 
     val tr3 = new VectorAssembler().setInputCols(Array("x_vec", "a_vec")) 
     val pipe = new Pipeline().setStages(Array(tr0, tr1, tr2, tr3)).fit(df) 

     pipe.write.overwrite().save("/tmp/foobar") 
    } 

} 
org.apache.spark.ml.utilのみ spark.ml PipelineStageの パッケージを使用しようと

see here)スパーク自身の例を実行しようとした場合でも、次の例外を取得

例外メッセージは、次のとおりです。これは関係なく、あなたが作成しようとするものパイプラインの繰り返し実行

org.json4s.Formats.emptyValueStrategy()Lorg/json4s/prefs/EmptyValueStrategy; 
java.lang.NoSuchMethodError: org.json4s.Formats.emptyValueStrategy()Lorg/json4s/prefs/EmptyValueStrategy; 

、それはに関連している可能性が? 何が起こっているのですか?

+0

問題が解決され、何らかの理由でjson4sバージョン3.2.11が使用されませんでした。一度それがすべて修正された固定されています。 –

答えて

0

問題を解決し、何らかの理由でjson4sバージョン3.2.11が使用されませんでした。一度それがすべて修正された固定されています。 -

関連する問題