8000 Explicitly compare given feature list and specified feature list in TableRowClassifier · Issue #19 · haesleinhuepf/apoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Explicitly compare given feature list and specified feature list in TableRowClassifier #19

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

Open
haesleinhuepf opened this issue Mar 28, 2022 · 1 comment

Comments

@haesleinhuepf
Copy link
Owner

I have the suspicion that a TableRowClassifier trained with features "A B C" would also be applicable to a table with columns "E D F". We should check if provided tables contains the right columns.

This issue may be have been introduced with #17

@kevinyamauchi
Copy link
Collaborator

I believe we are already do that here:

ordered_features = self.order_feature_table(feature_table)

def order_feature_table(self, feature_table: Dict[str, np.ndarray]) -> List[np.ndarray]:
"""Coerce a feature table into the format required by the classifier.
Parameters
----------
feature_table : Dict[str, Union[List[float], np.ndarray]]
The table from which to make the prediction. Each row of the table
will be classified. The table can either be a pandas DataFrame or a
Dict with string keys (column names) and numpy array columns.
Returns
-------
ordered_features : List[np.ndarray]
The features stored in a list. The order of the features is
specified by self.ordered_feature_names
"""
return [np.asarray(feature_table[feature]) for feature in self.ordered_feature_names]

This should throw a key error if the the required columns aren't present in the feature table. We should add a test to check though!

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

2 participants
0