|
1 | 1 | /*
|
2 |
| - Copyright (c) 2014-2022 by Contributors |
| 2 | + Copyright (c) 2014-2024 by Contributors |
3 | 3 |
|
4 | 4 | Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | you may not use this file except in compliance with the License.
|
@@ -432,28 +432,29 @@ class XGBoostClassifierSuite extends AnyFunSuite with PerTest with TmpFolderPerS
|
432 | 432 | val xgb = new XGBoostClassifier(paramMap)
|
433 | 433 | val model = xgb.fit(trainingDF)
|
434 | 434 |
|
| 435 | + // test json |
435 | 436 | val modelPath = new File(tempDir.toFile, "xgbc").getPath
|
436 | 437 | model.write.option("format", "json").save(modelPath)
|
437 | 438 | val nativeJsonModelPath = new File(tempDir.toFile, "nativeModel.json").getPath
|
438 | 439 | model.nativeBooster.saveModel(nativeJsonModelPath)
|
439 | 440 | assert(compareTwoFiles(new File(modelPath, "data/XGBoostClassificationModel").getPath,
|
440 | 441 | nativeJsonModelPath))
|
441 | 442 |
|
442 |
| - // test default "deprecated" |
| 443 | + // test ubj |
443 | 444 | val modelUbjPath = new File(tempDir.toFile, "xgbcUbj").getPath
|
444 | 445 | model.write.save(modelUbjPath)
|
445 |
| - val nativeDeprecatedModelPath = new File(tempDir.toFile, "nativeModel").getPath |
446 |
| - model.nativeBooster.saveModel(nativeDeprecatedModelPath) |
| 446 | + val nativeUbjModelPath = new File(tempDir.toFile, "nativeModel.ubj").getPath |
| 447 | + model.nativeBooster.saveModel(nativeUbjModelPath) |
447 | 448 | assert(compareTwoFiles(new File(modelUbjPath, "data/XGBoostClassificationModel").getPath,
|
448 |
| - nativeDeprecatedModelPath)) |
| 449 | + nativeUbjModelPath)) |
449 | 450 |
|
450 | 451 | // json file should be indifferent with ubj file
|
451 | 452 | val modelJsonPath = new File(tempDir.toFile, "xgbcJson").getPath
|
452 | 453 | model.write.option("format", "json").save(modelJsonPath)
|
453 |
| - val nativeUbjModelPath = new File(tempDir.toFile, "nativeModel1.ubj").getPath |
454 |
| - model.nativeBooster.saveModel(nativeUbjModelPath) |
| 454 | + val nativeUbjModelPath1 = new File(tempDir.toFile, "nativeModel1.ubj").getPath |
| 455 | + model.nativeBooster.saveModel(nativeUbjModelPath1) |
455 | 456 | assert(!compareTwoFiles(new File(modelJsonPath, "data/XGBoostClassificationModel").getPath,
|
456 |
| - nativeUbjModelPath)) |
| 457 | + nativeUbjModelPath1)) |
457 | 458 | }
|
458 | 459 |
|
459 | 460 | test("native json model file should store feature_name and feature_type") {
|
|
0 commit comments