sundar0989 / woe-and-iv Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
still is not clear
is it better than chi^2 or mutual info?
Hi Sundar,
I am new to Python and found this code to be extremely helpful. Could you explain what this section of the code is doing in the data_vars function?
stack = traceback.extract_stack() filename, lineno, function_name, code = stack[-2] vars_name = re.compile(r'\((.*?)\).*$').search(code).groups()[0] final = (re.findall(r"[\w']+", vars_name))[-1]
The reason why I ask is because I got an error in the vars_name line and I'm not sure what is happening here:
TypeError: expected string or buffer
From some quick StackOverflow searches, I believe this means it is expecting a string from "code", but it is being fed some other data type, perhaps a list. I quickly added a line to print the type of code and then the python script started working flawlessly.
stack = traceback.extract_stack() filename, lineno, function_name, code = stack[-2] print(type(code)) vars_name = re.compile(r'\((.*?)\).*$').search(code).groups()[0] final = (re.findall(r"[\w']+", vars_name))[-1]
I'm a bit confused as to what happened, and why adding print(type(code)) would fix the issue. Could you provide some insight?
Thanks!
Brian
i think that it's a great idea, but in my opinion you don't consider the number of cases of the different categories of example if you have two cases of 'married' and the two persons have positive class, the WOE of the married category will be very high, and maybe it's category don't have enough cases
FIRST Variable: x1
Y = SF_Train5['y']
X = SF_Train5['x1']
max_bin = 10
force_bin = 3
WOE_01 , IV_01 = Mono_Bin(Y , X , n = max_bin)
WOE_01
The program works and produces the Output:
SECOND Variable: x4
Y = SF_Train5['y']
X = SF_Train5['x4']
max_bin = 10
force_bin = 3
WOE_04 , IV_04 = Mono_Bin(Y , X , n = max_bin)
WOE_04
The program does NOT work and produces the ValueError:
ValueError: percentiles should all be in the interval [0, 1].
if len(d2) == 1:
35 n = force_bin
---> 37 bins = df1.quantile(notmiss.X, np.linspace(0, 1, n))
I have compared the range of values within the two variables which had previously been transformed
using the Min_Max Scaler to be between 0 and 100 as well as the separation of their percentile values.
No Apparent Reason why the code should work with all my data variables except this one??
The output table from your example produces the actual name of the column ( VAR_NAME) in the input dataframe
for which the WOE is being computed. However when I run the code on my data my table ( VAR_NAME) does not
have the actual name in the table but simply VAR for each and every variable on each run through my dataframe columns...
I would appreciate some help with fixing the above two problems.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.