()
| 7146 | |
| 7147 | |
| 7148 | def test_model_metadata(): |
| 7149 | output_model_path = yatest.common.test_output_path('model.bin') |
| 7150 | output_eval_path = yatest.common.test_output_path('test.eval') |
| 7151 | |
| 7152 | cmd = ( |
| 7153 | '--loss-function', 'Logloss', |
| 7154 | '-f', data_file('adult', 'train_small'), |
| 7155 | '-t', data_file('adult', 'test_small'), |
| 7156 | '--column-description', data_file('adult', 'train.cd'), |
| 7157 | '-i', '2', |
| 7158 | '-T', '4', |
| 7159 | '-m', output_model_path, |
| 7160 | '--eval-file', output_eval_path, |
| 7161 | '-w', '0.1', |
| 7162 | '--set-metadata-from-freeargs', |
| 7163 | 'A', 'A', |
| 7164 | 'BBB', 'BBB', |
| 7165 | 'CCC', 'A' |
| 7166 | ) |
| 7167 | execute_catboost_fit('CPU', cmd) |
| 7168 | |
| 7169 | calc_cmd = ( |
| 7170 | CATBOOST_PATH, |
| 7171 | 'metadata', 'set', |
| 7172 | '-m', output_model_path, |
| 7173 | '--key', 'CCC', |
| 7174 | '--value', 'CCC' |
| 7175 | ) |
| 7176 | yatest.common.execute(calc_cmd) |
| 7177 | |
| 7178 | calc_cmd = ( |
| 7179 | CATBOOST_PATH, |
| 7180 | 'metadata', 'set', |
| 7181 | '-m', output_model_path, |
| 7182 | '--key', 'CCC', |
| 7183 | '--value', 'CCC' |
| 7184 | ) |
| 7185 | yatest.common.execute(calc_cmd) |
| 7186 | |
| 7187 | py_catboost = catboost.CatBoost() |
| 7188 | py_catboost.load_model(output_model_path) |
| 7189 | |
| 7190 | assert 'A' == py_catboost.get_metadata()['A'] |
| 7191 | assert 'BBB' == py_catboost.get_metadata()['BBB'] |
| 7192 | assert 'CCC' == py_catboost.get_metadata()['CCC'] |
| 7193 | |
| 7194 | |
| 7195 | def test_fit_multiclass_with_class_names(): |
nothing calls this directly
no test coverage detected