Skip to content

Features for InterScale#62

Merged
FrancescaDr merged 7 commits intotheislab:mainfrom
FrancescaDr:one_hot_encode
Aug 6, 2025
Merged

Features for InterScale#62
FrancescaDr merged 7 commits intotheislab:mainfrom
FrancescaDr:one_hot_encode

Conversation

@FrancescaDr
Copy link
Collaborator

Added possibility to add:

  • var variables in addition to obs (to_category_iterator)
  • one_hot_encoding for features to perform mapping back to feature names
  • save preprocessed adata object for train, test and val

selmanozleyen
selmanozleyen previously approved these changes Jul 8, 2025
Copy link
Collaborator

@selmanozleyen selmanozleyen left a comment

Choose a reason for hiding this comment

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

Hi thanks for the PR!

After removing the print statements and besides my comments I will still give an appoval to speed up the development on this project.

category: str
axis: Literal[0, 1, "obs", "var"] = "obs"
preserve_categories: bool = True
preserve_categories: Optional[list[str]] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this idea but I think it might be better if we do it like this

preserve_categories: Optional[list[str]] = []

So empty list by default which would mean no preservation. And if it is None that would mean all categories. So then it would make sense to change the variable name to preserved_categories. Also to make the typing more modern finally it would look like this

preserved_categories: Sequence[str] | None = tuple()

here default is tuple instead because its not good to have default arguments as mutuable objects. Could you also update docstring with that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the review.

If we change preserved_categories to a tuple then how are we to distinguish between the "obs" and "var" variables?

Copy link
Collaborator

Choose a reason for hiding this comment

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

But we specify if its a var or obs in axis right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes true. I am now questioning whether this even works for .var. In the Ann2DataByCategory object the ToCategoryIterator is by default initialised with obs. Also in thetest_to_category_iterator() there is nothing tested for "var". Am I overlooking where the ToCategoryIteratorwould be initialised withaxis = var`?

@FrancescaDr FrancescaDr merged commit d139243 into theislab:main Aug 6, 2025
1 check passed
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