API - adapters#
- found.adapters.step_fn(*out_names)[source]#
decorator for functions that return tuples, returns a copy which “annotates” individual output values with names for use in
Pipeline.returned function behaves identically to the original un-decorated function, the only modification is the addition of a private attribute to the function object.
- class found.adapters.Pipeline(dimr_fn, regr_fn, binr_fn, cachable_dimr=False, strict=True)[source]#
class which when provided with individual pipeline components (see fields), creates a pipeline for detecting and re-classifying cells affected/unaffected by the case condition.
functions are run in the following order:
dimr_fn→regr_fn→binr_fn- Parameters:
dimr_fn (
Callable) – dimensionality reduction function (output accessible to further functions via a parameter named Z unless explicitly wrapped bystep_fn())regr_fn (
Callable) – regression function (output accessible to further functions via a parameter named Y unless explicitly wrapped bystep_fn())binr_fn (
Callable) – binarization function (output accessible to further functions via a parameter named W unless explicitly wrapped bystep_fn())cachable_dimr (
bool) – boolean indicating if the first k dimensions of the output of dimr_fn stable when requesting larger dimensions (e.g. isdimr_fn(X, k) = dimr_fn(X, k+n)[:, :k]) caution with setting this without care as it can lead to incorrect results when conducting hyperparameter optimization viaTuner. as a rule of thumb, this property is generally only true for truncated PCA.strict (
bool) – boolean indicating if the pipeline should conduct strict type checking, disable with caution if getting spurious {py:exc}`~TypeError` failures
- check(w)[source]#
convenience function, given a set of provided arguments, validates if the pipeline can run returns if yes, raises
ValueErrorif no
- update(dimr_fn=None, regr_fn=None, binr_fn=None, cachable_dimr=None, strict=None)[source]#
convenience constructor for creating a new
Pipelinefrom an existing one (does not mutate original object).- Parameters:
dimr_fn (
Callable|None) – dimensionality reduction function (output accessible to further functions via a parameter namedZ)regr_fn (
Callable|None) – regression function (output accessible to further functions via a parameter namedY)binr_fn (
Callable|None) – binarization function (output accessible to further functions via a parameter namedW)cachable_dimr (
bool|None) – boolean indicating if the first k dimensions of the output of dimr_fn stable when requesting larger dimensions (e.g. isdimr_fn(X, k) = dimr_fn(X, k+n)[:, :k]) caution with setting this without care as it can lead to incorrect results when conducting hyperparameter optimization viaTuner. as a rule of thumb, this property is generally only true for truncated PCA.strict (
bool|None) – boolean indicating if the pipeline should conduct strict type checking, disable with caution if getting spuriousTypeErrorfailures
- Return type:
Self
- classmethod from_proc_ad(dimr_key, regr_fn, binr_fn, strict=None)[source]#
convenience constructor for creating a
Pipelinewhere the dimr_fn step fetches data from a specifiedAnnDataobsmslot.resulting
Pipelinemust be called with a named argumentadataproviding anAnnDataobject.resulting
Pipelinecan optionally be called with a named argumentkspecifying the desired dimensionality of the dimensionality reduction space, otherwise the full provided space will be used.- Parameters:
dimr_key (
str) – key forobsmslot specifying dimensionality reduction matrixregr_fn (
Callable) – regression function (output accessible to further functions via a parameter named Y)binr_fn (
Callable) – binarization function (output accessible to further functions via a parameter named W)strict (
bool|None) – boolean indicating if the pipeline should conduct strict type checking, disable with caution if getting spuriousTypeErrorfailures
- Return type:
Self