Skip to content

Commit

Permalink
using pandas as default data collector
Browse files Browse the repository at this point in the history
  • Loading branch information
Laouen committed Jun 1, 2024
1 parent 83d0431 commit 2e7a18b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions thoi/measures/gaussian_copula.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from typing import Optional, Callable

from tqdm.autonotebook import tqdm
from functools import partial

import pandas as pd
import scipy as sp
import numpy as np
import torch
from torch.utils.data import DataLoader

from ..dataset import CovarianceDataset
from ..collectors import batch_to_csv


def gaussianCopula(X):
Expand Down Expand Up @@ -142,14 +145,14 @@ def multi_order_measures(X: np.ndarray,
pd.DataFrame: DataFrame containing computed metrics.
"""

T, N = X.shape
max_order = N if max_order is None else max_order

if batch_aggregation is None:
batch_aggregation = lambda X: [x for x in X if x is not None]
batch_aggregation = pd.concat

if batch_data_collector is None:
batch_data_collector = lambda *args: args

T, N = X.shape
max_order = N if max_order is None else max_order
batch_data_collector = partial(batch_to_csv, N=N)

assert max_order <= N, f"max_order must be lower or equal than N. {max_order} > {N})"
assert min_order <= max_order, f"min_order must be lower or equal than max_order. {min_order} > {max_order}"
Expand Down

0 comments on commit 2e7a18b

Please sign in to comment.