kiraplenkin / woe_scoring Goto Github PK
View Code? Open in Web Editor NEWMonotone Weight Of Evidence Transformer and LogisticRegression model with scikit-learn API
License: MIT License
Monotone Weight Of Evidence Transformer and LogisticRegression model with scikit-learn API
License: MIT License
Num binning ->
while (_mono_flags(bad_rates) is False) and (len(bad_rates) > 2):
and to top
_mono_flags ->
return True in [positive_mono_diff, negative_mono_diff]
bins.extend(
np.nanquantile(x, quantile / max_bins, axis=0)
for quantile in range(1, max_bins)
)
->
_, nbins = pd.qcut(x, q= max_bins, retbins=True)
bins += list(nbins)
Req model_results information
Change to numpy.diff
q_list = list(sorted(set(q_list)))
new_bins = [copy.deepcopy(bad_rates[0]["bin"])]
start = 1
for i in range(len(q_list) - 1):
for n in range(start, len(bad_rates)):
if (bad_rate_list[n] >= q_list[i]) & (
bad_rate_list[n] < q_list[i + 1]
):
try:
new_bins[i] += bad_rates[n]["bin"]
start += 1
except IndexError:
new_bins.append([])
new_bins[i] += bad_rates[n]["bin"]
start += 1
Class CreateModel
Method fit
save_report = True
with open("./model_wald.txt", "w") as fh:
fh.write(temp_model.wald_test_terms().as_text())
Add max_bins=-1
retrain = False
to_drop = []
for i, pvalue in enumerate(self.model.wald_test_terms().table["pvalue"]):
if pvalue > 0.05:
to_drop.append(self.model.wald_test_terms().table.index[i])
retrain = True
if retrain:
self.feature_names_ = [feature for feature in self.feature_names_ if feature not in to_drop]
self.model = sm.Logit(y, sm.add_constant(x[self.feature_names_])).fit()
(good + 0.5 / all_good) / (bad + 0.5 / all_bad)
all_bad = y[~pd.isna(x)].sum()
all_good = len(y[~pd.isna(x)]) - all_bad
434 if self.save_reports:
435 try:
436 with open(
AttributeError: 'CreateModel' object has no attribute 'save_reports'
while (_mono_flags(bad_rates) is False) and (len(bad_rates) > 2):
try: X = X.astype(float) except ValueError: X = X.astype(object)
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.