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

WIP: Update to Python 3.9 and TensorFlow 2 #200

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
38 changes: 38 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
protobuf = "*"
lime = "*"
mip = "*"
numpy = "*"
pandas = "*"
recourse = "*"
scikit-learn = "*"
h5py = "*"
dice-ml = "*"
ipython = "*"
xgboost = "*"
causalgraphicalmodels = "*"
tensorflow = "*"
torch = "*"
torchvision = "*"

[dev-packages]
pre-commit = "*"
pytest = "*"
sphinx = "*"
sphinx-rtd-theme = "*"
sphinx-autodoc-typehints = "*"
numpydoc = "*"
imageio = "*"
ipython = "*"
jinja2 = "*"
networkx = "*"
scipy = "*"
markupsafe = "*"

[requires]
python_version = "3.9"
2,456 changes: 2,456 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions carla/data/pipelining/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def encode(
Whole DataFrame with encoded values
"""
output = df.copy()
encoded_features = fitted_encoder.get_feature_names(features)
encoded_features = fitted_encoder.get_feature_names_out(features)
output[encoded_features] = fitted_encoder.transform(output[features])
output = output.drop(features, axis=1)

Expand Down Expand Up @@ -107,7 +107,7 @@ def decode(
Whole DataFrame with encoded values
"""
output = df.copy()
encoded_features = fitted_encoder.get_feature_names(features)
encoded_features = fitted_encoder.get_feature_names_out(features)

# Prevent errors for datasets without categorical data
# inverse_transform cannot handle these cases
Expand Down
2 changes: 1 addition & 1 deletion carla/models/api/mlmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_mutable_mask(self):
# get categorical features
categorical = self.data.categorical
# get the binary encoded categorical features
encoded_categorical = self.data.encoder.get_feature_names(categorical)
encoded_categorical = self.data.encoder.get_feature_names_out(categorical)
# get the immutables, where the categorical features are in encoded format
immutable = [
encoded_categorical[categorical.index(i)] if i in categorical else i
Expand Down
2 changes: 1 addition & 1 deletion carla/models/catalog/ANN_TF/model_ann.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def weighted_binary_cross_entropy(target, output):
loss = 0.7 * (target * tf.log(output)) + 0.3 * ((1 - target) * tf.log(1 - output))
loss = 0.7 * (target * tf.math.log(output)) + 0.3 * ((1 - target) * tf.math.log(1 - output))
return tf.negative(tf.reduce_mean(loss, axis=-1))


Expand Down
2 changes: 1 addition & 1 deletion carla/models/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(
encoded_features = data.categorical
else:
encoded_features = list(
data.encoder.get_feature_names(data.categorical)
data.encoder.get_feature_names_out(data.categorical)
)

self._catalog = None
Expand Down
26 changes: 13 additions & 13 deletions carla/recourse_methods/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

from .api import RecourseMethod
from .catalog import (
CCHVAE,
CEM,
CRUD,
FOCUS,
ActionableRecourse,
CausalRecourse,
Clue,
Dice,
Face,
FeatureTweak,
# CCHVAE,
# CEM,
# CRUD,
# FOCUS,
# ActionableRecourse,
# CausalRecourse,
# Clue,
# Dice,
# Face,
# FeatureTweak,
GrowingSpheres,
Revise,
Roar,
Wachter,
# Revise,
# Roar,
# Wachter,
)
28 changes: 14 additions & 14 deletions carla/recourse_methods/catalog/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# flake8: noqa
from .actionable_recourse import ActionableRecourse
from .causal_recourse import CausalRecourse
from .cchvae import CCHVAE
from .cem import CEM
from .clue import Clue
from .crud import CRUD
from .dice import Dice
from .face import Face
from .feature_tweak import FeatureTweak
from .focus import FOCUS
# # flake8: noqa
# from .actionable_recourse import ActionableRecourse
# from .causal_recourse import CausalRecourse
# from .cchvae import CCHVAE
# from .cem import CEM
# from .clue import Clue
# from .crud import CRUD
# from .dice import Dice
# from .face import Face
# from .feature_tweak import FeatureTweak
# from .focus import FOCUS
from .growing_spheres import GrowingSpheres
from .revise import Revise
from .roar import Roar
from .wachter import Wachter
# from .revise import Revise
# from .roar import Roar
# from .wachter import Wachter

This file was deleted.

Loading