Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added n_features_in_ to three of the embedded class estimators (continued from #434) #462

Merged
merged 8 commits into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions graspy/embed/ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class AdjacencySpectralEmbed(BaseEmbed):

Attributes
----------
n_features_in_: int
number of features passed to the fit method.
latent_left_ : array, shape (n_samples, n_components)
Estimated left latent positions of the graph.
latent_right_ : array, shape (n_samples, n_components), or None
Expand Down Expand Up @@ -159,5 +161,6 @@ def fit(self, graph, y=None):
if self.diag_aug:
A = augment_diagonal(A)

self.n_features_in_ = len(A)
self._reduce_dim(A)
return self
2 changes: 2 additions & 0 deletions graspy/embed/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class BaseEmbed(BaseEstimator):
----------
n_components_ : int
Dimensionality of the embedded space.
n_features_in_: int
number of features passed to the fit method.

See Also
--------
Expand Down
4 changes: 4 additions & 0 deletions graspy/embed/lse.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class LaplacianSpectralEmbed(BaseEmbed):

Attributes
----------
n_features_in_: int
number of features passed to the fit method.

latent_left_ : array, shape (n_samples, n_components)
Estimated left latent positions of the graph.

Expand Down Expand Up @@ -162,6 +165,7 @@ def fit(self, graph, y=None):
)
warnings.warn(msg, UserWarning)

self.n_features_in_ = len(A)
L_norm = to_laplace(A, form=self.form, regularizer=self.regularizer)
self._reduce_dim(L_norm)
return self
4 changes: 4 additions & 0 deletions graspy/embed/mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class ClassicalMDS(BaseEstimator):
Equals the parameter n_components. If input n_components was None,
then equals the optimal embedding dimension.

n_features_in_: int
number of features passed to the fit method.

components_ : array, shape (n_components, n_features)
Principal axes in feature space.

Expand Down Expand Up @@ -203,6 +206,7 @@ def fit(self, X, y=None):
self.components_ = U
self.singular_values_ = D ** 0.5
self.dissimilarity_matrix_ = dissimilarity_matrix
self.n_features_in_ = X.shape[1]

return self

Expand Down