-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [ ] I have assigned ranges (e.g. `>=0.1, <0.2`) to all new dependencies (allows dependabot to keep dependency ranges wide for better compatibility) Fixes #[issue_nr_here]. ## Notes for reviewers Reviewers can skip X, but should pay attention to Y.
- Loading branch information
Showing
4 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from dataclasses import dataclass | ||
|
||
import polars as pl | ||
|
||
from .feature_specs import AggregatedValueFrame, Aggregator, SlicedFrame | ||
|
||
|
||
@dataclass | ||
class MeanAggregator(Aggregator): | ||
name: str = "mean" | ||
|
||
def apply(self, sliced_frame: SlicedFrame, column_name: str) -> AggregatedValueFrame: | ||
df = sliced_frame.df.group_by( | ||
sliced_frame.pred_time_uuid_col_name, maintain_order=True | ||
).agg(pl.col(column_name).mean()) | ||
# TODO: Figure out how to standardise the output column names | ||
|
||
return AggregatedValueFrame(df=df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters