[jvm-packages] Clean external cache (#2181)
* add back train method but mark as deprecated * fix scalastyle error * change class to object in examples * fix compilation error * small fix for cleanExternalCache
This commit is contained in:
parent
8d8cbcc6db
commit
f08077606c
@ -17,9 +17,10 @@
|
||||
package ml.dmlc.xgboost4j.scala.spark
|
||||
|
||||
import org.apache.spark.{SparkConf, SparkContext}
|
||||
import org.scalatest.{BeforeAndAfterAll, FunSuite}
|
||||
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSuite}
|
||||
|
||||
trait SharedSparkContext extends FunSuite with BeforeAndAfterAll with Serializable {
|
||||
trait SharedSparkContext extends FunSuite with BeforeAndAfter with BeforeAndAfterAll
|
||||
with Serializable {
|
||||
|
||||
@transient protected implicit var sc: SparkContext = null
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
package ml.dmlc.xgboost4j.scala.spark
|
||||
|
||||
import java.io.File
|
||||
import java.io.{File, FileNotFoundException}
|
||||
|
||||
import scala.collection.mutable.ListBuffer
|
||||
import scala.io.Source
|
||||
@ -36,6 +36,10 @@ class XGBoostDFSuite extends SharedSparkContext with Utils {
|
||||
|
||||
private var trainingDF: DataFrame = null
|
||||
|
||||
after {
|
||||
cleanExternalCache("XGBoostDFSuite")
|
||||
}
|
||||
|
||||
private def buildTrainingDataframe(sparkContext: Option[SparkContext] = None): DataFrame = {
|
||||
if (trainingDF == null) {
|
||||
val rowList = loadLabelPoints(getClass.getResource("/agaricus.txt.train").getFile)
|
||||
@ -79,7 +83,6 @@ class XGBoostDFSuite extends SharedSparkContext with Utils {
|
||||
assert(predResultFromSeq(i)(j) === predResultsFromDF(i)(j + 1))
|
||||
}
|
||||
}
|
||||
cleanExternalCache("XGBoostDFSuite")
|
||||
}
|
||||
|
||||
test("test transformLeaf") {
|
||||
@ -125,7 +128,6 @@ class XGBoostDFSuite extends SharedSparkContext with Utils {
|
||||
assert(predictionDF.columns.contains("label") === true)
|
||||
assert(predictionDF.columns.contains("final_prediction") === true)
|
||||
predictionDF.show()
|
||||
cleanExternalCache("XGBoostDFSuite")
|
||||
}
|
||||
|
||||
test("test schema of XGBoostClassificationModel") {
|
||||
@ -164,7 +166,6 @@ class XGBoostDFSuite extends SharedSparkContext with Utils {
|
||||
assert(predictionDF.columns.contains("label") === true)
|
||||
assert(predictionDF.columns.contains("raw_prediction") === true)
|
||||
assert(predictionDF.columns.contains("final_prediction") === false)
|
||||
cleanExternalCache("XGBoostDFSuite")
|
||||
}
|
||||
|
||||
test("xgboost and spark parameters synchronize correctly") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user