Skip to content
This repository has been archived by the owner on Mar 6, 2021. It is now read-only.

Update random_layer.py #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
10 changes: 7 additions & 3 deletions random_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from scipy.spatial.distance import cdist, pdist, squareform

from sklearn.metrics import pairwise_distances
from sklearn.utils import check_random_state, atleast2d_or_csr
from sklearn.utils import check_random_state
try:
from sklearn.utils import atleast2d_or_csr as check_array
except ImportError:
from sklearn.utils import check_array
from sklearn.utils.extmath import safe_sparse_dot
from sklearn.base import BaseEstimator, TransformerMixin

Expand Down Expand Up @@ -108,7 +112,7 @@ def fit(self, X, y=None):
-------
self
"""
X = atleast2d_or_csr(X)
X = check_array(X)

self._generate_components(X)

Expand All @@ -130,7 +134,7 @@ def transform(self, X, y=None):
-------
X_new : numpy array of shape [n_samples, n_components]
"""
X = atleast2d_or_csr(X)
X = check_array(X)

if (self.components_ is None):
raise ValueError('No components initialized')
Expand Down