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

Update uplift and Qini curve plots with a fixed random line #799

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 0 additions & 11 deletions causalml/dataset/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,27 @@


# ------ Define a list of functions for feature transformation
# @staticmethod
def _f_linear(x):
"""
Linear transformation (actually identical transformation)
"""
return np.array(x)


# @staticmethod
def _f_quadratic(x):
"""
Quadratic transformation
"""
return np.array(x) * np.array(x)


# @staticmethod
def _f_cubic(x):
"""
Quadratic transformation
"""
return np.array(x) * np.array(x) * np.array(x)


# @staticmethod
def _f_relu(x):
"""
Relu transformation
Expand All @@ -41,15 +37,13 @@ def _f_relu(x):
return np.maximum(x, 0)


# @staticmethod
def _f_sin(x):
"""
Sine transformation
"""
return np.sin(np.array(x) * np.pi)


# @staticmethod
def _f_cos(x):
"""
Cosine transformation
Expand All @@ -58,7 +52,6 @@ def _f_cos(x):


# ------ Generating non-linear splines as feature transformation functions
# @staticmethod
def _generate_splines(
n_functions=10,
n_initial_points=10,
Expand Down Expand Up @@ -107,15 +100,13 @@ def _generate_splines(
return spls


# @staticmethod
def _standardize(x):
"""
Standardize a vector to be mean 0 and std 1.
"""
return (np.array(x) - np.mean(x)) / np.std(x)


# @staticmethod
def _fixed_transformation(fs, x, f_index=0):
"""
Transform and standardize a vector by a transformation function.
Expand All @@ -139,7 +130,6 @@ def _fixed_transformation(fs, x, f_index=0):
return y


# @staticmethod
def _random_transformation(fs, x):
"""
Transform and standardize a vector by a function randomly chosen from
Expand All @@ -158,7 +148,6 @@ def _random_transformation(fs, x):
return y


# @staticmethod
def _softmax(z, p, xb):
"""
Softmax function. This function is used to reversely solve the constant root value in the linear part to make the
Expand Down
Loading
Loading