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

Update FeatureBase getters and setters #2161

Open
thehomebrewnerd opened this issue Jun 30, 2022 · 0 comments
Open

Update FeatureBase getters and setters #2161

thehomebrewnerd opened this issue Jun 30, 2022 · 0 comments

Comments

@thehomebrewnerd
Copy link
Contributor

thehomebrewnerd commented Jun 30, 2022

In the FeatureBase object, there are separate methods for getting and setting feature names and feature column names that take the form get_feature_names() and set_feature_names().

These methods should be updated to use a more pythonic approach to getters and setters:

class MyClass(object):
    @property
    def my_attr(self):
        return self._my_attr

    @my_attr.setter
    def my_attr(self, value):
        self._my_attr = value

This this would result in the get_name() method being replaced with a .name property and get_feature_names() being replaced by a .feature_names property.

As these changes would constitute a breaking change, we should first implement the new getter/setter approach while leaving the existing .get_*() methods in place, adding a DeprecationWarning to the existing methods, alerting users they should switch to using the new properties.

As part of this update we should also consider renaming feature_names to column_names as that property actually represents the names of the columns that are added to the feature matrix and would provide more differentiation between the name of the Feature object and the name of the output columns that are generated from the feature.

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

No branches or pull requests

1 participant