Skip to content

Expose n_epochs on novel_train and simple_mlp_train - #57

Merged
rcannood merged 2 commits into
mainfrom
feat/expose-training-epochs
Jul 30, 2026
Merged

Expose n_epochs on novel_train and simple_mlp_train#57
rcannood merged 2 commits into
mainfrom
feat/expose-training-epochs

Conversation

@rcannood

Copy link
Copy Markdown
Member

Depends on #56 -- branched off it, so please merge that one first.

A long-running method should expose whatever bounds its work and cap it for CI,
rather than hardcoding it. novel had for i in range(100) buried in
helper_functions.py, and simple_mlp took its epoch count from the bundled model
yaml, so neither could be sped up for a test run or tuned by a user.

  • novel_train: --n_epochs (default 100) bounds the training loop
  • simple_mlp_train: --n_epochs overrides the value in the bundled model config
    when given, otherwise the yaml still wins
  • Both cap at 2 during viash test via info.test_default, so the real defaults
    are untouched

Checked what the harness actually resolves rather than inferring it from the runtime:

scenario 'run': --n_epochs resolves to 2
before  novel_train        EXIT=0 WALL=37s
after   novel_train        EXIT=0 WALL=13s
before  simple_mlp_train   EXIT=0 WALL=12s
after   simple_mlp_train   EXIT=0 WALL=12s

(simple_mlp was already only 10 epochs, so its test time is all image build.)

Also in scripts/create_datasets/test_resources.sh:

  • Each step is skipped when its output exists and is no older than the dataset's
    state.yaml, so re-running after a partial failure doesn't redo everything.
    FORCE=1 regenerates.
  • The model fixtures train for 2 epochs -- they only need to exercise the predict
    components, not be any good.

The up_to_date helper is checked against the cases that matter:

output missing                        REBUILD
output newer than inputs              SKIP
one input newer than output           REBUILD
empty directory output                REBUILD
non-empty dir newer than inputs       SKIP
non-empty dir older than an input     REBUILD
FORCE=1 with fresh output             REBUILD

rcannood added 2 commits July 30, 2026 11:18
Without one, `run_and_check_output` cannot resolve a value for `--output` and
every `*_train` component fails its test with "--output is a required argument".
* Bound novel's training loop with `--n_epochs` rather than `range(100)`
* Let `--n_epochs` override the epochs in simple_mlp's bundled model config
* Cap both at 2 during `viash test` with `info.test_default`
* Skip a step in `test_resources.sh` when its output is already there, and
  train the model fixtures for 2 epochs
@rcannood
rcannood merged commit efd797e into main Jul 30, 2026
4 checks passed
@rcannood
rcannood deleted the feat/expose-training-epochs branch July 30, 2026 09:40
rcannood added a commit to benjaminfreyuu/task_predict_modality that referenced this pull request Jul 30, 2026
* Cap the boosting rounds, early stopping patience and nn epochs with
  `info.test_default`, the way openproblems-bio#57 did for the other two train components
* Fold the senkin_tmp fixture into the skip-if-up-to-date structure that
  came in with openproblems-bio#57
rcannood added a commit that referenced this pull request Jul 30, 2026
* Add SenKin CITE-seq method (LightGBM + GRU ensemble)

* Use senkin_tmp_cite_pred log_normalize and clr_tsvd helpers

Replace the inline _lognorm and _clr_tsvd_fitted duplicates in senkin_train
with the now-published library functions log_normalize() and clr_tsvd() from
senkin_tmp_cite_pred.preprocess. Behaviour is unchanged: log_normalize uses
target_sum=1e4 (CP10K + log1p) matching the old _lognorm, and clr_tsvd uses
random_state=42 for reproducible components. The previously-kept fitted TSVD
object was unused and is dropped.

* Densify log_normalize output before array slicing

log_normalize() preserves the input sparsity, so on the sparse counts layer it
returns a sparse matrix. np.asarray() on a sparse matrix yields a 0-d object
array, which crashed at X_lognorm_all[train_mask] with an IndexError. Use the
existing _to_dense() helper (and restore float64) so the downstream boolean-mask
slicing and concatenation work, matching the previous inline _lognorm behaviour.

Verified: viash test src/methods/senkin/senkin_train passes (1/1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* register senkin, fix its method id, and drop the unused gpu label

* Add methods/senkin to run_benchmark's dependencies -- it was in the
  methods list but not declared, so the generated workflow referenced an
  undefined variable and the whole run died at startup
* Report "senkin" as the method id rather than senkin_predict; the
  metrics copy uns["method_id"] straight into the score
* Drop the gpu label: measured on a T4, senkin runs entirely on CPU
  (LightGBM's pip wheel is CPU-only and dominates the runtime, and
  TensorFlow cannot load CUDA in this image)
* Give senkin_predict a test_setup and generate its model in
  test_resources.sh, so viash test has an --input_model to use

* rename senkin to senkin_tmp, update doi

* Rename the method and both sub-components to `senkin_tmp`, so the name
  credits both team members
* Point the doi at the 2026 competition paper (10.64898/2026.02.24.707614)

Co-authored-by: Vladimir Shitov <35199218+VladimirShitov@users.noreply.github.com>

* cap senkin_tmp's training settings during viash test

* Cap the boosting rounds, early stopping patience and nn epochs with
  `info.test_default`, the way #57 did for the other two train components
* Fold the senkin_tmp fixture into the skip-if-up-to-date structure that
  came in with #57

* update label

* Add test resources

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com>
Co-authored-by: Vladimir Shitov <35199218+VladimirShitov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant