pertpy.tools.PerturbationComparison#
Methods table#
|
Compare classification accuracy between real and simulated perturbations. |
|
Calculate proportions of real perturbed and control data points for simulated data. |
Methods#
- PerturbationComparison.compare_classification(real, simulated, control, clf=None)[source]#
Compare classification accuracy between real and simulated perturbations.
Trains a classifier on the real perturbation data & the control data and reports a normalized classification accuracy on the simulated perturbation.
- PerturbationComparison.compare_knn(real, simulated, control=None, use_simulated_for_knn=False, n_neighbors=20, random_state=0, n_jobs=1)[source]#
Calculate proportions of real perturbed and control data points for simulated data.
Computes proportions of real perturbed, control and simulated (if use_simulated_for_knn=True) data points for simulated data. If control (C) is not provided, builds the knn graph from real perturbed + simulated perturbed.
- Parameters:
real (
ndarray) – Real perturbed data.simulated (
ndarray) – Simulated perturbed data.use_simulated_for_knn (
bool, default:False) – Include simulted perturbed data (simulated) into the knn graph. Only valid when control (control) is provided.n_neighbors (
int, default:20) – Number of neighbors to use in k-neighbor graph.random_state (
int, default:0) – Random state used for k-neighbor graph construction.n_jobs (
int, default:1) – Number of cores to use. Defaults to -1 (all).
- Return type: