Esempio n. 1
0
 def apply_projection(self, dataset_split: Split) -> Split:
     """
     Index subset return
     """
     return Split(
         **{
             k: self.indexing_method(v, self.indices)
             for k, v in dataset_split.items()
         }).squeeze()
Esempio n. 2
0
def split_to_ordered_tuple(split: Split) -> Tuple:
    """
    Helper to convert a split object into an ordered tuple of
    X, y, other
    """
    return_objects = []
    X = split.X
    y = split.y

    if X is not None:
        return_objects.append(X)
    if y is not None:
        return_objects.append(y)

    for k, v in split.items():
        if k not in ("X", "y") and v is not None:
            return_objects.append(v)
    return return_objects