unlock gil for calc_fstr
@@ -2432,12 +2432,16 @@ cdef class _CatBoost:
cdef TVector[TVector[double]] fstr
cdef TVector[TVector[TVector[double]]] fstr_multi
-
+ cdef TDataProviderPtr dataProviderPtr
+ if pool:
+ dataProviderPtr = pool.__pool
+ cdef TString fstr_type_name_str = TString(<const char*>fstr_type_name)
if fstr_type_name == b'ShapValues' and dereference(self.__model).ObliviousTrees.ApproxDimension > 1:
+ with nogil:
fstr_multi = GetFeatureImportancesMulti(
- TString(<const char*>fstr_type_name),
+ fstr_type_name_str,
dereference(self.__model),
- pool.__pool if pool else TDataProviderPtr(),
+ dataProviderPtr,
thread_count,
verbose
)
@@ -2447,10 +2451,11 @@ cdef class _CatBoost:
] for i in range(fstr_multi.size())
], native_feature_ids
else:
+ with nogil:
fstr = GetFeatureImportances(
- TString(<const char*>fstr_type_name),
+ fstr_type_name_str,
dereference(self.__model),
- pool.__pool if pool else TDataProviderPtr(),
+ dataProviderPtr,
thread_count,
verbose
)
