Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Commit

Permalink
better coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrenodet committed Jul 27, 2019
1 parent 8a81347 commit 4c1ad1a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/scala/org/apache/spark/smile/ImplicitSuite.scala
Expand Up @@ -5,6 +5,7 @@ import org.scalatest.FunSuite
import smile.classification.knn
import smile.data._
import smile.validation.{Accuracy, ClassificationMeasure, _}
import org.apache.spark.sql.functions._

class ImplicitSuite extends FunSuite with DatasetSuiteBase {

Expand All @@ -22,4 +23,18 @@ class ImplicitSuite extends FunSuite with DatasetSuiteBase {

}

test("toSmileDataset with weights") {

import org.apache.spark.smile.implicits._

val mushrooms = spark.read.format("libsvm").load("data/mushrooms.svm").withColumn("weight",lit(1.0))

val (x,y) = mushrooms.toSmileDataset().unzipInt

val res = cv(x, y, 5, Seq(new Accuracy().asInstanceOf[ClassificationMeasure]): _*) { (x, y) => knn(x, y, 3) }

assert(res(0) == 1)

}

}

0 comments on commit 4c1ad1a

Please sign in to comment.