Skill Tracer
Skills › Scientific Agent Skills › arboreto › algorithms.md

algorithms.md

92 lines · skills/arboreto/references/algorithms.md at 5f2bc03

Open on GitHub
1# GRN inference algorithms
2
3Use the pinned runtime and pre-import Dask configuration in `SKILL.md`. Calls
4below assume prepared inputs and a managed `client`; wrap process creation and
5inference in a main guard. Signatures were checked against PyPI 0.1.6 and current
6[upstream algorithm source](https://github.com/aertslab/arboreto/blob/master/arboreto/algo.py).
7

GRN inference algorithms

Use the pinned runtime and pre-import Dask configuration in SKILL.md. Calls below assume prepared inputs and a managed client; wrap process creation and inference in a main guard. Signatures were checked against PyPI 0.1.6 and current upstream algorithm source.

Raw lines 1 to 7
8## Choose the estimator
9
10| Property | GRNBoost2 | GENIE3 |
11| --- | --- | --- |
12| Regressor | Stochastic gradient boosting | Random forest |
13| Typical purpose | Efficient initial analysis of large matrices | Method comparison or published GENIE3 reproduction |
14| Default maximum trees | 5000, often stopped earlier | 1000 |
15| Early stopping | Out-of-bag improvement window | None |
16| Score scale | Feature importance multiplied by fitted tree count | Normalized tree feature importance |
18Both fit a regression for each target, exclude that target from its predictors,
19and emit positive-importance TF-target pairs. GRNBoost2 is not restricted to
20one-level decision stumps: its default kwargs leave scikit-learn's tree depth
21default in effect. GENIE3 uses one random forest per target, not an ensemble of
22random forests. Timing depends on observations, targets, candidate TFs, tree
23settings, and workers; there is no fixed 10,000-observation applicability cutoff.
25Agreement between algorithms measures sensitivity to estimator choice. It does
26not independently validate regulatory causality. Scores across algorithms should
27not be compared with one shared numerical threshold.

Choose the estimator

PropertyGRNBoost2GENIE3
RegressorStochastic gradient boostingRandom forest
Typical purposeEfficient initial analysis of large matricesMethod comparison or published GENIE3 reproduction
Default maximum trees5000, often stopped earlier1000
Early stoppingOut-of-bag improvement windowNone
Score scaleFeature importance multiplied by fitted tree countNormalized tree feature importance

Both fit a regression for each target, exclude that target from its predictors, and emit positive-importance TF-target pairs. GRNBoost2 is not restricted to one-level decision stumps: its default kwargs leave scikit-learn's tree depth default in effect. GENIE3 uses one random forest per target, not an ensemble of random forests. Timing depends on observations, targets, candidate TFs, tree settings, and workers; there is no fixed 10,000-observation applicability cutoff.

Agreement between algorithms measures sensitivity to estimator choice. It does not independently validate regulatory causality. Scores across algorithms should not be compared with one shared numerical threshold.

Raw lines 8 to 28
29## Public signatures
31```python
32grnboost2(expression_data, gene_names=None, tf_names="all",
33 client_or_address="local", early_stop_window_length=25,
34 limit=None, seed=None, verbose=False)
36genie3(expression_data, gene_names=None, tf_names="all",
37 client_or_address="local", limit=None, seed=None, verbose=False)
38```
40- `gene_names`: required for ndarray/CSC input; ignored in favor of DataFrame columns.
41- `tf_names`: list of predictor names, or `None`/`"all"` for all genes.
42- `client_or_address`: existing `distributed.Client`, scheduler address, or
43 `None`/`"local"` to create a local cluster. Existing clients remain caller-owned.
44- `limit`: top N links globally. Choose a positive integer or `None`.
45- `seed`: regressor seed; record it and all dependency versions.
46- `early_stop_window_length`: positive window size for mean out-of-bag improvement;
47 this is not a held-out experimental validation set.
49```python
50from arboreto.algo import grnboost2, genie3
52network = grnboost2(expression_data=expression_matrix, tf_names=tf_names,
53 seed=42, limit=5000, client_or_address=client)
54# Prefer a fresh managed client for each run if repeated runs cancel futures.
55comparison = genie3(expression_data=expression_matrix, tf_names=tf_names,
56 seed=42, client_or_address=other_client)
57```

Public signatures

grnboost2(expression_data, gene_names=None, tf_names="all",
          client_or_address="local", early_stop_window_length=25,
          limit=None, seed=None, verbose=False)

genie3(expression_data, gene_names=None, tf_names="all",
       client_or_address="local", limit=None, seed=None, verbose=False)
  • gene_names: required for ndarray/CSC input; ignored in favor of DataFrame columns.
  • tf_names: list of predictor names, or None/"all" for all genes.
  • client_or_address: existing distributed.Client, scheduler address, or None/"local" to create a local cluster. Existing clients remain caller-owned.
  • limit: top N links globally. Choose a positive integer or None.
  • seed: regressor seed; record it and all dependency versions.
  • early_stop_window_length: positive window size for mean out-of-bag improvement; this is not a held-out experimental validation set.
from arboreto.algo import grnboost2, genie3

network = grnboost2(expression_data=expression_matrix, tf_names=tf_names,
                    seed=42, limit=5000, client_or_address=client)
# Prefer a fresh managed client for each run if repeated runs cancel futures.
comparison = genie3(expression_data=expression_matrix, tf_names=tf_names,
                     seed=42, client_or_address=other_client)
Raw lines 29 to 58
59## Explicit estimator settings
61`grnboost2` and `genie3` do not accept arbitrary scikit-learn kwargs. Use `diy`
62with `regressor_type="GBM"`, `"RF"`, or `"ET"` and a parameter dictionary:
64```python
65from arboreto.algo import diy
66from arboreto.core import SGBM_KWARGS, RF_KWARGS
68custom_gbm = diy(
69 expression_data=expression_matrix,
70 regressor_type="GBM",
71 regressor_kwargs={**SGBM_KWARGS, "n_estimators": 100,
72 "max_depth": 5, "learning_rate": 0.1},
73 tf_names=tf_names, seed=42, client_or_address=client,
75custom_rf = diy(
76 expression_data=expression_matrix,
77 regressor_type="RF",
78 regressor_kwargs={**RF_KWARGS, "n_estimators": 1000, "max_features": "sqrt"},
79 tf_names=tf_names, seed=42, client_or_address=other_client,
81```
83Both custom profiles ran on the synthetic fixture. ExtraTrees is source-verified
84but was not separately executed. Copy default dictionaries before overriding;
85do not mutate module globals. An XGBoost helper exists in core source, but
86XGBoost is not an implemented supported estimator here.
88Arboreto uses scikit-learn's `GradientBoostingRegressor.fit(..., monitor=...)`
89and `oob_improvement_`; the current official API still documents these, but the
90executed compatibility matrix here is scikit-learn 1.5.2, not all newer releases.
91See [current estimator API](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html)
92and [Arboreto core](https://github.com/aertslab/arboreto/blob/master/arboreto/core.py).

Explicit estimator settings

grnboost2 and genie3 do not accept arbitrary scikit-learn kwargs. Use diy with regressor_type="GBM", "RF", or "ET" and a parameter dictionary:

from arboreto.algo import diy
from arboreto.core import SGBM_KWARGS, RF_KWARGS

custom_gbm = diy(
    expression_data=expression_matrix,
    regressor_type="GBM",
    regressor_kwargs={**SGBM_KWARGS, "n_estimators": 100,
                      "max_depth": 5, "learning_rate": 0.1},
    tf_names=tf_names, seed=42, client_or_address=client,
)
custom_rf = diy(
    expression_data=expression_matrix,
    regressor_type="RF",
    regressor_kwargs={**RF_KWARGS, "n_estimators": 1000, "max_features": "sqrt"},
    tf_names=tf_names, seed=42, client_or_address=other_client,
)

Both custom profiles ran on the synthetic fixture. ExtraTrees is source-verified but was not separately executed. Copy default dictionaries before overriding; do not mutate module globals. An XGBoost helper exists in core source, but XGBoost is not an implemented supported estimator here.

Arboreto uses scikit-learn's GradientBoostingRegressor.fit(..., monitor=...) and oob_improvement_; the current official API still documents these, but the executed compatibility matrix here is scikit-learn 1.5.2, not all newer releases. See current estimator API and Arboreto core.

Raw lines 59 to 92