Skip to content

fix CFRL tabular example#651

Merged
RobertSamoilescu merged 2 commits intoSeldonIO:masterfrom
RobertSamoilescu:cfrl_tabular_example
May 6, 2022
Merged

fix CFRL tabular example#651
RobertSamoilescu merged 2 commits intoSeldonIO:masterfrom
RobertSamoilescu:cfrl_tabular_example

Conversation

@RobertSamoilescu
Copy link
Contributor

@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