agentsclimarketplace

Unit test design for model parameters

Skill HolobiomicsLab/asb-skill-collections/packs/metabolomics/lc-ms/skills/unit-test-design-for-model-parameters

Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill unit-test-design-for-model-parameters

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when you have extended a neural network model class (e.

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.3 KB, as published. Nobody here has run it

unit-test-design-for-model-parameters

Summary

Design and implement unit tests to verify that newly added model parameters (e.g., L1/L2 regularization in neural networks) are correctly accepted, stored, and applied during training. This skill ensures parameter functionality is validated before integration into a shared codebase.

When to use

You have extended a neural network model class (e.g., SiameseModel) with new hyperparameter arguments and need to verify that the parameters are accepted by the constructor, stored as model attributes, and actually applied to the model's layers or loss computation during forward passes or training steps.

When NOT to use

  • The parameter is purely cosmetic or decorative and does not affect model computation or training behavior.
  • The model class is read-only or is a frozen/released artifact that does not accept modifications.
  • You are only adding documentation without changing the actual model code — testing may be unnecessary if no functional change occurs.

Inputs

  • SiameseModel class definition (or equivalent neural network model)
  • New parameter specification (name, type, default value, integration point)
  • Existing test suite structure and conventions

Outputs

  • Unit test module with test cases for parameter acceptance, storage, and application
  • Test execution report confirming all new tests pass and no regressions occur

How to apply

Write unit tests covering three key areas: (1) Constructor acceptance — verify the model accepts the new parameter without raising errors; (2) Attribute storage — confirm the parameter is stored and retrievable as a model attribute; (3) Functional application — verify the parameter is integrated into the model's layer definitions (using appropriate APIs like keras.regularizers.L1L2) and actually affects model behavior during a training step. Run the full test suite using python setup.py test to confirm no regressions. Tests should be written in Python using a standard testing framework (e.g., pytest or unittest) and cover both default and user-supplied parameter values.

Related tools

  • ms2deepscore (Host library containing the SiameseModel class to be extended with new parameters and tested) — https://github.com/matchms/ms2deepscore
  • Python (Language for writing and running unit tests; test execution via python setup.py test)
  • keras.regularizers (API for integrating L1/L2 regularization into model layers; must be verified in tests to confirm correct application)

Examples

# After adding L1/L2 parameters to SiameseModel constructor
from ms2deepscore.models import SiameseModel
model = SiameseModel(l1_reg=0.001, l2_reg=0.01)
assert hasattr(model, 'l1_reg') and model.l1_reg == 0.001
assert hasattr(model, 'l2_reg') and model.l2_reg == 0.01

Evaluation signals

  • Constructor accepts L1 and L2 arguments without raising TypeError or ValueError.
  • Model instance stores parameter values as retrievable attributes (e.g., model.l1_reg, model.l2_reg).
  • Regularization is integrated into layer definitions and model weights are penalized during a forward pass or training step (verified by inspecting model loss or weight updates).
  • Existing test suite passes without regressions when run via python setup.py test.
  • Unit tests cover both default parameter values (e.g., 0.0) and user-supplied values to ensure no silent failures.

Limitations

  • Tests verify parameter acceptance and storage but may not exhaustively validate that regularization strength produces expected generalization improvements — that requires empirical validation on held-out data.
  • The specific regularizer API (e.g., keras.regularizers.L1L2) is framework-dependent; tests must be tailored to the underlying deep learning framework (Keras, PyTorch, TensorFlow).
  • Tests do not guarantee that regularization parameters are optimal for all datasets or use cases — only that they are correctly implemented.

Evidence

  • [other] Write unit tests in Python to verify that: (a) the constructor accepts L1 and L2 arguments without error, (b) the parameters are stored as model attributes, and (c) the regularization is applied to model weights during a forward pass or training step.: "Write unit tests in Python to verify that: (a) the constructor accepts L1 and L2 arguments without error, (b) the parameters are stored as model attributes, and (c) the regularization is applied to"
  • [other] Integrate the L1/L2 parameters into the model's layer definitions using the appropriate regularizer API (e.g., keras.regularizers.L1L2 or equivalent).: "Integrate the L1/L2 parameters into the model's layer definitions using the appropriate regularizer API (e.g., keras.regularizers.L1L2 or equivalent)."
  • [other] Run the existing test suite with python setup.py test to confirm no regressions.: "Run the existing test suite with python setup.py test to confirm no regressions."
  • [methods] make sure the existing tests still work by running python setup.py test: "make sure the existing tests still work by running python setup.py test"

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.