MCPcopy Create free account
hub / github.com/catboost/catboost / check_save_quantized_pool

Function check_save_quantized_pool

catboost/python-package/ut/medium/test.py:8795–8818  ·  view source on GitHub ↗
(train_pool, train_pool_copy, test_pool, params)

Source from the content-addressed store, hash-verified

8793
8794
8795def check_save_quantized_pool(train_pool, train_pool_copy, test_pool, params):
8796 feature_names = train_pool.get_feature_names()
8797
8798 train_quantized_pool = train_pool_copy
8799 train_quantized_pool.quantize()
8800
8801 assert (train_quantized_pool.is_quantized())
8802
8803 train_quantized_pool.save(OUTPUT_QUANTIZED_POOL_PATH)
8804
8805 train_quantized_load_pool = Pool(get_quantized_path(OUTPUT_QUANTIZED_POOL_PATH))
8806
8807 model = CatBoost(params=params)
8808 model_fitted_with_load_quantized_pool = CatBoost(params=params)
8809
8810 model.fit(train_pool)
8811 predictions1 = model.predict(test_pool)
8812
8813 model_fitted_with_load_quantized_pool.fit(train_quantized_load_pool)
8814 predictions2 = model_fitted_with_load_quantized_pool.predict(test_pool)
8815
8816 loaded_feature_names = train_quantized_load_pool.get_feature_names()
8817 assert (feature_names == loaded_feature_names)
8818 assert all(predictions1 == predictions2)
8819
8820
8821FEATURES_TYPES = ['num', 'cat', 'num_and_cat']

Calls 8

fitMethod · 0.95
predictMethod · 0.95
PoolClass · 0.90
CatBoostClass · 0.90
get_quantized_pathFunction · 0.85
quantizeMethod · 0.80
allFunction · 0.50
saveMethod · 0.45

Tested by

no test coverage detected