AsIsNumericalBucketer
Bases: BaseBucketer
The AsIsNumericalBucketer
transformer creates buckets by treating the existing unique values as boundaries.
Support:
This is bucketer is useful when you have data that is already sufficiented bucketed, but you would like to be able to bucket new data in the same way.
Example:
from skorecard import datasets
from skorecard.bucketers import AsIsNumericalBucketer
X, y = datasets.load_uci_credit_card(return_X_y=True)
bucketer = AsIsNumericalBucketer(variables=['LIMIT_BAL'])
bucketer.fit_transform(X)
Source code in skorecard/bucketers/bucketers.py
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
|
variables_type
property
¶
Signals variables type supported by this bucketer.
__init__(right=True, variables=[], specials={}, missing_treatment='separate', remainder='passthrough', get_statistics=True)
¶
Init the class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
right |
boolean
|
Is the right value included in a range (default) or is 'up to not but including'. For example, if you have [5, 10], the ranges for right=True would be (-Inf, 5], (5, 10], (10, Inf] or [-Inf, 5), [5, 10), [10, Inf) for right=False |
True
|
variables |
list
|
The features to bucket. Uses all features if not defined. |
[]
|
specials |
dict
|
(nested) dictionary of special values that require their own binning.
The dictionary has the following format:
{" |
{}
|
missing_treatment |
str or dict
|
Defines how we treat the missing values present in the data.
If a string, it must be one of the following options:
separate: Missing values get put in a separate 'Other' bucket: |
'separate'
|
remainder |
str
|
How we want the non-specified columns to be transformed. It must be in ["passthrough", "drop"]. passthrough (Default): all columns that were not specified in "variables" will be passed through. drop: all remaining columns that were not specified in "variables" will be dropped. |
'passthrough'
|
Source code in skorecard/bucketers/bucketers.py
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
|