Estimator base¶
Shared by every estimator. You would only reach for this directly to type-annotate something that takes any of them.
BaseEmbedding
¶
Common fit plumbing for every embedding.
Subclasses supply an __init__ that stores its arguments verbatim, a
_params hook returning the payload the core reads, and the core function
itself.
embedding_
property
¶
The fitted embedding, (n_samples, n_components).
Raises:
| Type | Description |
|---|---|
NotFittedError
|
If |
get_params
¶
Parameters this estimator was constructed with.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deep
|
bool
|
Accepted for scikit-learn compatibility; these estimators hold no nested estimators, so it makes no difference. The parameter groups are frozen dataclasses, not estimators, and come back whole. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Constructor parameters, keyed by name. |
set_params
¶
set_params(**params: Any) -> BaseEmbedding
Set constructor parameters, discarding any fitted embedding.
Returns:
| Type | Description |
|---|---|
BaseEmbedding
|
self. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a name is not a parameter of this estimator. |
fit
¶
fit(
X: Any,
y: Any = None,
*,
knn_indices: Any = None,
knn_distances: Any = None,
) -> BaseEmbedding
Embed X.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Any
|
Array-like of shape |
required |
y
|
Any
|
Ignored, present for scikit-learn pipeline compatibility. |
None
|
knn_indices
|
Any
|
Optional |
None
|
knn_distances
|
Any
|
Distances matching |
None
|
Returns:
| Type | Description |
|---|---|
BaseEmbedding
|
self. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If only one of the two kNN arrays was given. |
fit_transform
¶
fit_transform(
X: Any,
y: Any = None,
*,
knn_indices: Any = None,
knn_distances: Any = None,
) -> ndarray
Embed X and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Any
|
Array-like of shape |
required |
y
|
Any
|
Ignored, present for scikit-learn pipeline compatibility. |
None
|
knn_indices
|
Any
|
Optional precomputed neighbour indices. See |
None
|
knn_distances
|
Any
|
Distances matching |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The embedding, |
ndarray
|
as the input. |
transform
¶
Not available: none of these algorithms projects new points.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. Embedding new data means refitting on the whole set, which changes the existing coordinates too. |
NotFittedError
¶
Bases: ValueError, AttributeError
Raised when embedding_ is read before fit.
Inherits from both ValueError and AttributeError to match
sklearn.exceptions.NotFittedError, so code catching either still works.
ManifoldsRsError
¶
Bases: Exception
ConvergenceError
¶
Bases: ManifoldsRsError