awslabs / awslabs/graphstorm

Graph construction with Bool features

Open
#521 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Python
Stars
452
Forks
76
PR merge metrics
No merged PRs in 30d

Description

I am constructing graph using gconstruct and I download my data which contains boolean features. There features are the result of one-hot-encoding and they truly can be either 0 or 1.

During the call of gconstruct, I get an exception, that boolean type is not supported (graphstorm/gconstruct/transform.py", line 664):

       assert np.issubdtype(feats.dtype, np.integer) \
                or np.issubdtype(feats.dtype, np.floating), \
                f"The feature {self.feat_name} has to be integers or floats."

I can easily fix that problem by adding an extra check for a value to be of boolean type:

       assert np.issubdtype(feats.dtype, np.integer) \
                or np.issubdtype(feats.dtype, np.floating) \
                or np.issubdtype(feats.dtype, np.bool_), \
                f"The feature {self.feat_name} has to be integers or floats or bools."

The question if this is a valid thing to do? I don't want to recompress data back to int32 because for one-hot-encoding of multiple categories that is wasteful in terms of disk space and networking, but I am not 100% sure that graphstorm does transformation right after adding this condition.

Can someone check if this fix is correct and maybe merge into the main branch?

Thank you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in graphstorm/gconstruct/transform.py around line 664 and trace how feature arrays are handled after the dtype validation. Run gconstruct with boolean one-hot features and compare the resulting transformed data with the integer and floating-point paths. Done means valid boolean features are accepted and transformed correctly without weakening validation for unsupported types.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.