Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Loop): also added project_hyperparameters to TrainedPipelineCard #531

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/fold/base/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ class PipelineCard:

@dataclass
class TrainedPipelineCard:
name: str
project_name: str
preprocessing: TrainedPipelines
pipeline: TrainedPipelines
event_labeler: Optional[Labeler]
event_filter: Optional[EventFilter]
project_hyperparameters: Optional[dict] = None


def fit_noop(
Expand Down
10 changes: 5 additions & 5 deletions src/fold/loop/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def infer(
last_pipeline = _set_metadata(
last_pipeline,
Composite.Metadata(
project_name=pipelinecard.name,
project_hyperparameters=None,
project_name=pipelinecard.project_name,
project_hyperparameters=pipelinecard.project_hyperparameters,
fold_index=0,
target="target",
inference=True,
Expand All @@ -52,10 +52,10 @@ def infer(
preprocessing = _set_metadata(
preprocessing,
Composite.Metadata(
project_name=f"{pipelinecard.name}-Preprocessing"
if pipelinecard.name is not None
project_name=f"{pipelinecard.project_name}-Preprocessing"
if pipelinecard.project_name is not None
else "Preprocessing",
project_hyperparameters=None,
project_hyperparameters=pipelinecard.project_hyperparameters,
fold_index=0,
target="target",
inference=True,
Expand Down
3 changes: 2 additions & 1 deletion src/fold/loop/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ def train(
)

trained_pipelines = TrainedPipelineCard(
name=pipelinecard.project_name or "",
project_name=pipelinecard.project_name or "",
project_hyperparameters=pipelinecard.project_hyperparameters,
preprocessing=[pd.Series(p, index=[0]) for p in trained_preprocessing_pipeline]
if pipelinecard.preprocessing
else None,
Expand Down
3 changes: 2 additions & 1 deletion src/fold/loop/updating.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def update(
backend=backend,
)
return TrainedPipelineCard(
name=pipelinecard.name,
project_name=pipelinecard.project_name,
project_hyperparameters=pipelinecard.project_hyperparameters,
preprocessing=preprocessing_pipelines,
pipeline=pipeline,
event_filter=pipelinecard.event_filter,
Expand Down
Loading