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: calculation of nb_dimensions for approximated inverse #137

Closed
wants to merge 3 commits into from

Conversation

tas17
Copy link
Collaborator

@tas17 tas17 commented Sep 24, 2024

No description provided.

@@ -37,7 +38,7 @@ def inverse_transform(
random_gen = np.random.default_rng(model.seed)

# Check dimension size regarding N
n_dimensions = len(model.dummy_categorical) + len(model.original_continuous)
n_dimensions = len(model.dummy_categorical) + len(model.original_continuous) - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
n_dimensions = len(model.dummy_categorical) + len(model.original_continuous) - 1
n_dimensions = len(model.dummy_categorical) + len(model.original_continuous) - nb_variable_categorical

Copy link
Contributor

Choose a reason for hiding this comment

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

could you create unit test of this fix?

Comment on lines +41 to +44
n_dimensions = get_number_of_dimensions_from_categorical_and_continuous(
dummy_categorical=model.dummy_categorical,
original_continuous=model.original_continuous,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: I was first using model: Model as the only input, but as it's a @DataClass, I could not generate a factory for it.
So I went to use that workaround instead

@tas17 tas17 requested a review from jpetot September 24, 2024 16:11
Copy link
Contributor

@jpetot jpetot left a comment

Choose a reason for hiding this comment

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

Sorry if I wasn't clear enough for this point

def get_number_of_dimensions_from_categorical_and_continuous(
*, dummy_categorical: List[Any], original_continuous: List[Any]
) -> int:
return len(dummy_categorical) + len(original_continuous) - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return len(dummy_categorical) + len(original_continuous) - 1
return len(dummy_categorical) + len(original_continuous) - nb_categorical_variable

@tas17 tas17 closed this Sep 25, 2024
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.

2 participants