@@ -2,10 +2,7 @@ package io.github.metarank.ltrlib.booster
22
33import ai .catboost .CatBoostModel
44import better .files .File
5- import io .circe .Decoder
65import io .github .metarank .ltrlib .booster .Booster .BoosterFactory
7- import io .circe .generic .semiauto ._
8- import io .github .metarank .ltrlib .booster .CatboostBooster .CatTrainJson .{Iteration , Meta }
96import io .github .metarank .ltrlib .output .LibSVMOutputFormat
107import ru .yandex .catboost .spark .catboost4j_spark .core .src .native_impl .{TVector_TString , native_impl }
118
@@ -44,27 +41,6 @@ case class CatboostBooster(booster: CatBoostModel, bytes: Array[Byte]) extends B
4441
4542object CatboostBooster extends BoosterFactory [String , CatboostBooster , CatboostOptions ] {
4643
47- case class CatTrainJson (meta : Meta , iterations : List [Iteration ])
48-
49- object CatTrainJson {
50- case class Meta (test_sets : List [String ], test_metrics : List [TestMetric ], learn_metrics : List [TestMetric ])
51-
52- case class TestMetric (best_value : String , name : String )
53-
54- case class Iteration (
55- learn : List [Double ],
56- passed_time : Double ,
57- remaining_time : Double ,
58- iteration : Int ,
59- test : List [Double ]
60- )
61-
62- implicit val metaDecoder : Decoder [Meta ] = deriveDecoder[Meta ]
63- implicit val tmDecoder : Decoder [TestMetric ] = deriveDecoder[TestMetric ]
64- implicit val itDecoder : Decoder [Iteration ] = deriveDecoder[Iteration ]
65- implicit val ctDecoder : Decoder [CatTrainJson ] = deriveDecoder[CatTrainJson ]
66- }
67-
6844 override def apply (string : Array [Byte ]): CatboostBooster = {
6945 val cb = CatBoostModel .loadModel(new ByteArrayInputStream (string))
7046 CatboostBooster (cb, string)
0 commit comments