Python API¶
-
class
exemcl.ExemplarClustering¶ - Members
models
-
__init__(self: exemcl.ExemplarClustering, ground_set: numpy.ndarray[numpy.float64[m, n]], precision: str = 'fp32', device: str = 'gpu', worker_count: int = - 1) → None¶ Initializes the submodular function of Exemplar-based clustering with the following parameters:
- Parameters
ground_set (int) – The ground set for the function (usually denoted as \(V\)).
precision (int) – Required floating point precision (possible values:
fp16,fp32orfp64).device (int) – Computing device to use for function evaluation (possible values:
gpuorcpu). Please keep in mind, that FP16 precision is not available with CPUs.worker_count (int) – Number of parallel workers to consider (-1 defaults to all available cores).
-
__call__(S)¶ Evaluates the function value for a single set \(S\).
- Parameters
S (ndarray) – Input data set \(S\) represented as data matrix with shape
[n, d].- Returns
Function value \(f(S)\).
-
__call__(S_multi)¶ Evaluates the marginal function values for a set of sets \(\left\lbrace S_1, \dots, S_n \right\rbrace\).
- Parameters
S_multi (List[ndarray]) – Input data sets \(\left\lbrace S_1, \dots, S_n \right\rbrace\) represented as data matrices with shape
[n_i, d]for each \(S_i\).- Returns
Function values \(\left\lbrace f(S_1), \dots, f(S_n) \right\rbrace\).
-
__call__(S, e)¶ Evaluates the marginal function value for a single set \(S\) and a marginal element \(e\).
- Parameters
S (ndarray) – Input data set \(S\) represented as data matrix with shape
[n, d].e (ndarray) – Input data vector \(e\) with shape
[d, 1].
- Returns
Marginal function value \(f(S \mid e)\).
-
__call__(S, e_multi)¶ Evaluates the marginal function value for a single set \(S\) and a set of marginal elements \(\left\lbrace e_1, \dots, e_n \right\rbrace\).
- Parameters
S (ndarray) – Input data set \(S\) represented as data matrix with shape
[n, d].e_multi (List[ndarray]) – Input data vectors \(\left\lbrace e_1, \dots, e_n \right\rbrace\) with shape
[d, 1]each.
- Returns
Marginal function values \(\left\lbrace f(S \mid e_1), \dots, f(S \mid e_n) \right\rbrace\).
-
__call__(S_multi, e)¶ Evaluates the marginal function values for a set of sets \(\left\lbrace S_1, \dots, S_n \right\rbrace\) and a marginal element \(e\).
- Parameters
S_multi (List[ndarray]) – Input data sets \(\left\lbrace S_1, \dots, S_n \right\rbrace\) represented as data matrices with shape
[n_i, d]for each \(S_i\).e (ndarray) – Input data vector \(e\) with shape
[d, 1].
- Returns
Marginal function values \(\left\lbrace f(S_1 \mid e), \dots, f(S_n \mid e) \right\rbrace\).