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

Common superclass for transformers #61

Closed
lars-reimann opened this issue Mar 22, 2023 · 2 comments · Fixed by #108
Closed

Common superclass for transformers #61

lars-reimann opened this issue Mar 22, 2023 · 2 comments · Fixed by #108
Assignees
Labels
cleanup 🧹 Refactorings and other tasks that improve the code released Included in a release

Comments

@lars-reimann
Copy link
Member

lars-reimann commented Mar 22, 2023

Is your feature request related to a problem?

Transformers currently contain a lot of copied & pasted documentation. We also don't have a type to express that we expect/return any transformer.

Desired solution

A common superclass (abstract base class) for transformers:

  • TableTransformer (fit, transform, fit_transform)
  • InvertibleTableTransformer (adds an inverse_transform method)

Possible alternatives (optional)

No response

Screenshots (optional)

No response

Additional Context (optional)

No response

@lars-reimann lars-reimann added enhancement 💡 New feature or request cleanup 🧹 Refactorings and other tasks that improve the code and removed enhancement 💡 New feature or request labels Mar 22, 2023
@lars-reimann
Copy link
Member Author

The fit methods of the different existing transformers currently don't have a common interface. Some can be applied to only one column, some can only be applied to all columns, some can be applied to a list of columns. This must be normalized first.

@lars-reimann lars-reimann self-assigned this Mar 27, 2023
lars-reimann added a commit that referenced this issue Mar 28, 2023
### Summary of Changes

The `OrdinalEncoder` was a bit of an outlier compared to the other
`Transformer` classes:

* It could only be applied to a single column instead of a list of
columns. Because of this, it was not possible to implement #61.
* Nothing was "learned" since the user had to specify the value order
explicitly. The `fit` step was completely unnecessary.

Therefore, I've removed the class `OrdinalEncoder`. Instead the
`transform_column` method on a `Table` can be used. If eventually find
this to be too cumbersome, we can implement a new method
`transform_column_into_ordered_labels` on `Table`.

---------

Co-authored-by: lars-reimann <lars-reimann@users.noreply.github.com>
lars-reimann added a commit that referenced this issue Mar 28, 2023
Closes #61.
Closes #90.

### Summary of Changes

* Common superclasses `TableTransformer` and
`InvertibleTableTransformer`
* Common interface for `fit`, `transform`, `fit_transform`,
`inverse_transform`
* Return new transformer when calling `fit`
* More thorough tests

---------

Co-authored-by: lars-reimann <lars-reimann@users.noreply.github.com>
lars-reimann pushed a commit that referenced this issue Mar 29, 2023
## [0.7.0](v0.6.0...v0.7.0) (2023-03-29)

### Features

* `sort_rows` of a `Table` ([#104](#104)) ([20aaf5e](20aaf5e)), closes [#14](#14)
* add `_file` suffix to methods interacting with files ([#103](#103)) ([ec011e4](ec011e4))
* improve transformers for tabular data ([#108](#108)) ([b18a06d](b18a06d)), closes [#61](#61) [#90](#90)
* remove `OrdinalEncoder` ([#107](#107)) ([b92bba5](b92bba5)), closes [#61](#61)
* specify features and target when creating a `TaggedTable` ([#114](#114)) ([95e1fc7](95e1fc7)), closes [#27](#27)
* swap `name` and `data` parameters of `Column` ([#105](#105)) ([c2f8da5](c2f8da5))
@lars-reimann
Copy link
Member Author

🎉 This issue has been resolved in version 0.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup 🧹 Refactorings and other tasks that improve the code released Included in a release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant