index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
4,537
optbinning.binning.binning_process
fit_transform_disk
Fit the binning process according to the given training data on disk, then transform it and save to comma-separated values (csv) file. Parameters ---------- input_path : str Any valid string path to a file with extension .csv. output_path : str Any valid...
def fit_transform_disk(self, input_path, output_path, target, chunksize, metric=None, metric_special=0, metric_missing=0, show_digits=2, **kwargs): """Fit the binning process according to the given training data on disk, then transform it and save to comma-separated...
(self, input_path, output_path, target, chunksize, metric=None, metric_special=0, metric_missing=0, show_digits=2, **kwargs)
[ 0.018672185018658638, 0.004170496482402086, -0.015142399817705154, 0.002473665401339531, -0.026360729709267616, -0.01103996392339468, -0.028125623241066933, 0.019207283854484558, -0.0015137705486267805, -0.04952963441610336, 0.012973835691809654, -0.009566091001033783, 0.045361485332250595, ...
4,538
optbinning.binning.binning_process
get_binned_variable
Return optimal binning object for a given variable name. Parameters ---------- name : string The variable name.
def get_binned_variable(self, name): """Return optimal binning object for a given variable name. Parameters ---------- name : string The variable name. """ self._check_is_fitted() if not isinstance(name, str): raise TypeError("name must be a string.") if name in self.vari...
(self, name)
[ 0.06134362518787384, -0.029937466606497765, -0.05468326434493065, -0.03036441281437874, -0.020117703825235367, -0.01630934327840805, -0.056049492210149765, 0.0008106640307232738, 0.017675571143627167, -0.051984965801239014, -0.021313153207302094, 0.024592099711298943, -0.04682745784521103, ...
4,539
sklearn.utils._metadata_requests
get_metadata_routing
Get metadata routing of this object. Please check :ref:`User Guide <metadata_routing>` on how the routing mechanism works. Returns ------- routing : MetadataRequest A :class:`~sklearn.utils.metadata_routing.MetadataRequest` encapsulating routing informat...
def get_metadata_routing(self): """Get metadata routing of this object. Please check :ref:`User Guide <metadata_routing>` on how the routing mechanism works. Returns ------- routing : MetadataRequest A :class:`~sklearn.utils.metadata_routing.MetadataRequest` encapsulating routing...
(self)
[ 0.013692973181605339, 0.012813852168619633, -0.031612828373909, -0.06013541668653488, 0.03864579647779465, -0.005616605281829834, 0.0020412919111549854, 0.08063047379255295, 0.038077473640441895, 0.000966255902312696, -0.03363747149705887, 0.02164945937693119, 0.027794426307082176, -0.0070...
4,540
sklearn.base
get_params
Get parameters for this estimator. Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns ------- params : dict Parameter n...
def get_params(self, deep=True): """ Get parameters for this estimator. Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns ------- params : dict Parameter nam...
(self, deep=True)
[ 0.04388424754142761, -0.020006055012345314, -0.010159756988286972, -0.0001766087516443804, -0.03842637687921524, 0.006808511912822723, 0.01699131727218628, -0.04484306275844574, -0.015534655191004276, 0.07486136257648468, 0.012455382384359837, 0.007370894309133291, -0.03108774870634079, 0....
4,541
optbinning.binning.binning_process
get_support
Get a mask, or integer index, or names of the variables selected. Parameters ---------- indices : boolean (default=False) If True, the return value will be an array of integers, rather than a boolean mask. names : boolean (default=False) If True, the...
def get_support(self, indices=False, names=False): """Get a mask, or integer index, or names of the variables selected. Parameters ---------- indices : boolean (default=False) If True, the return value will be an array of integers, rather than a boolean mask. names : boolean (default...
(self, indices=False, names=False)
[ 0.03212897852063179, -0.05944475904107094, -0.014992938376963139, -0.025067279115319252, 0.009029138833284378, 0.02571723610162735, -0.01780356466770172, 0.02515511028468609, 0.04215940460562706, 0.03435991331934929, 0.0035440248902887106, -0.0016732013318687677, -0.021044569090008736, -0....
4,542
optbinning.binning.binning_process
information
Print overview information about the options settings and statistics. Parameters ---------- print_level : int (default=1) Level of details.
def information(self, print_level=1): """Print overview information about the options settings and statistics. Parameters ---------- print_level : int (default=1) Level of details. """ self._check_is_fitted() if not isinstance(print_level, numbers.Integral) or print_level < 0: ...
(self, print_level=1)
[ 0.025440223515033722, 0.011962542310357094, 0.02799481712281704, -0.01787334308028221, 0.08188792318105698, -0.015345176681876183, -0.027149157598614693, -0.094784215092659, -0.038547929376363754, -0.003019264666363597, -0.06307201832532883, -0.015477310866117477, -0.005369049962610006, -0...
4,543
optbinning.binning.binning_process
save
Save binning process to pickle file. Parameters ---------- path : str Pickle file path.
def save(self, path): """Save binning process to pickle file. Parameters ---------- path : str Pickle file path. """ if not isinstance(path, str): raise TypeError("path must be a string.") with open(path, "wb") as f: pickle.dump(self, f)
(self, path)
[ 0.061145175248384476, 0.00933731347322464, -0.0733880028128624, 0.0595242939889431, -0.011622066609561443, -0.06031749024987221, -0.07821616530418396, 0.06586987525224686, 0.028503376990556717, -0.04179805517196655, 0.025468533858656883, 0.017027879133820534, -0.000662794045638293, -0.0019...
4,544
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.binning_process.BinningProcess, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', sample_weight: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.binning_process.BinningProcess
[ 0.04383838549256325, -0.05829896405339241, -0.019093671813607216, 0.004680661018937826, -0.0029634672682732344, -0.017267072573304176, -0.011530408635735512, 0.009989215061068535, 0.05700512230396271, 0.01090251561254263, -0.021424489095807076, 0.006531044375151396, 0.05129700154066086, -0...
4,545
sklearn.base
set_params
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as :class:`~sklearn.pipeline.Pipeline`). The latter have parameters of the form ``<component>__<parameter>`` so that it's possible to update each component of a nested object. ...
def set_params(self, **params): """Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as :class:`~sklearn.pipeline.Pipeline`). The latter have parameters of the form ``<component>__<parameter>`` so that it's possible to update each componen...
(self, **params)
[ 0.04272640869021416, -0.0027561059687286615, -0.0002779787755571306, 0.02785877324640751, -0.056114498525857925, -0.014290250837802887, -0.02688443660736084, -0.014885677956044674, -0.016302073374390602, 0.08408153057098389, -0.027732469141483307, 0.02190450206398964, 0.0149758942425251, 0...
4,546
sklearn.utils._metadata_requests
set_transform_request
Request metadata passed to the ``transform`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each par...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.binning_process.BinningProcess, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', metric: Union[bool, NoneType, str] = '$UNCHANGED$', metric_missing: Union[bool, NoneType, str] = '$UNCHANGED$', metric_special: Union[bool, NoneType, str] = '$UNCHANGED$', show_digits: Union[bool, NoneT...
[ 0.04383838549256325, -0.05829896405339241, -0.019093671813607216, 0.004680661018937826, -0.0029634672682732344, -0.017267072573304176, -0.011530408635735512, 0.009989215061068535, 0.05700512230396271, 0.01090251561254263, -0.021424489095807076, 0.006531044375151396, 0.05129700154066086, -0...
4,547
optbinning.binning.binning_process
summary
Binning process summary with main statistics for all binned variables. Parameters ---------- df_summary : pandas.DataFrame Binning process summary.
def summary(self): """Binning process summary with main statistics for all binned variables. Parameters ---------- df_summary : pandas.DataFrame Binning process summary. """ self._check_is_fitted() if self._is_updated: self._binning_selection_criteria() self._is_u...
(self)
[ 0.01717003621160984, -0.020053893327713013, 0.0005387819837778807, -0.03918495401740074, 0.022769154980778694, 0.0014031070750206709, 0.002424657577648759, -0.03079071268439293, -0.017959769815206528, -0.014188573695719242, -0.07922175526618958, 0.01549296360462904, -0.02912251278758049, -...
4,548
optbinning.binning.binning_process
transform
Transform given data to metric using bins from each fitted optimal binning. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training vector, where n_samples is the number of samples. metric : str or None, (default=None) ...
def transform(self, X, metric=None, metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to metric using bins from each fitted optimal binning. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Train...
(self, X, metric=None, metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.008533974178135395, -0.015349009074270725, 0.02647540532052517, -0.004787806887179613, -0.005362343974411488, -0.04166559875011444, -0.012275470420718193, 0.009883902035653591, 0.01872149296104908, -0.00592286791652441, -0.035966940224170685, 0.0024756465572863817, 0.05493132770061493, -...
4,549
optbinning.binning.binning_process
transform_disk
Transform given data on disk to metric using bins from each fitted optimal binning. Save to comma-separated values (csv) file. Parameters ---------- input_path : str Any valid string path to a file with extension .csv. output_path : str Any valid string ...
def transform_disk(self, input_path, output_path, chunksize, metric=None, metric_special=0, metric_missing=0, show_digits=2, **kwargs): """Transform given data on disk to metric using bins from each fitted optimal binning. Save to comma-separated values (csv) file. Para...
(self, input_path, output_path, chunksize, metric=None, metric_special=0, metric_missing=0, show_digits=2, **kwargs)
[ 0.03079112619161606, -0.0006487029604613781, -0.03109923005104065, -0.005184809677302837, -0.022318270057439804, -0.012988502159714699, -0.031002948060631752, 0.02110511250793934, -0.02035410888493061, -0.057538390159606934, 0.017648572102189064, 0.0327938012778759, 0.02108585461974144, -0...
4,550
optbinning.binning.binning_process
update_binned_variable
Update optimal binning object for a given variable. Parameters ---------- name : string The variable name. optb : object The optimal binning object already fitted.
def update_binned_variable(self, name, optb): """Update optimal binning object for a given variable. Parameters ---------- name : string The variable name. optb : object The optimal binning object already fitted. """ self._check_is_fitted() if not isinstance(name, str): ...
(self, name, optb)
[ 0.02978464961051941, -0.039074622094631195, -0.060384832322597504, 0.01849130354821682, -0.07758191972970963, -0.06907202303409576, -0.08297152072191238, 0.015078478492796421, -0.019306834787130356, -0.07453253865242004, -0.02818904258310795, -0.023721344769001007, 0.0030205713119357824, -...
4,551
optbinning.binning.distributed.binning_process_sketch
BinningProcessSketch
Binning process over data streams to compute optimal binning of variables with respect to a binary target. Parameters ---------- variable_names : array-like List of variable names. max_n_prebins : int (default=20) The maximum number of bins after pre-binning (prebins). min_n_b...
class BinningProcessSketch(BaseSketch, BaseEstimator, BaseBinningProcess): """Binning process over data streams to compute optimal binning of variables with respect to a binary target. Parameters ---------- variable_names : array-like List of variable names. max_n_prebins : int (defaul...
(variable_names, max_n_prebins=20, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, max_pvalue=None, max_pvalue_policy='consecutive', selection_criteria=None, categorical_variables=None, special_codes=None, split_digits=None, binning_fit_params=None, binning_transform_params=None, verbose=False)
[ 0.039793528616428375, -0.04738062247633934, -0.07339351624250412, 0.026458051055669785, -0.016016121953725815, -0.0027556437999010086, -0.08268383145332336, 0.00407177209854126, -0.053651586174964905, -0.057987067848443985, -0.049819331616163254, 0.045638687908649445, -0.005612900480628014, ...
4,553
optbinning.binning.distributed.binning_process_sketch
__init__
null
def __init__(self, variable_names, max_n_prebins=20, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, max_pvalue=None, max_pvalue_policy="consecutive", selection_criteria=None, categorical_variables=None, special_codes=None, split_digits=None, ...
(self, variable_names, max_n_prebins=20, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, max_pvalue=None, max_pvalue_policy='consecutive', selection_criteria=None, categorical_variables=None, special_codes=None, split_digits=None, binning_fit_params=None, binning_transform_params=None, verbose=F...
[ 0.02422390691936016, -0.02328246831893921, -0.06318492442369461, -0.008563458919525146, -0.01614927127957344, -0.00017765103257261217, -0.09023314714431763, -0.014311658218502998, -0.05163421481847763, -0.05257565528154373, -0.03465213626623154, 0.09211602061986923, -0.007345926947891712, ...
4,559
optbinning.binning.distributed.base
_check_is_solved
null
def _check_is_solved(self): if not self._is_solved: raise NotSolvedError("This {} instance is not solved yet. Call " "'solve' with appropriate arguments." .format(self.__class__.__name__))
(self)
[ 0.041639961302280426, -0.032036252319812775, -0.013572405092418194, 0.04074409231543541, -0.04690766707062721, -0.026983553543686867, 0.03137330710887909, 0.012640701606869698, 0.05518548935651779, 0.038701511919498444, 0.01077729556709528, -0.025585999712347984, 0.01679753139615059, -0.07...
4,570
optbinning.binning.distributed.binning_process_sketch
add
Add new data X, y to the binning sketch of each variable. Parameters ---------- X : pandas.DataFrame, shape (n_samples, n_features) y : array-like of shape (n_samples,) Target vector relative to x. check_input : bool (default=False) Whether to check inp...
def add(self, X, y, check_input=False): """Add new data X, y to the binning sketch of each variable. Parameters ---------- X : pandas.DataFrame, shape (n_samples, n_features) y : array-like of shape (n_samples,) Target vector relative to x. check_input : bool (default=False) Whet...
(self, X, y, check_input=False)
[ 0.00850378256291151, -0.03112923353910446, -0.05229249224066734, 0.0397869311273098, -0.0234335009008646, 0.005752559285610914, -0.07164725661277771, 0.0318218469619751, -0.010533532127737999, -0.043019138276576996, -0.03967149555683136, 0.010745164938271046, -0.0010563593823462725, 0.0090...
4,571
optbinning.binning.distributed.binning_process_sketch
get_binned_variable
Return optimal binning sketch object for a given variable name. Parameters ---------- name : string The variable name.
def get_binned_variable(self, name): """Return optimal binning sketch object for a given variable name. Parameters ---------- name : string The variable name. """ self._check_is_solved() if not isinstance(name, str): raise TypeError("name must be a string.") if name in se...
(self, name)
[ 0.06387434154748917, -0.03130660578608513, -0.06448785960674286, -0.013719008304178715, -0.034050408750772476, -0.018746471032500267, -0.05197885259985924, 0.017894359305500984, 0.017706893384456635, -0.05375124514102936, -0.0190361887216568, 0.031562238931655884, -0.05375124514102936, -0....
4,574
optbinning.binning.distributed.binning_process_sketch
get_support
Get a mask, or integer index, or names of the variables selected. Parameters ---------- indices : boolean (default=False) If True, the return value will be an array of integers, rather than a boolean mask. names : boolean (default=False) If True, the...
def get_support(self, indices=False, names=False): """Get a mask, or integer index, or names of the variables selected. Parameters ---------- indices : boolean (default=False) If True, the return value will be an array of integers, rather than a boolean mask. names : boolean (default...
(self, indices=False, names=False)
[ 0.03140532597899437, -0.06246053799986839, -0.017181899398565292, -0.020779332146048546, 0.008319610729813576, 0.023545242846012115, -0.01784711889922619, 0.032980844378471375, 0.04106850549578667, 0.026521220803260803, 0.0027440274134278297, 0.003470516297966242, -0.025593416765332222, -0...
4,575
optbinning.binning.distributed.binning_process_sketch
information
Print overview information about the options settings and statistics. Parameters ---------- print_level : int (default=1) Level of details.
def information(self, print_level=1): """Print overview information about the options settings and statistics. Parameters ---------- print_level : int (default=1) Level of details. """ self._check_is_solved() if not isinstance(print_level, numbers.Integral) or print_level < 0: ...
(self, print_level=1)
[ 0.02121615782380104, 0.0006363760330714285, 0.009347282350063324, 0.0035432721488177776, 0.0631963238120079, -0.02132049947977066, -0.03297199681401253, -0.06455276906490326, -0.04611905664205551, 0.002299866173416376, -0.06350935250520706, -0.00876470748335123, -0.004760592710226774, -0.0...
4,576
optbinning.binning.distributed.binning_process_sketch
merge
Merge current instance with another BinningProcessSketch instance. Parameters ---------- bpsketch : object BinningProcessSketch instance.
def merge(self, bpsketch): """Merge current instance with another BinningProcessSketch instance. Parameters ---------- bpsketch : object BinningProcessSketch instance. """ if not self.mergeable(bpsketch): raise Exception("bpsketch does not share signature.") for name in self....
(self, bpsketch)
[ 0.002705823164433241, -0.07508880645036697, -0.06220731511712074, 0.09496108442544937, -0.07991493493318558, -0.02045779675245285, -0.03871544823050499, 0.012739547528326511, 0.022870859131217003, -0.00017632207891438156, -0.03736697509884834, -0.0769340917468071, -0.015463113784790039, 0....
4,577
optbinning.binning.distributed.binning_process_sketch
mergeable
Check whether two BinningProcessSketch instances can be merged. Parameters ---------- bpsketch : object BinningProcessSketch instance. Returns ------- mergeable : bool
def mergeable(self, bpsketch): """Check whether two BinningProcessSketch instances can be merged. Parameters ---------- bpsketch : object BinningProcessSketch instance. Returns ------- mergeable : bool """ return self.get_params() == bpsketch.get_params()
(self, bpsketch)
[ 0.040890902280807495, -0.050824057310819626, -0.06496915221214294, 0.09420701861381531, -0.04829689487814903, -0.026991505175828934, -0.021164990961551666, 0.009406662546098232, -0.012293594889342785, 0.01099491398781538, 0.003656927729025483, -0.04875318706035614, 0.019269617274403572, 0....
4,581
optbinning.binning.distributed.binning_process_sketch
solve
Solve optimal binning for all variables using added data. Returns ------- self : BinningProcessSketch Current fitted binning process.
def solve(self): """Solve optimal binning for all variables using added data. Returns ------- self : BinningProcessSketch Current fitted binning process. """ time_init = time.perf_counter() # Check if data was added if not self._n_add: raise NotDataAddedError( ...
(self)
[ 0.03692469000816345, -0.059036776423454285, -0.08282239735126495, 0.05483512207865715, -0.057256415486335754, -0.00458888104185462, -0.0662294328212738, -0.049885720014572144, 0.0007238280959427357, -0.042230166494846344, -0.03439657762646675, 0.0005135229439474642, -0.02962520904839039, -...
4,582
optbinning.binning.distributed.binning_process_sketch
summary
Binning process summary with main statistics for all binned variables. Parameters ---------- df_summary : pandas.DataFrame Binning process summary.
def summary(self): """Binning process summary with main statistics for all binned variables. Parameters ---------- df_summary : pandas.DataFrame Binning process summary. """ self._check_is_solved() df_summary = pd.DataFrame.from_dict(self._variable_stats).T df_summary.reset_i...
(self)
[ 0.020191555842757225, -0.019767215475440025, 0.0013194350758567452, -0.03857966139912605, 0.019006937742233276, 0.001194563927128911, 0.004051129799336195, -0.021941961720585823, -0.012889355421066284, -0.018617957830429077, -0.06792990863323212, 0.028236351907253265, -0.036917660385370255, ...
4,583
optbinning.binning.distributed.binning_process_sketch
transform
Transform given data to metric using bins from each fitted optimal binning. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Training vector, where n_samples is the number of samples. metric : str (default="woe") The...
def transform(self, X, metric="woe", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to metric using bins from each fitted optimal binning. Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) Trai...
(self, X, metric='woe', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.013758806511759758, -0.030277490615844727, 0.02250518649816513, -0.02958752028644085, -0.02816699631512165, -0.047242626547813416, -0.026502951979637146, 0.012662972323596478, 0.01393129862844944, -0.01641721837222576, -0.039409440010786057, 0.015727248042821884, 0.029262829571962357, -0...
4,584
optbinning.binning.continuous_binning
ContinuousOptimalBinning
Optimal binning of a numerical or categorical variable with respect to a continuous target. Parameters ---------- name : str, optional (default="") The variable name. dtype : str, optional (default="numerical") The variable data type. Supported data types are "numerical" for ...
class ContinuousOptimalBinning(OptimalBinning): """Optimal binning of a numerical or categorical variable with respect to a continuous target. Parameters ---------- name : str, optional (default="") The variable name. dtype : str, optional (default="numerical") The variable dat...
(name='', dtype='numerical', prebinning_method='cart', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', min_mean_diff=0, max_pvalue=None, max_pvalue_policy='consecutive', gamma=0, outlier_detector=None, outlier_params=None, cat_cutof...
[ 0.007073788437992334, -0.01860182173550129, -0.04611213132739067, 0.013372926041483879, -0.002614447847008705, -0.02631775476038456, -0.07905519008636475, -0.04207579046487808, -0.021445605903863907, -0.09564903378486633, -0.037427883595228195, 0.04660138487815857, 0.004795702639967203, -0...
4,586
optbinning.binning.continuous_binning
__init__
null
def __init__(self, name="", dtype="numerical", prebinning_method="cart", max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend="auto", min_mean_diff=0, max_pvalue=None, max_pvalue_policy="consec...
(self, name='', dtype='numerical', prebinning_method='cart', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', min_mean_diff=0, max_pvalue=None, max_pvalue_policy='consecutive', gamma=0, outlier_detector=None, outlier_params=None, cat...
[ 0.011357074603438377, -0.017526468262076378, -0.022714149206876755, 0.00501443725079298, -0.02696824073791504, -0.03928777948021889, -0.09247353672981262, -0.05077959969639778, -0.02021174319088459, -0.07511068880558014, -0.033782485872507095, 0.06329163163900375, -0.008994226343929768, 0....
4,593
optbinning.binning.continuous_binning
_compute_prebins
null
def _compute_prebins(self, splits_prebinning, x, y, sw): n_splits = len(splits_prebinning) if not n_splits: return splits_prebinning, np.array([]), np.array([]) if self.dtype == "categorical" and self.user_splits is not None: indices = np.digitize(x, splits_prebinning, right=True) n_...
(self, splits_prebinning, x, y, sw)
[ 0.013207179494202137, 0.012854203581809998, -0.04918130114674568, 0.010118640959262848, 0.003990587778389454, -0.04345524683594704, -0.02266889251768589, 0.0011214336846023798, 0.004721052013337612, -0.01933523267507553, -0.014354350976645947, 0.046357493847608566, -0.014373959973454475, -...
4,594
optbinning.binning.continuous_binning
_fit
null
def _fit(self, x, y, sample_weight, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params()) # Pre-processing if self.verbose: logger.info("Pre-proce...
(self, x, y, sample_weight, check_input)
[ -0.008217548951506615, -0.007288478780537844, -0.03640761598944664, 0.03416195139288902, -0.03245285898447037, -0.06478647887706757, -0.0823543444275856, -0.0036020090337842703, -0.026848630979657173, -0.044356878846883774, -0.04884821176528931, 0.041892606765031815, 0.021105289459228516, ...
4,595
optbinning.binning.continuous_binning
_fit_optimizer
null
def _fit_optimizer(self, splits, n_records, sums, ssums, stds): if self.verbose: logger.info("Optimizer started.") time_init = time.perf_counter() if len(n_records) <= 1: self._status = "OPTIMAL" self._splits_optimal = splits self._solution = np.zeros(len(splits)).astype(bool...
(self, splits, n_records, sums, ssums, stds)
[ -0.030182402580976486, -0.012889178469777107, -0.02730509266257286, 0.0040443832986056805, -0.041848234832286835, -0.024036310613155365, -0.06326168775558472, -0.04235714673995972, -0.08314841240644455, 0.0017897558864206076, -0.059777598828077316, 0.07030816376209259, 0.015893716365098953, ...
4,596
optbinning.binning.binning
_fit_prebinning
null
def _fit_prebinning(self, x, y, y_missing, x_special, y_special, y_others, class_weight=None, sw_clean=None, sw_missing=None, sw_special=None, sw_others=None): min_bin_size = int(np.ceil(self.min_prebin_size * self._n_samples)) prebinning = PreBinning(method=self.prebinni...
(self, x, y, y_missing, x_special, y_special, y_others, class_weight=None, sw_clean=None, sw_missing=None, sw_special=None, sw_others=None)
[ 0.014383796602487564, -0.05953732505440712, -0.004063554108142853, 0.029206659644842148, -0.030664358288049698, -0.044292960315942764, -0.019336458295583725, -0.037267908453941345, 0.020372655242681503, -0.0015916136326268315, 0.00879448838531971, -0.002093246439471841, -0.002698059426620602...
4,601
optbinning.binning.continuous_binning
_prebinning_refinement
null
def _prebinning_refinement(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others, sw_clean, sw_missing, sw_special, sw_others): # Compute n_records, sum and std for special, missing and others [self._n_records_special, self._sum_special, s...
(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others, sw_clean, sw_missing, sw_special, sw_others)
[ 0.014256992377340794, -0.03991957753896713, -0.014256992377340794, 0.037619449198246, -0.030814113095402718, -0.058586735278367996, -0.016918297857046127, -0.011424602940678596, -0.026955220848321915, -0.021005302667617798, -0.020606106147170067, 0.015891794115304947, 0.0017072748159989715, ...
4,606
optbinning.binning.continuous_binning
fit
Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector relative to x. sample_...
def fit(self, x, y, sample_weight=None, check_input=False): """Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Targ...
(self, x, y, sample_weight=None, check_input=False)
[ 0.014361191540956497, -0.046437818557024, -0.01366876158863306, -0.025305192917585373, -0.02870439924299717, -0.041042253375053406, -0.04248107224702835, 0.027859093621373177, 0.027697226032614708, 0.004485062323510647, -0.0015118819428607821, -0.030880609527230263, 0.004347925074398518, -...
4,607
optbinning.binning.continuous_binning
fit_transform
Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector rela...
def fit_transform(self, x, y, sample_weight=None, metric="mean", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape ...
(self, x, y, sample_weight=None, metric='mean', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.017898427322506905, -0.024148965254426003, 0.04206594079732895, 0.0044815619476139545, 0.0032921978272497654, -0.04510774463415146, -0.030789004638791084, 0.02082894742488861, 0.017750047147274017, 0.010952353477478027, -0.020773304626345634, -0.016674285754561424, 0.03835642337799072, -...
4,610
optbinning.binning.binning
information
Print overview information about the options settings, problem statistics, and the solution of the computation. Parameters ---------- print_level : int (default=1) Level of details.
def information(self, print_level=1): """Print overview information about the options settings, problem statistics, and the solution of the computation. Parameters ---------- print_level : int (default=1) Level of details. """ self._check_is_fitted() if not isinstance(print_level...
(self, print_level=1)
[ 0.02922184020280838, -0.001447538728825748, 0.005039168056100607, 0.00010769054642878473, 0.04066883772611618, -0.04397496208548546, -0.050231706351041794, -0.10835544019937515, -0.04486370086669922, -0.03188806772232056, -0.0542132705450058, -0.01900130696594715, -0.01716160960495472, -0....
4,611
optbinning.binning.continuous_binning
read_json
Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file.
def read_json(self, path): """ Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file. """ if path is None: raise ValueError('Specify the path for the json file.') self._is_fitted = True with open...
(self, path)
[ 0.015513036400079727, -0.02717745490372181, -0.07018714398145676, -0.0026903855614364147, -0.049867890775203705, 0.02495218627154827, -0.019170137122273445, 0.04093034192919731, 0.011326978914439678, 0.006881003268063068, -0.020665809512138367, 0.014546321704983711, -0.05242148041725159, -...
4,612
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.continuous_binning.ContinuousOptimalBinning, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', sample_weight: Union[bool, NoneType, str] = '$UNCHANGED$', x: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.continuous_binning.ContinuousOptimalBinning
[ 0.04383525252342224, -0.05837089940905571, -0.01913035847246647, 0.004746916238218546, -0.002937095006927848, -0.01727535016834736, -0.01155812293291092, 0.00996947567909956, 0.05700104683637619, 0.010854171589016914, -0.021461008116602898, 0.006492525804787874, 0.05125528201460838, -0.005...
4,614
sklearn.utils._metadata_requests
set_transform_request
Request metadata passed to the ``transform`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each par...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.continuous_binning.ContinuousOptimalBinning, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', metric: Union[bool, NoneType, str] = '$UNCHANGED$', metric_missing: Union[bool, NoneType, str] = '$UNCHANGED$', metric_special: Union[bool, NoneType, str] = '$UNCHANGED$', show_digits: Unio...
[ 0.04383525252342224, -0.05837089940905571, -0.01913035847246647, 0.004746916238218546, -0.002937095006927848, -0.01727535016834736, -0.01155812293291092, 0.00996947567909956, 0.05700104683637619, 0.010854171589016914, -0.021461008116602898, 0.006492525804787874, 0.05125528201460838, -0.005...
4,615
optbinning.binning.continuous_binning
to_json
Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved.
def to_json(self, path): """ Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved. """ if path is None: raise ValueError('Specify the path for the json file.') table = ...
(self, path)
[ 0.004675684962421656, -0.0190308578312397, -0.013799195177853107, -0.009497200138866901, -0.028509829193353653, -0.02145528607070446, -0.08428993076086044, 0.030369166284799576, -0.04528031498193741, -0.061576854437589645, 0.004292880184948444, 0.031335290521383286, -0.040504373610019684, ...
4,616
optbinning.binning.continuous_binning
transform
Transform given data to mean using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. metric : str (default="mean"): The metric used to transform the...
def transform(self, x, metric="mean", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to mean using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples i...
(self, x, metric='mean', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.0001719393185339868, -0.005951940547674894, 0.03496483713388443, 0.014135296456515789, 0.033255286514759064, -0.02620113454759121, -0.02528337389230728, -0.00371377682313323, 0.020298680290579796, -0.003850990906357765, -0.02181028574705124, 0.024833492934703827, 0.031311795115470886, -0...
4,617
optbinning.binning.multidimensional.continuous_binning_2d
ContinuousOptimalBinning2D
Optimal binning of two numerical variables with respect to a continuous target. Parameters ---------- name_x : str, optional (default="") The name of variable x. name_y : str, optional (default="") The name of variable y. dtype_x : str, optional (default="numerical") T...
class ContinuousOptimalBinning2D(OptimalBinning2D): """Optimal binning of two numerical variables with respect to a continuous target. Parameters ---------- name_x : str, optional (default="") The name of variable x. name_y : str, optional (default="") The name of variable y. ...
(name_x='', name_y='', dtype_x='numerical', dtype_y='numerical', prebinning_method='cart', strategy='grid', solver='cp', max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend_x=None, monotonic_trend_y...
[ 0.02360260672867298, -0.016556907445192337, -0.04131918027997017, 0.03184695169329643, -0.009594040922820568, -0.03590090945363045, -0.09347490221261978, -0.01759963296353817, -0.04572395980358124, -0.08295020461082458, -0.024031391367316246, 0.027383701875805855, -0.01571882888674736, -0....
4,619
optbinning.binning.multidimensional.continuous_binning_2d
__init__
null
def __init__(self, name_x="", name_y="", dtype_x="numerical", dtype_y="numerical", prebinning_method="cart", strategy="grid", solver="cp", max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bins=None, ...
(self, name_x='', name_y='', dtype_x='numerical', dtype_y='numerical', prebinning_method='cart', strategy='grid', solver='cp', max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend_x=None, monotonic_t...
[ 0.025232458487153053, -0.020748771727085114, -0.04566230624914169, 0.031198197975754738, -0.03012886829674244, -0.04660031571984291, -0.09927893429994583, -0.03348694369196892, -0.030466550961136818, -0.07215169817209244, -0.015524058602750301, 0.039809126406908035, -0.017390698194503784, ...
4,626
optbinning.binning.binning
_compute_prebins
null
def _compute_prebins(self, splits_prebinning, x, y0, y1, sw): n_splits = len(splits_prebinning) if not n_splits: return splits_prebinning, np.array([]), np.array([]) if self.dtype == "categorical" and self.user_splits is not None: indices = np.digitize(x, splits_prebinning, right=True) ...
(self, splits_prebinning, x, y0, y1, sw)
[ -0.016317734494805336, 0.004381090402603149, -0.06583654880523682, 0.017769457772374153, -0.016317734494805336, -0.05097996070981026, -0.014649197459220886, -0.003551534842699766, 0.010077214799821377, -0.008809314109385014, -0.0016650028992444277, 0.02763928286731243, -0.011613777838647366,...
4,627
optbinning.binning.multidimensional.continuous_binning_2d
_fit
null
def _fit(self, x, y, z, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params()) # Pre-processing if self.verbose: logger.info("Pre-processing starte...
(self, x, y, z, check_input)
[ -0.0026310214307159185, -0.00571972643956542, -0.03447709232568741, 0.013608822599053383, -0.019556067883968353, -0.05574749410152435, -0.07119763642549515, -0.033524688333272934, -0.026413390412926674, -0.0496520958840847, -0.04444560781121254, 0.03796925023198128, -0.014984519220888615, ...
4,628
optbinning.binning.multidimensional.continuous_binning_2d
_fit_optimizer
null
def _fit_optimizer(self, splits_x, splits_y, R, S, SS): if self.verbose: logger.info("Optimizer started.") time_init = time.perf_counter() # Min/max number of bins (bin size) if self.min_bin_size is not None: min_bin_size = int(np.ceil(self.min_bin_size * self._n_samples)) else: ...
(self, splits_x, splits_y, R, S, SS)
[ 0.004883620422333479, -0.03105221502482891, -0.058978911489248276, 0.018032610416412354, -0.024821477010846138, -0.022264234721660614, -0.06612294912338257, -0.03062600828707218, -0.059060096740722656, -0.0192706398665905, -0.021046500653028488, 0.03417773172259331, -0.0039043594151735306, ...
4,629
optbinning.binning.multidimensional.binning_2d
_fit_prebinning
null
def _fit_prebinning(self, dtype, x, z, max_n_prebins, min_prebin_size): # Pre-binning algorithm min_bin_size = int(np.ceil(min_prebin_size * self._n_samples)) prebinning = PreBinning(method=self.prebinning_method, n_bins=max_n_prebins, min_bin_size=min...
(self, dtype, x, z, max_n_prebins, min_prebin_size)
[ -0.020966988056898117, 0.004691821988672018, -0.03739491105079651, -0.02719947323203087, 0.029678501188755035, 0.025855211541056633, -0.003943312913179398, -0.023009568452835083, -0.01558994222432375, -0.009436017833650112, -0.007746961899101734, 0.020094091072678566, -0.05324672535061836, ...
4,634
optbinning.binning.multidimensional.continuous_binning_2d
_prebinning_matrices
null
def _prebinning_matrices(self, splits_x, splits_y, x_clean, y_clean, z_clean, x_missing, y_missing, z_missing, x_special, y_special, z_special): self._n_records_missing = len(z_missing) self._n_records_special = len(z_special) self._sum_missing = np.sum(z_mi...
(self, splits_x, splits_y, x_clean, y_clean, z_clean, x_missing, y_missing, z_missing, x_special, y_special, z_special)
[ -0.028197044506669044, -0.0051488629542291164, -0.01653253100812435, 0.046321041882038116, 0.012965773232281208, -0.02735450491309166, -0.03272804617881775, 0.0176746416836977, -0.03364547714591026, 0.01980908028781414, -0.04298832267522812, 0.04995333030819893, -0.005088012665510178, 0.01...
4,635
optbinning.binning.binning
_prebinning_refinement
null
def _prebinning_refinement(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others, sw_clean, sw_missing, sw_special, sw_others): y0 = (y == 0) y1 = ~y0 # Compute n_nonevent and n_event for special, missing and others. self._n_noneve...
(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others, sw_clean, sw_missing, sw_special, sw_others)
[ 0.017465978860855103, -0.03769265115261078, -0.03658837452530861, 0.02790139615535736, -0.04240423068404198, -0.06228121742606163, 0.0014183055609464645, -0.005107280798256397, -0.01338935736566782, -0.035576120018959045, -0.0011893982300534844, -0.004361893516033888, -0.012984455563127995, ...
4,638
optbinning.binning.multidimensional.binning_2d
_splits_xy_optimal
null
def _splits_xy_optimal(self, selected_rows, splits_x, splits_y, P): bins_x = np.concatenate([[-np.inf], splits_x, [np.inf]]) bins_y = np.concatenate([[-np.inf], splits_y, [np.inf]]) bins_str_x = np.array([[bins_x[i], bins_x[i+1]] for i in range(len(bins_x) - 1)]) bins_str_y = ...
(self, selected_rows, splits_x, splits_y, P)
[ 0.043789658695459366, -0.032634709030389786, -0.04295952245593071, -0.0024731126613914967, -0.022984381765127182, -0.021220343187451363, 0.04842458292841911, -0.0005712587735615671, -0.08695671707391739, 0.017666324973106384, 0.013965304009616375, 0.01952548325061798, -0.04088418185710907, ...
4,641
optbinning.binning.multidimensional.continuous_binning_2d
fit
Fit the optimal binning 2D according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector x, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Training vector y, where n_samples is th...
def fit(self, x, y, z, check_input=False): """Fit the optimal binning 2D according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector x, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Training vector ...
(self, x, y, z, check_input=False)
[ -0.008955775760114193, 0.006462608929723501, -0.02417345717549324, -0.006627630442380905, -0.016457574442029, -0.01860731840133667, -0.06800680607557297, 0.023227928206324577, -0.0069398339837789536, -0.011159039102494717, 0.0013603144325315952, -0.024280497804284096, -0.05423417687416077, ...
4,642
optbinning.binning.multidimensional.continuous_binning_2d
fit_transform
Fit the optimal binning 2D according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector x, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Training vect...
def fit_transform(self, x, y, z, metric="mean", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Fit the optimal binning 2D according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training ...
(self, x, y, z, metric='mean', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ -0.007097509689629078, 0.021955933421850204, 0.03538758307695389, 0.018148178234696388, 0.007865422405302525, -0.04024042561650276, -0.043366603553295135, 0.013177194632589817, -0.012232071720063686, 0.013331686146557331, -0.030225759372115135, 0.003317018039524555, -0.016048913821578026, ...
4,646
optbinning.binning.binning
read_json
Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file.
def read_json(self, path): """ Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file. """ self._is_fitted = True with open(path, "r") as read_file: bin_table_attr = json.load(read_file) for key i...
(self, path)
[ 0.01840529404580593, -0.03111841529607773, -0.06223683059215546, -0.0008854742627590895, -0.056059833616018295, 0.01748054102063179, -0.02849678322672844, 0.05024196580052376, 0.009651556611061096, 0.011159893125295639, -0.01808208040893078, 0.019464721903204918, -0.056526701897382736, -0....
4,647
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.multidimensional.continuous_binning_2d.ContinuousOptimalBinning2D, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', x: Union[bool, NoneType, str] = '$UNCHANGED$', z: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.multidimensional.continuous_binning_2d.ContinuousOp...
[ 0.04383525252342224, -0.05837089940905571, -0.01913035847246647, 0.004746916238218546, -0.002937095006927848, -0.01727535016834736, -0.01155812293291092, 0.00996947567909956, 0.05700104683637619, 0.010854171589016914, -0.021461008116602898, 0.006492525804787874, 0.05125528201460838, -0.005...
4,650
optbinning.binning.binning
to_json
Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved.
def to_json(self, path): """ Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved. """ if path is None: raise ValueError('Specify the path for the json file') table = s...
(self, path)
[ 0.004397603217512369, -0.01927916519343853, -0.012441999278962612, -0.00960306916385889, -0.02809719182550907, -0.023642536252737045, -0.08420029282569885, 0.02915608510375023, -0.04337812215089798, -0.057216763496398926, 0.013263554312288761, 0.024957025423645973, -0.04319555312395096, -0...
4,651
optbinning.binning.multidimensional.continuous_binning_2d
transform
Transform given data to mean using bins from the fitted optimal binning 2D. Parameters ---------- x : array-like, shape = (n_samples,) Training vector x, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Training vector y, wh...
def transform(self, x, y, metric="mean", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to mean using bins from the fitted optimal binning 2D. Parameters ---------- x : array-like, shape = (n_samples,) Training vector x, where n_s...
(self, x, y, metric='mean', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.007146615535020828, -0.013685605488717556, 0.04894660413265228, 0.008287082426249981, 0.010909222066402435, -0.03933676704764366, -0.03410183638334274, 0.016134805977344513, -0.011591632850468159, -0.003115251427516341, -0.01817268878221512, 0.01677982322871685, 0.02273455820977688, -0.0...
4,652
optbinning.binning.piecewise.continuous_binning
ContinuousOptimalPWBinning
Optimal Piecewise binning of a numerical variable with respect to a binary target. Parameters ---------- name : str, optional (default="") The variable name. objective : str, optional (default="l2") The objective function. Supported objectives are "l2", "l1", "huber" and "q...
class ContinuousOptimalPWBinning(BasePWBinning): """Optimal Piecewise binning of a numerical variable with respect to a binary target. Parameters ---------- name : str, optional (default="") The variable name. objective : str, optional (default="l2") The objective function. Sup...
(name='', objective='l2', degree=1, continuous=True, continuous_deriv=True, prebinning_method='cart', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', n_subsamples=None, max_pvalue=None, max_pvalue_policy='consecutive', outlier_detec...
[ 0.04175153002142906, -0.02080218493938446, -0.042403243482112885, 0.02074962854385376, -0.007957177236676216, -0.059999432414770126, -0.08522694557905197, -0.04898341745138168, -0.052515268325805664, -0.059410788118839264, -0.008719258941709995, 0.02575308457016945, 0.02440761774778366, -0...
4,654
optbinning.binning.piecewise.continuous_binning
__init__
null
def __init__(self, name="", objective="l2", degree=1, continuous=True, continuous_deriv=True, prebinning_method="cart", max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend="auto", n_subsamples...
(self, name='', objective='l2', degree=1, continuous=True, continuous_deriv=True, prebinning_method='cart', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', n_subsamples=None, max_pvalue=None, max_pvalue_policy='consecutive', outlier...
[ 0.03188064321875572, -0.006578767206519842, 0.0050006103701889515, 0.033075932413339615, -0.021197732537984848, -0.05939100310206413, -0.08643445372581482, -0.05771012231707573, -0.06884127110242844, -0.047363389283418655, -0.013372313231229782, 0.05289160832762718, 0.001980867236852646, 0...
4,661
optbinning.binning.piecewise.continuous_binning
_fit
null
def _fit(self, x, y, lb, ub, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal piecewise binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params(deep=False), estimator=None, problem_type=self._pr...
(self, x, y, lb, ub, check_input)
[ -0.02373250015079975, -0.040105171501636505, -0.03516582027077675, 0.030226467177271843, -0.06549067795276642, -0.047897931188344955, -0.07163043320178986, -0.01869475468993187, -0.06450674682855606, -0.04679592326283455, -0.04081360250711441, 0.04530034586787224, 0.033158592879772186, -0....
4,662
optbinning.binning.piecewise.base
_fit_binning
null
def _fit_binning(self, x, y, prediction, lb, ub): if self.verbose: logger.info("Pre-binning: optimal binning started.") time_prebinning = time.perf_counter() # Determine optimal split points monotonic_trend = self.monotonic_trend if self.monotonic_trend in ("concave", "convex"): mono...
(self, x, y, prediction, lb, ub)
[ -0.025629160925745964, -0.02030842937529087, -0.06260141730308533, 0.012629427015781403, -0.027071410790085793, -0.05094648525118828, -0.055078331381082535, -0.048217903822660446, -0.06451142579317093, -0.0535971038043499, -0.011050748638808727, 0.023095479235053062, 0.006811704486608505, ...
4,663
optbinning.binning.piecewise.base
_fit_preprocessing
null
def _fit_preprocessing(self, x, y, check_input): return split_data(dtype="numerical", x=x, y=y, special_codes=self.special_codes, user_splits=self.user_splits, check_input=check_input, outlier_detector=self.outlier_detector, ...
(self, x, y, check_input)
[ -0.0038231329526752234, 0.011917153373360634, 0.0032720507588237524, -0.009928090497851372, -0.0017910172464326024, -0.001897574169561267, 0.0034012107644230127, -0.008412614464759827, 0.05066512152552605, 0.01035001315176487, 0.055659305304288864, -0.023283224552869797, 0.020493371412158012...
4,672
optbinning.binning.piecewise.base
fit
Fit the optimal piecewise binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector relative to x...
def fit(self, x, y, lb=None, ub=None, check_input=False): """Fit the optimal piecewise binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) ...
(self, x, y, lb=None, ub=None, check_input=False)
[ -0.006861167028546333, -0.03640760853886604, -0.03918681666254997, -0.0008299623732455075, -0.05773802101612091, -0.037519291043281555, -0.03109237551689148, -0.001888992148451507, -0.008902146480977535, -0.019002826884388924, 0.018568575382232666, -0.025169191882014275, 0.001934588537551462...
4,673
optbinning.binning.piecewise.continuous_binning
fit_transform
Fit the optimal piecewise binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target v...
def fit_transform(self, x, y, metric_special=0, metric_missing=0, lb=None, ub=None, check_input=False): """Fit the optimal piecewise binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, ...
(self, x, y, metric_special=0, metric_missing=0, lb=None, ub=None, check_input=False)
[ -0.01246568001806736, -0.02806558832526207, 0.000860354513861239, 0.029490238055586815, -0.021903980523347855, -0.04861615225672722, -0.027121758088469505, -0.008668099530041218, -0.010951990261673927, -0.0028248121961951256, -0.0015982782933861017, -0.020069744437932968, 0.03591896593570709...
4,676
optbinning.binning.piecewise.base
information
Print overview information about the options settings, problem statistics, and the solution of the computation. Parameters ---------- print_level : int (default=1) Level of details.
def information(self, print_level=1): """Print overview information about the options settings, problem statistics, and the solution of the computation. Parameters ---------- print_level : int (default=1) Level of details. """ self._check_is_fitted() if not isinstance(print_level...
(self, print_level=1)
[ 0.03437815234065056, 0.010092751123011112, 0.008554167114198208, 0.0058089387603104115, 0.04209350049495697, -0.04808635264635086, -0.04525141045451164, -0.11088568717241287, -0.04065808653831482, -0.020490527153015137, -0.040622200816869736, -0.028457071632146835, -0.017888840287923813, -...
4,677
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.piecewise.continuous_binning.ContinuousOptimalPWBinning, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', lb: Union[bool, NoneType, str] = '$UNCHANGED$', ub: Union[bool, NoneType, str] = '$UNCHANGED$', x: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.piecewise.co...
[ 0.04383368045091629, -0.05829270929098129, -0.019129673019051552, 0.004701561760157347, -0.002906074048951268, -0.01725570671260357, -0.011529171839356422, 0.010007168166339397, 0.05699900537729263, 0.010863294824957848, -0.02144121564924717, 0.006497049704194069, 0.05129149556159973, -0.0...
4,679
sklearn.utils._metadata_requests
set_transform_request
Request metadata passed to the ``transform`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each par...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.piecewise.continuous_binning.ContinuousOptimalPWBinning, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', lb: Union[bool, NoneType, str] = '$UNCHANGED$', metric_missing: Union[bool, NoneType, str] = '$UNCHANGED$', metric_special: Union[bool, NoneType, str] = '$UNCHANGED$', ub: Union...
[ 0.04383368045091629, -0.05829270929098129, -0.019129673019051552, 0.004701561760157347, -0.002906074048951268, -0.01725570671260357, -0.011529171839356422, 0.010007168166339397, 0.05699900537729263, 0.010863294824957848, -0.02144121564924717, 0.006497049704194069, 0.05129149556159973, -0.0...
4,680
optbinning.binning.piecewise.continuous_binning
transform
Transform given data using bins from the fitted optimal piecewise binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. metric_special : float or str (default=0) The metric value to...
def transform(self, x, metric_special=0, metric_missing=0, lb=None, ub=None, check_input=False): """Transform given data using bins from the fitted optimal piecewise binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the numb...
(self, x, metric_special=0, metric_missing=0, lb=None, ub=None, check_input=False)
[ -0.00840013101696968, -0.019136838614940643, -0.013921739533543587, 0.019865354523062706, -0.013086613267660141, -0.04356873780488968, -0.03710094839334488, -0.025906695052981377, -0.008857673034071922, -0.03443564847111702, 0.004328887909650803, 0.027186037972569466, 0.04932577908039093, ...
4,681
optbinning.binning.mdlp
MDLP
Minimum Description Length Principle (MDLP) discretization algorithm. Parameters ---------- min_samples_split : int (default=2) The minimum number of samples required to split an internal node. min_samples_leaf : int (default=2) The minimum number of samples required to be at a le...
class MDLP(BaseEstimator): """ Minimum Description Length Principle (MDLP) discretization algorithm. Parameters ---------- min_samples_split : int (default=2) The minimum number of samples required to split an internal node. min_samples_leaf : int (default=2) The minimum number...
(min_samples_split=2, min_samples_leaf=2, max_candidates=32)
[ 0.013581105507910252, -0.012692911550402641, -0.0201082993298769, 0.043707408010959625, 0.021440589800477028, -0.027410078793764114, -0.019540267065167427, -0.020170265808701515, -0.04614477604627609, 0.0065271928906440735, -0.03383399546146393, 0.014934052713215351, 0.002126243431121111, ...
4,683
optbinning.binning.mdlp
__init__
null
def __init__(self, min_samples_split=2, min_samples_leaf=2, max_candidates=32): self.min_samples_split = min_samples_split self.min_samples_leaf = min_samples_leaf self.max_candidates = max_candidates # auxiliary self._splits = [] self._is_fitted = None
(self, min_samples_split=2, min_samples_leaf=2, max_candidates=32)
[ 0.01857997104525566, -0.01757097989320755, -0.018779950216412544, -0.01855270005762577, -0.031851377338171005, 0.0010146718705073, -0.0025156589690595865, 0.0016032496932893991, -0.03326942026615143, 0.0010868237586691976, -0.014271308667957783, 0.08275540918111801, -0.022997712716460228, ...
4,689
optbinning.binning.mdlp
_entropy
null
def _entropy(self, x): n = len(x) ns1 = np.sum(x) ns0 = n - ns1 p = np.array([ns0, ns1]) / n return -special.xlogy(p, p).sum()
(self, x)
[ -0.07544626295566559, -0.016148600727319717, 0.07461945712566376, 0.06225178390741348, 0.11754459142684937, -0.00410174485296011, -0.056808628141880035, -0.06145942583680153, 0.04516441002488136, 0.07358594983816147, 0.0067048994824290276, -0.013203096576035023, 0.04375194385647774, 0.0114...
4,690
optbinning.binning.mdlp
_entropy_gain
null
def _entropy_gain(self, y, y1, y2): n = len(y) n1 = len(y1) n2 = n - n1 ent_y = self._entropy(y) ent_y1 = self._entropy(y1) ent_y2 = self._entropy(y2) return ent_y - (n1 * ent_y1 + n2 * ent_y2) / n
(self, y, y1, y2)
[ -0.045938875526189804, -0.03664786368608475, 0.07804446667432785, 0.07852622121572495, 0.04026103392243385, -0.025773944333195686, -0.049758508801460266, 0.006843515671789646, 0.006598336156457663, 0.0518920011818409, 0.006383266765624285, -0.045388296246528625, 0.014409665018320084, 0.058...
4,691
optbinning.binning.mdlp
_find_split
null
def _find_split(self, u_x, x, y): n_x = len(x) u_x = np.unique(0.5 * (x[1:] + x[:-1])[(y[1:] - y[:-1]) != 0]) if len(u_x) > self.max_candidates: percentiles = np.linspace(1, 100, self.max_candidates) splits = np.percentile(u_x, percentiles) else: splits = u_x max_entropy_gain...
(self, u_x, x, y)
[ 0.01109541766345501, -0.020712634548544884, -0.05278782919049263, 0.05805949121713638, 0.04552149027585983, 0.00875344779342413, 0.040890976786613464, 0.015458784066140652, -0.030365468934178352, 0.006896790582686663, 0.017702801153063774, 0.009661740623414516, -0.03668789938092232, -0.049...
4,692
optbinning.binning.mdlp
_fit
null
def _fit(self, x, y): _check_parameters(**self.get_params()) x = check_array(x, ensure_2d=False, force_all_finite=True) y = check_array(y, ensure_2d=False, force_all_finite=True) idx = np.argsort(x) x = x[idx] y = y[idx] self._recurse(x, y, 0) self._is_fitted = True return self
(self, x, y)
[ 0.006412731949239969, -0.008347298949956894, 0.02516728639602661, 0.014097262173891068, -0.03441021591424942, -0.017697706818580627, -0.05209001153707504, -0.03833308815956116, 0.02360888384282589, 0.04005270451307297, 0.0008133466471917927, -0.05040622130036354, -0.023286456242203712, -0....
4,697
optbinning.binning.mdlp
_recurse
null
def _recurse(self, x, y, id): u_x = np.unique(x) n_x = len(u_x) n_y = len(np.bincount(y)) split = self._find_split(u_x, x, y) if split is not None: self._splits.append(split) t = np.searchsorted(x, split, side="right") if not self._terminate(n_x, n_y, y, y[:t], y[t:]): ...
(self, x, y, id)
[ -0.006378046702593565, 0.008877672255039215, -0.028269780799746513, 0.07963218539953232, -0.0431252047419548, -0.006742761004716158, -0.027486979961395264, 0.05632607266306877, -0.023857630789279938, -0.0350659154355526, -0.005261666141450405, -0.02649068832397461, -0.0032490678131580353, ...
4,700
optbinning.binning.mdlp
_terminate
null
def _terminate(self, n_x, n_y, y, y1, y2): splittable = (n_x >= self.min_samples_split) and (n_y >= 2) n = len(y) n1 = len(y1) n2 = n - n1 ent_y = self._entropy(y) ent_y1 = self._entropy(y1) ent_y2 = self._entropy(y2) gain = ent_y - (n1 * ent_y1 + n2 * ent_y2) / n k = len(np.bincount...
(self, n_x, n_y, y, y1, y2)
[ -0.04556670039892197, 0.02034159190952778, 0.037010930478572845, 0.030435480177402496, 0.02610952779650688, -0.027109304443001747, -0.0745217427611351, 0.008983561769127846, -0.057871636003255844, 0.010372673161327839, 0.008070304989814758, 0.026570962741971016, 0.019264910370111465, -0.01...
4,703
optbinning.binning.mdlp
fit
Fit MDLP discretization algorithm. Parameters ---------- x : array-like, shape = (n_samples) Data samples, where n_samples is the number of samples. y : array-like, shape = (n_samples) Target vector relative to x. Returns ------- self : ...
def fit(self, x, y): """Fit MDLP discretization algorithm. Parameters ---------- x : array-like, shape = (n_samples) Data samples, where n_samples is the number of samples. y : array-like, shape = (n_samples) Target vector relative to x. Returns ------- self : MDLP ""...
(self, x, y)
[ 0.02103373035788536, 0.03015470691025257, 0.04400957003235817, 0.04040279611945152, -0.009164325892925262, -0.00019765182514674962, -0.025715600699186325, -0.015744952484965324, 0.035894330590963364, 0.03147256746888161, -0.0016440730541944504, -0.01874481700360775, -0.01787780411541462, 0...
4,706
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.mdlp.MDLP, *, x: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.mdlp.MDLP
[ 0.04383368045091629, -0.05829270929098129, -0.019129673019051552, 0.004701561760157347, -0.002906074048951268, -0.01725570671260357, -0.011529171839356422, 0.010007168166339397, 0.05699900537729263, 0.010863294824957848, -0.02144121564924717, 0.006497049704194069, 0.05129149556159973, -0.0...
4,708
optbinning.binning.multiclass_binning
MulticlassOptimalBinning
Optimal binning of a numerical variable with respect to a multiclass or multilabel target. **Note that the maximum number of classes is set to 100**. To ease visualization of the binning table, a set of 100 maximally distinct colors is generated using the library `glasbey <https://github.com/taketw...
class MulticlassOptimalBinning(OptimalBinning): """Optimal binning of a numerical variable with respect to a multiclass or multilabel target. **Note that the maximum number of classes is set to 100**. To ease visualization of the binning table, a set of 100 maximally distinct colors is generated us...
(name='', prebinning_method='cart', solver='cp', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', min_event_rate_diff=0, max_pvalue=None, max_pvalue_policy='consecutive', outlier_detector=None, outlier_params=None, user_splits=None, ...
[ 0.022732455283403397, -0.040763016790151596, -0.04809478297829628, 0.019375383853912354, -0.03540365770459175, -0.055426545441150665, -0.08790148049592972, -0.030841227620840073, -0.039886392652988434, -0.07758122682571411, -0.03309255838394165, 0.026238951832056046, 0.00845244899392128, -...
4,710
optbinning.binning.multiclass_binning
__init__
null
def __init__(self, name="", prebinning_method="cart", solver="cp", max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend="auto", min_event_rate_diff=0, max_pvalue=None, max_pvalue_p...
(self, name='', prebinning_method='cart', solver='cp', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, monotonic_trend='auto', min_event_rate_diff=0, max_pvalue=None, max_pvalue_policy='consecutive', outlier_detector=None, outlier_params=None, user_splits=...
[ 0.015676112845540047, -0.03183918073773384, -0.03594081476330757, 0.005604632198810577, -0.045623671263456345, -0.053826943039894104, -0.08825071156024933, -0.04408789798617363, -0.03642776608467102, -0.058958668261766434, -0.022718191146850586, 0.045286551117897034, -0.007524347398430109, ...
4,717
optbinning.binning.multiclass_binning
_compute_prebins
null
def _compute_prebins(self, splits_prebinning, x, y): n_splits = len(splits_prebinning) if not n_splits: return splits_prebinning, np.array([]), np.array([]) indices = np.digitize(x, splits_prebinning, right=False) n_bins = n_splits + 1 n_nonevent = np.empty((n_bins, self._n_classes), dtype=n...
(self, splits_prebinning, x, y)
[ -0.0034398697316646576, 0.006773256231099367, -0.06085282564163208, 0.01650952361524105, -0.007356598973274231, -0.05100081488490105, -0.012037229724228382, 0.023167036473751068, 0.00955570861697197, -0.02544485032558441, 0.011407589539885521, 0.019741056486964226, -0.010861285030841827, -...
4,718
optbinning.binning.multiclass_binning
_fit
null
def _fit(self, x, y, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params()) # Pre-processing if self.verbose: logger.info("Pre-processing started."...
(self, x, y, check_input)
[ -0.01033327542245388, -0.010031076148152351, -0.055955663323402405, 0.028036320582032204, -0.03719979152083397, -0.0630524754524231, -0.07615429162979126, -0.018658386543393135, -0.025053318589925766, -0.04113813489675522, -0.026671549305319786, 0.010001830756664276, 0.01468104962259531, -...
4,719
optbinning.binning.multiclass_binning
_fit_optimizer
null
def _fit_optimizer(self, splits, n_nonevent, n_event): if self.verbose: logger.info("Optimizer started.") time_init = time.perf_counter() if not len(n_nonevent): self._status = "OPTIMAL" self._splits_optimal = splits self._solution = np.zeros(len(splits), dtype=bool) ...
(self, splits, n_nonevent, n_event)
[ -0.025850839912891388, -0.003984940238296986, -0.04536774381995201, -0.011561335064470768, -0.04387965425848961, -0.06620103865861893, -0.06017236039042473, -0.03464584797620773, -0.07051269710063934, -0.005890366621315479, -0.05093855410814285, 0.03592408075928688, 0.008451602421700954, -...
4,725
optbinning.binning.multiclass_binning
_prebinning_refinement
null
def _prebinning_refinement(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others=None, sw_clean=None, sw_missing=None, sw_special=None, sw_others=None): self._classes = np.unique(y) self._n_classes = len(self._cl...
(self, splits_prebinning, x, y, y_missing, x_special, y_special, y_others=None, sw_clean=None, sw_missing=None, sw_special=None, sw_others=None)
[ 0.01967676728963852, -0.035143621265888214, -0.029890382662415504, 0.030183246359229088, -0.03470432758331299, -0.062050458043813705, 0.00428084097802639, -0.0002512505743652582, -0.01035089511424303, -0.019695071503520012, 0.011934188194572926, 0.001662229304201901, -0.005029015708714724, ...
4,730
optbinning.binning.multiclass_binning
fit
Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector relative to x. check_i...
def fit(self, x, y, check_input=False): """Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector relative t...
(self, x, y, check_input=False)
[ 0.004161129705607891, -0.026777096092700958, -0.012989149428904057, -0.011009519919753075, -0.054457180202007294, -0.0538320355117321, -0.04872667416930199, 0.036848895251750946, 0.022661549970507622, -0.00025803560856729746, 0.009689765982329845, -0.023477714508771896, 0.012659210711717606,...
4,731
optbinning.binning.multiclass_binning
fit_transform
Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector rela...
def fit_transform(self, x, y, metric="mean_woe", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training ve...
(self, x, y, metric='mean_woe', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.010697808116674423, -0.010770893655717373, 0.034002769738435745, 0.017138419672846794, -0.015411787666380405, -0.06603224575519562, -0.03153615444898605, 0.0067283823154866695, 0.00132123869843781, 0.011520014144480228, -0.019477136433124542, -0.01817987859249115, 0.031243812292814255, -...
4,735
optbinning.binning.multiclass_binning
read_json
Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file.
def read_json(self, path): """ Read json file containing split points and set them as the new split points. Parameters ---------- path: The path of the json file. """ if path is None: raise ValueError('Specify the path for the json file.') self._is_fitted = True with open...
(self, path)
[ 0.015165099874138832, -0.02497035637497902, -0.04497923329472542, 0.01157979853451252, -0.051823899149894714, 0.00657757930457592, -0.012765845283865929, 0.03277472406625748, 0.013091782107949257, 0.023847686126828194, -0.009094533510506153, 0.022326648235321045, -0.047586727887392044, -0....
4,736
sklearn.utils._metadata_requests
set_fit_request
Request metadata passed to the ``fit`` method. Note that this method is only relevant if ``enable_metadata_routing=True`` (see :func:`sklearn.set_config`). Please see :ref:`User Guide <metadata_routing>` on how the routing mechanism works. The options for each parameter...
def __get__(self, instance, owner): # we would want to have a method which accepts only the expected args def func(**kw): """Updates the request for provided parameters This docstring is overwritten below. See REQUESTER_DOC for expected functionality """ if not _routing_e...
(self: optbinning.binning.multiclass_binning.MulticlassOptimalBinning, *, check_input: Union[bool, NoneType, str] = '$UNCHANGED$', x: Union[bool, NoneType, str] = '$UNCHANGED$') -> optbinning.binning.multiclass_binning.MulticlassOptimalBinning
[ 0.04383368045091629, -0.05829270929098129, -0.019129673019051552, 0.004701561760157347, -0.002906074048951268, -0.01725570671260357, -0.011529171839356422, 0.010007168166339397, 0.05699900537729263, 0.010863294824957848, -0.02144121564924717, 0.006497049704194069, 0.05129149556159973, -0.0...
4,739
optbinning.binning.multiclass_binning
to_json
Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved.
def to_json(self, path): """ Save optimal bins and/or splits points and transformation depending on the target type. Parameters ---------- path: The path where the json is going to be saved. """ if path is None: raise ValueError('Specify the path for the json file.') table = ...
(self, path)
[ 0.008118879050016403, -0.014326374046504498, -0.013145281933248043, -0.020971141755580902, -0.029878919944167137, -0.028219981119036674, -0.08532712608575821, 0.031736209988594055, -0.033485304564237595, -0.05319421365857124, 0.023531677201390266, 0.02028592862188816, -0.043493032455444336, ...
4,740
optbinning.binning.multiclass_binning
transform
Transform given data to mean Weight of Evidence (WoE) or weighted mean WoE using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. metric : str, optional (defau...
def transform(self, x, metric="mean_woe", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to mean Weight of Evidence (WoE) or weighted mean WoE using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_sa...
(self, x, metric='mean_woe', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.016102535650134087, -0.0044107744470238686, 0.037523675709962845, 0.019862238317728043, -0.003319543320685625, -0.08194319903850555, -0.030316049233078957, -0.006428176071494818, 0.014626163989305496, 0.017716458067297935, -0.009509298950433731, 0.003085708012804389, 0.049958206713199615, ...
4,741
optbinning.binning.binning
OptimalBinning
Optimal binning of a numerical or categorical variable with respect to a binary target. Parameters ---------- name : str, optional (default="") The variable name. dtype : str, optional (default="numerical") The variable data type. Supported data types are "numerical" for co...
class OptimalBinning(BaseOptimalBinning): """Optimal binning of a numerical or categorical variable with respect to a binary target. Parameters ---------- name : str, optional (default="") The variable name. dtype : str, optional (default="numerical") The variable data type. Su...
(name='', dtype='numerical', prebinning_method='cart', solver='cp', divergence='iv', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, min_bin_n_nonevent=None, max_bin_n_nonevent=None, min_bin_n_event=None, max_bin_n_event=None, monotonic_trend='auto', min_e...
[ 0.02987671084702015, -0.015236909501254559, -0.045593440532684326, 0.0059017702005803585, -0.009964235126972198, -0.03798031806945801, -0.09024856984615326, -0.04203211888670921, -0.03603971749544144, -0.09314880520105362, -0.040262121707201004, 0.045550789684057236, -0.0012668546987697482, ...
4,743
optbinning.binning.binning
__init__
null
def __init__(self, name="", dtype="numerical", prebinning_method="cart", solver="cp", divergence="iv", max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, min_bin_n_nonevent=None, max_bin_n_nonevent=None, min...
(self, name='', dtype='numerical', prebinning_method='cart', solver='cp', divergence='iv', max_n_prebins=20, min_prebin_size=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, min_bin_n_nonevent=None, max_bin_n_nonevent=None, min_bin_n_event=None, max_bin_n_event=None, monotonic_trend='auto',...
[ 0.023427613079547882, -0.02795771136879921, -0.053754620254039764, 0.017276916652917862, -0.028109345585107803, -0.06607496738433838, -0.09120848029851913, -0.04791667312383652, -0.03491396829485893, -0.07475607842206955, -0.03976628929376602, 0.04052446410059929, -0.006681418977677822, -0...
4,751
optbinning.binning.binning
_fit
null
def _fit(self, x, y, sample_weight, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params()) # Pre-processing if self.verbose: logger.info("Pre-proce...
(self, x, y, sample_weight, check_input)
[ -0.012733753770589828, -0.014053060673177242, -0.053944990038871765, 0.029005205258727074, -0.03664741292595863, -0.07419390976428986, -0.0758357122540474, -0.013456929475069046, -0.02478342317044735, -0.04323417320847511, -0.0379178561270237, 0.013945561833679676, 0.01704348996281624, -0....
4,752
optbinning.binning.binning
_fit_optimizer
null
def _fit_optimizer(self, splits, n_nonevent, n_event): if self.verbose: logger.info("Optimizer started.") time_init = time.perf_counter() if len(n_nonevent) <= 1: self._status = "OPTIMAL" self._splits_optimal = splits self._solution = np.zeros(len(splits), dtype=bool) ...
(self, splits, n_nonevent, n_event)
[ -0.02485661581158638, -0.0028495320584625006, -0.04929737746715546, 0.0007312853704206645, -0.040564484894275665, -0.05837051570415497, -0.06623390316963196, -0.048654697835445404, -0.08687528967857361, -0.028920624405145645, -0.049864448606967926, 0.03251207619905472, 0.007343570236116648, ...
4,763
optbinning.binning.binning
fit
Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector relative to x. sample_...
def fit(self, x, y, sample_weight=None, check_input=False): """Fit the optimal binning according to the given training data. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Targ...
(self, x, y, sample_weight=None, check_input=False)
[ 0.02171381190419197, -0.04259871318936348, -0.0008424238185398281, -0.03077775053679943, -0.038490209728479385, -0.044148415327072144, -0.035012394189834595, 0.03130032494664192, 0.01828104630112648, 0.010343343019485474, -0.0005735352169722319, -0.028110826388001442, 0.005856422241777182, ...
4,764
optbinning.binning.binning
fit_transform
Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. y : array-like, shape = (n_samples,) Target vector rela...
def fit_transform(self, x, y, sample_weight=None, metric="woe", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Fit the optimal binning according to the given training data, then transform it. Parameters ---------- x : array-like, shape =...
(self, x, y, sample_weight=None, metric='woe', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.02123788557946682, -0.020883921533823013, 0.03606714680790901, 0.00364676839672029, -0.010125255212187767, -0.060621123760938644, -0.034893471747636795, 0.014009552076458931, 0.010320867411792278, 0.009911012835800648, -0.015630338340997696, -0.018732188269495964, 0.03994212672114372, -0...
4,773
optbinning.binning.binning
transform
Transform given data to Weight of Evidence (WoE) or event rate using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_samples,) Training vector, where n_samples is the number of samples. metric : str (default="woe") ...
def transform(self, x, metric="woe", metric_special=0, metric_missing=0, show_digits=2, check_input=False): """Transform given data to Weight of Evidence (WoE) or event rate using bins from the fitted optimal binning. Parameters ---------- x : array-like, shape = (n_samples,) T...
(self, x, metric='woe', metric_special=0, metric_missing=0, show_digits=2, check_input=False)
[ 0.002183751203119755, -0.010687426663935184, 0.02202257700264454, 0.012149429880082607, -0.009216170758008957, -0.07698648422956467, -0.03717929124832153, -0.015600867569446564, 0.00840189028531313, 0.0038261914160102606, -0.008489795960485935, 0.010058210231363773, 0.0600716657936573, -0....
4,774
optbinning.binning.multidimensional.binning_2d
OptimalBinning2D
Optimal binning of two numerical variables with respect to a binary target. Parameters ---------- name_x : str, optional (default="") The name of variable x. name_y : str, optional (default="") The name of variable y. dtype_x : str, optional (default="numerical") The d...
class OptimalBinning2D(OptimalBinning): """Optimal binning of two numerical variables with respect to a binary target. Parameters ---------- name_x : str, optional (default="") The name of variable x. name_y : str, optional (default="") The name of variable y. dtype_x : st...
(name_x='', name_y='', dtype_x='numerical', dtype_y='numerical', prebinning_method='cart', strategy='grid', solver='cp', divergence='iv', max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, min_bin_n_nonevent=None,...
[ 0.03155966475605965, -0.010035772807896137, -0.056887801736593246, 0.031881291419267654, -0.015066222287714481, -0.0465153269469738, -0.101714588701725, -0.01498581562191248, -0.053108684718608856, -0.08273858577013016, -0.02203145995736122, 0.03172047808766365, -0.00004997941505280323, -0...
4,776
optbinning.binning.multidimensional.binning_2d
__init__
null
def __init__(self, name_x="", name_y="", dtype_x="numerical", dtype_y="numerical", prebinning_method="cart", strategy="grid", solver="cp", divergence="iv", max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bin...
(self, name_x='', name_y='', dtype_x='numerical', dtype_y='numerical', prebinning_method='cart', strategy='grid', solver='cp', divergence='iv', max_n_prebins_x=5, max_n_prebins_y=5, min_prebin_size_x=0.05, min_prebin_size_y=0.05, min_n_bins=None, max_n_bins=None, min_bin_size=None, max_bin_size=None, min_bin_n_nonevent...
[ 0.03095758520066738, -0.014426383189857006, -0.07391076534986496, 0.037514183670282364, -0.03105071745812893, -0.06169164925813675, -0.10177631676197052, -0.027120482176542282, -0.03859453275799751, -0.06582677364349365, -0.028387099504470825, 0.025686226785182953, -0.00868935789912939, 0....
4,784
optbinning.binning.multidimensional.binning_2d
_fit
null
def _fit(self, x, y, z, check_input): time_init = time.perf_counter() if self.verbose: logger.info("Optimal binning started.") logger.info("Options: check parameters.") _check_parameters(**self.get_params()) # Pre-processing if self.verbose: logger.info("Pre-processing starte...
(self, x, y, z, check_input)
[ -0.002758630784228444, -0.005427592899650335, -0.048062413930892944, 0.00405355216935277, -0.03181656077504158, -0.05856947600841522, -0.07198812812566757, -0.03609955683350563, -0.03228072449564934, -0.051522571593523026, -0.04401149973273277, 0.0206448957324028, -0.023398252204060555, -0...
4,785
optbinning.binning.multidimensional.binning_2d
_fit_optimizer
null
def _fit_optimizer(self, splits_x, splits_y, NE, E): if self.verbose: logger.info("Optimizer started.") time_init = time.perf_counter() # Min/max number of bins (bin size) if self.min_bin_size is not None: min_bin_size = int(np.ceil(self.min_bin_size * self._n_samples)) else: ...
(self, splits_x, splits_y, NE, E)
[ 0.014642201364040375, -0.020256878808140755, -0.06269223988056183, 0.012050040997564793, -0.04319599270820618, -0.03096580319106579, -0.062171805649995804, -0.04779982939362526, -0.07350124418735504, -0.043476227670907974, -0.022778980433940887, 0.005081734620034695, -0.025501249358057976, ...