Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Updated the Dataset class to consume and internally store data as a dictionary of 1D arrays (column-oriented) instead of a 2D numpy array. This improves flexibility for data ingestion and potentially allows for more efficient column-wise operations. Backward compatibility is maintained via a .data property that reconstructs the 2D array on demand. project, datavector, and records methods were updated to work with the new internal structure, including fixes for integer indexing and empty domain edge cases.


PR created automatically by Jules for task 8191121789214501636 started by @ryan112358

- Modified `Dataset.__init__` to accept either a 2D numpy array (n x d) or a dictionary of 1D arrays.
- Internally, data is now stored as `self._data`, a dictionary of 1D arrays keyed by attribute name.
- Added a `@property` `data` to return the 2D array representation for backward compatibility.
- Updated `project`, `records`, and `datavector` methods to utilize the internal dictionary representation efficiently.
- Updated `project` to handle integer indexing by resolving to attribute names.
- Fixed edge cases for empty domains in `datavector` and `records`.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

google-labs-jules bot and others added 5 commits December 19, 2025 23:15
- Update `Dataset.__init__` to accept either a 2D numpy array or a dictionary of 1D arrays (keyed by attribute).
- Internally store data as `self._data`, a dictionary of 1D arrays.
- Add `data` property to reconstruct the 2D array on demand for backward compatibility.
- Update `project`, `records`, and `datavector` to use the dictionary representation.
- Ensure `self.weights` is always initialized (defaults to ones) and validate consistency with data size.
- Handle edge cases for empty domains/data correctly.
- Refactored `Dataset` to store data internally as a dictionary of 1D arrays (`_data`) instead of a 2D array.
- Updated `Dataset.__init__` to accept either a dictionary of 1D arrays or a 2D array (legacy support).
- Removed the public `.data` attribute and added `.to_dict()` method for accessing raw data.
- Added type hints to `Dataset` class and methods.
- Updated binaries in `mechanisms/` and `src/mbi/experimental/` to use `.to_dict()` instead of accessing `.data`.
- Updated internal methods (`project`, `records`, `datavector`) to use the new dictionary representation.
- Enforced weight initialization logic: weights are required if data implies N cannot be inferred; otherwise defaults to ones.
@ryan112358 ryan112358 marked this pull request as ready for review December 22, 2025 20:21
@ryan112358 ryan112358 merged commit 97d9bf1 into master Dec 22, 2025
2 checks 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