-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathRandomCutTreeTest.scala
More file actions
30 lines (24 loc) · 934 Bytes
/
RandomCutTreeTest.scala
File metadata and controls
30 lines (24 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Wei Chen - Random Cut Tree Test
// 2022-03-05
import com.scalaml.TestData._
import com.scalaml.general.MatrixFunc._
import com.scalaml.algorithm.RandomCutTree
import org.scalatest.funsuite.AnyFunSuite
class RandomCutTreeSuite extends AnyFunSuite {
val rctree = new RandomCutTree()
test("RandomCutTree Test : Clear") {
assert(rctree.clear())
}
test("RandomCutTree Test : Abnormal Large Data") {
assert(rctree.clear())
assert(rctree.config(Map[String, Double]()))
assert(rctree.train(UNLABELED_LARGE_DATA))
val result = rctree.predict(UNLABELED_LARGE_DATA)
assert(arraysimilar(result, UNLABELED_LARGE_DATA.map(_ => 1.0), UNLABELED_NONLINEAR_DATA.size))
}
test("RandomCutTree Test : Invalid Data") {
assert(rctree.clear())
assert(!rctree.config(Map("maxLayer" -> "test")))
assert(!rctree.train(Array(Array(1, 2), Array())))
}
}