Skip to content

Commit

Permalink
refactoring to use annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
bpiwowar committed May 31, 2024
1 parent 697549c commit bc2f562
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/datamaestro/data/ml.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
"""Machine learning generic data formats"""
from typing import List
from typing import Generic, TypeVar, Optional
from pathlib import Path
from . import Base, argument
from experimaestro import Param, Meta, argument
from . import Base

Train = TypeVar("Train", bound=Base)
Validation = TypeVar("Validation", bound=Base)
Test = TypeVar("Test", bound=Base)

@argument("train", type=Base, help="The training dataset")
@argument("validation", type=Base, help="The validation dataset", required=False)
@argument("test", type=Base, help="The test dataset", required=False)
class Supervised(Base):
pass

class Supervised(Base, Generic[Train, Validation, Test]):
train: Param[Base]
"""The training dataset"""

validation: Param[Optional[Base]] = None
"""The validation dataset (optional)"""

test: Param[Optional[Base]] = None
"""The training optional"""


@argument("path", type=Path)
@argument("classes")
class FolderBased(Base):
"""Classification dataset where folders give the basis"""

pass
path: Meta[Path]

0 comments on commit bc2f562

Please sign in to comment.