Skip to content
Open
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
2 changes: 1 addition & 1 deletion pcntoolkit/dataio/norm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from __future__ import annotations

import copy
import json
from filelock import FileLock
import os
from collections import defaultdict
from functools import reduce
Expand Down
9 changes: 9 additions & 0 deletions pcntoolkit/normative_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import importlib.metadata
import json
import os
import warnings
from typing import List, Optional, Tuple, Union

import numpy as np
Expand Down Expand Up @@ -205,6 +206,14 @@ def transfer(self, transfer_data: NormData, save_dir: str | None = None, **kwarg
new_model.response_vars = respvar_intersection

new_model.preprocess(transfer_data)

if hasattr(self, "batch_effects") and hasattr(transfer_data, "batch_effects"):
if len(transfer_data.batch_effects) < len(self.batch_effects):
warnings.warn(
"Transfer dataset contains fewer batch effects than the training dataset. "
"This may lead to biased transfer corrections.",
UserWarning,
)
new_model.register_batch_effects(transfer_data)

Output.print(Messages.TRANSFERRING_MODELS, n_models=len(respvar_intersection))
Expand Down