TEA EEG analysis and age curves, TEA jobs; CaMa recurrence on METABRIC and SCAN-B; reference-data models and routine runs
This commit is contained in:
+22
-5
@@ -40,7 +40,7 @@ def _jobs(domain: str):
|
||||
|
||||
class Training(dg.Config):
|
||||
domain: str
|
||||
models: list[str] = [] # default: every model of the domain
|
||||
models: list[str] = [] # default: every model of the domain but the slow ones
|
||||
as_of: str | None = None # the date the data are taken up to (default: today)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ def train_models(context: dg.OpExecutionContext, config: Training) -> dict:
|
||||
jobs = _jobs(config.domain)
|
||||
as_of = date.fromisoformat(config.as_of) if config.as_of else None
|
||||
found = {}
|
||||
for name in config.models or list(jobs.MODELS):
|
||||
for name in config.models or jobs.JOBS.routine():
|
||||
found[name] = jobs.train(name, as_of)
|
||||
context.log.info(f"{config.domain}.{name}: version {found[name]}")
|
||||
return found
|
||||
@@ -70,10 +70,10 @@ class Scoring(dg.Config):
|
||||
def score_models(context: dg.OpExecutionContext, config: Scoring) -> dict:
|
||||
"""Each model's champion scores its cohort; then gold's risk tables are rebuilt."""
|
||||
jobs = _jobs(config.domain)
|
||||
found = {name: jobs.score(name) for name in config.models or list(jobs.MODELS)}
|
||||
found = {name: jobs.score(name) for name in config.models or jobs.JOBS.routine()}
|
||||
for name, version in found.items():
|
||||
context.log.info(f"{name}: " + (f"version {version}" if version else "no champion"))
|
||||
silver.build([f"{config.domain}_risk+"])
|
||||
silver.build([getattr(jobs, "GOLD", f"{config.domain}_risk") + "+"])
|
||||
return found
|
||||
|
||||
|
||||
@@ -82,4 +82,21 @@ def score():
|
||||
score_models()
|
||||
|
||||
|
||||
defs = dg.Definitions(jobs=[ingest, train, score])
|
||||
class Analysis(dg.Config):
|
||||
domain: str
|
||||
|
||||
|
||||
@dg.op
|
||||
def analyze_studies(context: dg.OpExecutionContext, config: Analysis) -> int:
|
||||
"""The domain's studies a model reads whole (TEA: each EEG not analysed yet)."""
|
||||
found = _jobs(config.domain).analyze()
|
||||
context.log.info(f"{config.domain}: {found} analysed")
|
||||
return found
|
||||
|
||||
|
||||
@dg.job(tags=WRITES)
|
||||
def analyze():
|
||||
analyze_studies()
|
||||
|
||||
|
||||
defs = dg.Definitions(jobs=[ingest, train, score, analyze])
|
||||
|
||||
Reference in New Issue
Block a user