2016-09-08 3 views
0

Ich lerne Spark und ich benutze CrossValidator. Mein Code ist:Pyspark Änderung Typ DF von Double zu Int

# Let's just reuse our CrossValidator with the new dtPipeline, RegressionEvaluator regEval, and 3 fold cross validation 
crossval.setEstimator(dtPipeline) 

# Let's tune over our dt.maxDepth parameter on the values 2 and 3, create a paramter grid using the ParamGridBuilder 
paramGrid = ParamGridBuilder().addGrid(dt.maxDepth, [2.0, 3.0]).build() 

# Add the grid to the CrossValidator 
crossval.setEstimatorParamMaps(paramGrid) 

# Now let's find and return the best model 
dtModel = crossval.fit(trainingSetDF).bestModel 

Wenn ich es kompilieren ich habe diesen Fehler:

java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer 

Weiß jemand, wie es zu lösen?

Antwort

0

Ich löste es! Das Attribut maxDepth muss integer sein, also haben wir in der Funktion addGrig [2.0, 3.0] für [2, 3].

Verwandte Themen