Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vif reporting #91

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion skorecard/skorecard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import warnings
import numpy as np
import pandas as pd

from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.pipeline import Pipeline, make_pipeline
Expand Down Expand Up @@ -338,10 +339,23 @@ def get_stats(self):

def summary(self):
"""Get the summary of all the bucketers."""
raise NotImplementedError("Not implemented yet")
# raise NotImplementedError("Not implemented yet")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I think should be removed if its working.

check_is_fitted(self)
return self.bucketing_.summary()

def get_correlation(self, X, method="pearson"):
"""Get correlation matrix and VIF-values for transformed features."""
X_transform = self.woe_transform(X)
correlation = X_transform.corr(method)

vif = pd.DataFrame(index=X_transform.columns)
corr_inv = np.linalg.inv(correlation.to_numpy())
vif["VIF"] = np.diagonal(corr_inv)

self.correlation_dict_ = {"correlation": correlation, "vif": vif}

return self.correlation_dict_

def prebucket_table(self, column):
"""Get the prebucket_table.

Expand Down