synthesized-io / insight

🧿 Metrics & Monitoring of Datasets
BSD 3-Clause "New" or "Revised" License
12 stars 0 forks source link

Be able to effectively plot visualizations of different metrics #68

Closed simonhkswan closed 1 year ago

simonhkswan commented 2 years ago

Say you have a Metric and you only know what its Abstract Type is (i.e., Column, TwoColumn, etc.)

Can you write some functions to evaluate the metric. on the dataframes and then provide useful plots of the metrics.

class AvgColumnMetric(DataFrameMetric):
    """Adapter class"""
    def __init__(self, metric: ColumnMetric):
        self._metric = metric
        self.name = f"avg_{self._metric.name}"

    def call(df: pd.DataFrame):
        values = [self._metric(df[col]) for col in df.columns]
        return np.mean(values)

Column -> value for each column, a colour for each dataframe as a bar chart TwoColumn:

simonhkswan commented 1 year ago

https://datalore.jetbrains.com/notebook/e3ikUrmZAwbbY4rGVg19po/xAkBAmHTr1reqAGXOvhxBB/