Skip to content

OR (clause) languages: bin-or, ter-or, ratio-or, and a readable best-model block - #29

Open
jdzucker wants to merge 3 commits into
mainfrom
feat/terbeam-improvements
Open

jdzucker wants to merge 3 commits into
mainfrom
feat/terbeam-improvements

Conversation

@jdzucker

Copy link
Copy Markdown
Contributor

What

Web app side of predomics/gpredomics#88 and predomics/gpredomicspy#2. Models of the OR languages replace each feature by a positive disjunctive clause scored by the max of its features; the engine (Beam only) exposes the clause structure through Individual.get_clauses().

Backend

  • prediction.py: clause-aware scoring (test AUC curve, predict API, validation on new data), language aliases, pow2-or refused.
  • worker.py: OR models carry clauses and named_clauses in results.json, best_individual gets clauses. Classic models are unchanged. Works with bindings that have no get_clauses.
  • schemas.py: beam.max_clause_size (default 3) and a RunConfig validator refusing an OR language with any algorithm other than beam (422).
  • engine.py: max_clause_size in the YAML, OR models in the mock results.
  • model_format.py (new): shared readable formula used by the CSV exports (formula row, Clause column, Formula column), the HTML report and the PDF.

Frontend

  • Language options Binary-OR / Ternary-OR / Ratio-OR tied to the Beam algorithm (new onlyWith option rule in ParamField and paramValidation), Max clause size in the Beam section.
  • ModelTerms.vue: one chip per clause (A v B) in the population tab, the basket and the public share view, showing the real coefficient.
  • ModelFormula.vue (new): the best model written as a rule at the top of the Summary and Best Model tabs: positive and negative terms as chips, fraction layout for Ratio, decision threshold with the class names, exact copiable formula, short legend. Works for every language and data type.
  • Basket keeps named_clauses; en/fr translations; docs/parameter_analysis.md.

Checks

  • Backend: 580 passed, 30 skipped (test_or_languages.py adds 42). Frontend: 247 tests, lint and build clean.
  • Checked in a browser against an image built with the engine and bindings branches (GPREDOMICS_REF=8e0b65d, GPREDOMICSPY_REF=631db79).

Not in this PR

The pinned GPREDOMICS_REF / GPREDOMICSPY_REF in the Dockerfile and docker-compose.dev.yml still point to main. They will be bumped in a separate commit once the engine and bindings PRs are merged; until then the image builds the classic engine and the OR options are refused by the engine at run time.

…o-or

Models of these languages replace each feature by a positive disjunctive
clause scored by the max of its features; the engine (Beam only) exposes
the clause structure through Individual.get_clauses().

Backend
- prediction.py: clause-aware scoring (test AUC curve, predict API,
  validation on new data), language aliases, pow2-or refused
- worker.py: OR models carry `clauses` and `named_clauses` in results.json
  (best_individual gets `clauses`); classic models are unchanged; works
  with bindings that have no get_clauses
- schemas.py: beam.max_clause_size (default 3) and a RunConfig validator
  refusing an OR language with any algorithm other than beam
- engine.py: max_clause_size in the YAML; OR models in the mock results
- model_format.py (new): shared readable formula, used by the CSV exports
  (formula row, Clause column, Formula column), the HTML report and the PDF

Frontend
- language options Binary-OR / Ternary-OR / Ratio-OR tied to the Beam
  algorithm (`onlyWith` option rule in ParamField and paramValidation),
  Max clause size in the Beam section
- ModelTerms.vue: one chip per clause (A v B) in the population tab, the
  basket and the public share view, showing the real coefficient
- basket keeps named_clauses; en/fr translations; docs/parameter_analysis.md

Tests: backend/tests/test_or_languages.py, frontend orLanguages.test.js.
…tabs

New ModelFormula component: positive and negative terms as chips (clauses
"A v B" for the OR languages, fraction layout for the Ratio languages),
the decision threshold with the class names, the exact formula with a copy
button, and a short legend explaining the score, the data type and the
clauses. formatFormulaFromTerms is extracted from formatModelFormula.
When Beam stops without any model, the worker failed on best_pop.best()
with an index error shown as the job's error. It now exits with a message
saying that the engine produced no model, why this happens and what to
change (feature selection, best_models_criterion, the bin language, GA).
@jdzucker

Copy link
Copy Markdown
Contributor Author

Added a5396d9: the worker exits with a readable message when the engine returns no model, instead of an index error. The underlying Beam issue is fixed in predomics/gpredomics#88 (03a2749).

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