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

fix CFRL tabular example #651

Merged

Conversation

RobertSamoilescu
Copy link
Collaborator

@RobertSamoilescu RobertSamoilescu commented May 5, 2022

This PR fixes an error in the AE training procedure.
Previously, the AE target was set as follows:

trainset_input = heae_preprocessor(X_train).astype(np.float32)
trainset_outputs = {
    "output_1": X_train_ohe[:, :len(numerical_ids)]
}
...

where

preprocessor = ColumnTransformer(
    transformers=[
        ("cat", cat_transf, categorical_ids),
        ("num", num_transf, numerical_ids),
    ],
    sparse_threshold=0
)
X_train_ohe = preprocessor.transform(X_train)

This wrongly assumed that the preprocessor outputs the numerical columns and then the categorical ones.

To fix the issue, one can use the output of the heae_preprocess which always outputs first the numerical columns and then the categorical ones.

trainset_input = heae_preprocessor(X_train).astype(np.float32)
trainset_outputs = {
    "output_1": trainset_input[:, :len(numerical_ids)]
}

Might be related to the issue #573

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #651 (034a910) into master (a3d9023) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #651   +/-   ##
=======================================
  Coverage   80.46%   80.46%           
=======================================
  Files          77       77           
  Lines       10635    10635           
=======================================
  Hits         8557     8557           
  Misses       2078     2078           
Impacted Files Coverage Δ
alibi/explainers/cfproto.py 75.53% <0.00%> (ø)

@RobertSamoilescu RobertSamoilescu merged commit 16c4a3f into SeldonIO:master May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant