@@ -244,16 +244,14 @@ def __init__( self , * ,
244244 self .__norm_factor = numpy .float32 ( 1.0 )
245245 self .__mode = None
246246 self .__scale_factors = {}
247-
248247
249- n_features = num_features ( targer )
248+ n_features = num_features ( target )
249+ n_rows = num_samples ( target ) + num_samples ( original )
250+ data_size = n_rows * n_features
251+ K = 200000
252+
250253 n_jobs = num_jobs ( params )
251-
252- ##
253- if 100 < n_features : n_jobs = min ( 16 , n_jobs )
254- elif 20 < n_features : n_jobs = min ( 8 , n_jobs )
255- elif 10 < n_features : n_jobs = min ( 4 , n_jobs )
256- else : n_jobs = min ( 2 , n_jobs )
254+ n_jobs = min ( n_jobs , max ( 1 , math .floor ( data_size / K ) ) )
257255 ##
258256 params [ 'n_jobs' ] = n_jobs
259257
@@ -1216,7 +1214,7 @@ def _train_single_model ( self,
12161214
12171215 # Destroy heavy training DMatrix objects and training C++ booster instance
12181216 del dtrain , dval , model ,
1219- del X_tr , y_tr , w_tr , X_v , Y_v , w_v
1217+ del X_tr , y_tr , w_tr , X_v , y_v , w_v
12201218
12211219 # Re-instantiate clean C++ booster dedicated strictly to inference
12221220 model = XGBoost .Booster ()
@@ -1402,7 +1400,7 @@ def _train_single_model ( self ,
14021400 verbose_level = params .get ('verbose' , False )
14031401 model .fit ( trn_pool , verbose = verbose_level , ** fit_kwargs )
14041402
1405- import gc , pickle
1403+ import pickle
14061404 from ostap .utils .memory import memory
14071405
14081406 with memory ( 'MEMORY CATBOOST' , logger = logger ) :
@@ -1411,7 +1409,7 @@ def _train_single_model ( self ,
14111409 model_bytes = pickle .dumps ( model )
14121410
14131411 # Destroy training pools and heavy training model instance
1414- del trn_pool , val_pool , model , X_tr , y_tr , w_tr , X_va , y_va , w_va
1412+ del trn_pool , val_pool , model , X_tr , y_tr , w_tr , X_v , y_v , w_v
14151413
14161414 # Re-instantiate clean, standalone inference engine
14171415 model = pickle .loads ( model_bytes )
0 commit comments