ggml_ot.from_numpy#
- ggml_ot.from_numpy(supports, distribution_labels, n_triplets=3, weights=None, covariances=None, identical_supports=False, label_type='categorical', distribution_labels_str=None, **kwargs)[source]#
Dataset to train GGML based on array data.
This class stores a collection of distributions (“supports”) and exposes the standardized interfaces used by
ggml_ot.train(),ggml_ot.tune(),ggml_ot.test(), andggml_ot.train_test(). Triplets(i, j, k)— where pair(i, j)should sit closer than pair(j, k)by marginalpha— are built per batch byggml_ot.optimization.triplets.create_triplets()using categorical (equality-based) labels.- Parameters:
- supports Sequence[np.ndarray]
Sequence of per-distribution supports. Each element is an array of points (for empirical distributions) or component means (for GMM-style representations).
- distribution_labels Sequence[int] | np.ndarray
Labels identifying the class/group of each distribution.
- n_triplets int, optional
Number of triplets to generate per “anchor” distribution (default: 3).
- weights Sequence[np.ndarray] | None, optional
Per-distribution probability weights (e.g., cluster proportions) or None for uniform weights (default: None).
- covariances Sequence[np.ndarray] | None, optional
Optional per-distribution covariance arrays when supports represent Gaussian mixture components (default: None).
- identical_supports bool, optional
If True, indicates that all distributions share the same supports (e.g., identical component locations across distributions). This changes the __getitem__ return format and allows faster OT evaluation (default: False).
- label_type {"categorical"}, optional
Supervision mode for the distribution labels (default:
"categorical"). Only"categorical"(nominal class labels with equality-based triplets) is supported in this stable release; other values raiseNotImplementedError.- distribution_labels_str Sequence | np.ndarray | None, optional
Original per-distribution labels for display/annotation, stored as strings. When
None(default), derived by stringifyingdistribution_labels. Must align 1:1 withdistribution_labels.
- Return type: