Esempio n. 1
0
    def _fit(self, dataset: Dataset) -> Preprocessor:
        if self.strategy == "mean":
            aggregates = [Mean(col) for col in self.columns]
            self.stats_ = dataset.aggregate(*aggregates)
        elif self.strategy == "most_frequent":
            self.stats_ = _get_most_frequent_values(dataset, *self.columns)

        return self
Esempio n. 2
0
 def get_max_a(ds: Dataset):
     # Calculate max value for column A.
     max_a = ds.aggregate(Max("A"))
     return max_a
Esempio n. 3
0
def get_max(ds: Dataset):
    return ds.aggregate(Max("value"))
Esempio n. 4
0
 def _fit(self, dataset: Dataset) -> Preprocessor:
     aggregates = [Agg(col) for Agg in [Min, Max] for col in self.columns]
     self.stats_ = dataset.aggregate(*aggregates)
     return self
Esempio n. 5
0
 def _fit(self, dataset: Dataset) -> Preprocessor:
     mean_aggregates = [Mean(col) for col in self.columns]
     std_aggregates = [Std(col, ddof=self.ddof) for col in self.columns]
     self.stats_ = dataset.aggregate(*mean_aggregates, *std_aggregates)
     return self