moscot.base.problems.OTProblem#

class moscot.base.problems.OTProblem(adata, adata_tgt=None, src_obs_mask=None, tgt_obs_mask=None, src_var_mask=None, tgt_var_mask=None, src_key=None, tgt_key=None)[source]#

Base class for all OT problems.

Parameters:

Notes

If source/target mask is specified, adata_src/adata_tgt will be a view.

Methods

estimate_marginals(adata, *, source, **kwargs)

Estimate the source or target marginals.

load(path)

Load the model from a file.

prepare(xy, x, y[, a, b])

Prepare the OT problem.

pull([data, subset, normalize, split_mass, ...])

Pull data through the transport_matrix.

push([data, subset, normalize, split_mass, ...])

Push data through the transport_matrix.

save(path[, overwrite])

Save the problem to a file.

set_graph_x(data[, cost, t])

Set a graph for the source quadratic term.

set_graph_xy(data[, cost, t])

Set a graph for the linear term for graph based distances.

set_graph_y(data[, cost, t])

Set a graph for the target quadratic term.

set_solution(solution, *[, overwrite])

Set a solution to the OT problem.

set_x(data, tag)

Set a cost/kernel matrix for the source quadratic term.

set_xy(data, tag)

Set a cost/kernel matrix for the linear term.

set_y(data, tag)

Set a cost/kernel matrix for the target quadratic term.

solve([backend, device])

Solve the OT problem.

Attributes

a

Source marginals.

adata_src

Source annotated data object.

adata_tgt

Target annotated data object.

b

Target marginals.

problem_kind

Kind of the underlying problem.

shape

Shape of the OT problem.

solution

Solution of the OT problem.

solver

OT solver.

stage

Problem stage.

x

Geometry defining the source quadratic term.

xy

Geometry defining the linear term.

y

Geometry defining the target quadratic term.