Skip to content

Running metric_melt several times #51

@michaelbornholdt

Description

@michaelbornholdt

This is an optimization issue.
When running metrics such as precision-recall or enrichment, like in the demo book: https://github.com/cytomining/cytominer-eval/blob/master/demos/CellPainting_Demo.ipynb
You call evaluate several times to calculate the metric at different value of p e.g.

for p in np.arange(0.99, 0.96, -0.01):
    r = evaluate(
        profiles=df,
        features=features,
        meta_features=meta_features,
        replicate_groups=["Metadata_gene_name"],
        operation="enrichment",
        similarity_metric="pearson",
        enrichment_percentile = p,
    )
    result.append(r)

However, this calls the function cytominer_eval.transform.get_pairwise_metric several times (once per call of evaluate). This is not necessary since the metrics can be retrieved from the same similarity_melted_df!!

We need to adapt the function evaluate such that it either only calculates the pairs once, when called several times. Or we maybe just need to change the demos to show that when calculating several values, you must not use evaluate for them.

What are your thoughts @gwaygenomics

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions