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

Feature/two way scaling #104

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9e50115
Added basic functions to test two-way center and scaling
mnarayan Oct 9, 2017
2f74e1b
Added basic twoway standardization algorithm. Relevant to issue #93
mnarayan Oct 9, 2017
f2a1b20
Cleaned up TwoWayStandardScaler API. partial_fit not supported
mnarayan Oct 9, 2017
a30bc8e
Reset internal row,col attributes
mnarayan Oct 9, 2017
ed6fd34
Added basic structure for partial_fit
mnarayan Oct 9, 2017
47c87cb
partial_fit now calculates row, col statistics
mnarayan Oct 11, 2017
2dcde0a
Added convergence checks. Algorithm completed
mnarayan Oct 11, 2017
dd92d80
Transform now calls twoway_standardize
mnarayan Oct 11, 2017
a754f44
Updated algorithm. Test passes
mnarayan Oct 11, 2017
4a3c038
Fixed bug in transform()
mnarayan Oct 11, 2017
cc1d8d3
Return original dimensions
mnarayan Oct 11, 2017
16b1116
inverse_transform completed, raises not implemented error
mnarayan Oct 11, 2017
a58383a
Delinting
mnarayan Oct 11, 2017
5904f60
More delinting
mnarayan Oct 11, 2017
a17a530
Fixed import error
mnarayan Oct 12, 2017
e5395bd
Added clean.py
mnarayan Oct 12, 2017
87ee167
Fix merge conflicts
jasonlaska Sep 9, 2018
a2940df
Rename files from `clean` to `two_way_standard_scaler`
jasonlaska Sep 9, 2018
238f393
Add estimator check
jasonlaska Sep 9, 2018
34dc936
Rename commont_test to sklearn_test as is more descriptive of this test.
jasonlaska Sep 9, 2018
7869659
Address initial comments and some cleanup.
jasonlaska Sep 9, 2018
9cbb212
Black formatting and more simplification and cleanup.
jasonlaska Sep 9, 2018
a8e980f
Black formatting and more simplification and cleanup.
jasonlaska Sep 9, 2018
e864e72
Ensure interface can be validated.
jasonlaska Sep 9, 2018
7f86bb3
More simplification.
jasonlaska Sep 9, 2018
748fe33
Autoformat.
jasonlaska Sep 9, 2018
d2800fc
Bring back partial_fit capability, add tests, ask questions.
jasonlaska Sep 9, 2018
7c37030
Minor cleanup.
jasonlaska Sep 9, 2018
1757216
Raise on inverse transform, remove code.
jasonlaska Sep 10, 2018
17806e8
Remove unneeded check.
jasonlaska Sep 10, 2018
f1f682e
Remove redundant raise.
jasonlaska Sep 10, 2018
eb8c54b
Remove unneeded comments.
jasonlaska Sep 10, 2018
070c017
Merge branch 'develop' of github.com:skggm/skggm into feature/two-way…
jasonlaska Sep 10, 2018
4f8267e
Merge branch 'develop' of github.com:skggm/skggm into feature/two-way…
jasonlaska Sep 12, 2018
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
Prev Previous commit
Next Next commit
Rename files from clean to two_way_standard_scaler
  • Loading branch information
jasonlaska committed Sep 9, 2018
commit a2940dff6bdf91515d85f01491b653fdaf030ce0
6 changes: 3 additions & 3 deletions inverse_covariance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
QuicGraphicalLassoCV,
QuicGraphicalLassoEBIC,
)
from .clean import (
twoway_standardize,
from .two_way_standard_scaler import (
two_way_standardize,
TwoWayStandardScaler,
)
from .metrics import (
Expand All @@ -37,7 +37,7 @@
"QuicGraphicalLasso",
"QuicGraphicalLassoCV",
"QuicGraphicalLassoEBIC",
'twoway_standardize',
'two_way_standardize',
'TwoWayStandardScaler',
"log_likelihood",
"kl_loss",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from sklearn.utils.testing import assert_raises

from inverse_covariance.clean import (
twoway_standardize
from inverse_covariance.two_way_standard_scaler import (
two_way_standardize
)


Expand All @@ -29,7 +29,7 @@ def test_invalid_argument():
'''
X = np.zeros(shape=(10, 10))
X_csc = sparse.csc_matrix(X)
assert_raises(TypeError, twoway_standardize, X_csc)
assert_raises(TypeError, two_way_standardize, X_csc)

X_csr = sparse.csr_matrix(X)
assert_raises(TypeError, twoway_standardize, X_csr)
assert_raises(TypeError, two_way_standardize, X_csr)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)


def twoway_standardize(X, axis=0, with_mean=True, with_std=True, copy=True,
def two_way_standardize(X, axis=0, with_mean=True, with_std=True, copy=True,
max_iter=50, tol=1e-6, verbose=False):
"""Standardize a two-dimensional data matrix along both axes.
Center to the mean and component wise scale to unit variance.
Expand Down Expand Up @@ -100,7 +100,7 @@ def twoway_standardize(X, axis=0, with_mean=True, with_std=True, copy=True,

class TwoWayStandardScaler(BaseEstimator, TransformerMixin):
"""Standardize features by removing the mean and scaling to unit variance
in both row and column dimensions.
in both row and column dimensions.
This class is modeled after StandardScaler in scikit-learn.
Read more in the :ref:`User Guide <preprocessing_scaler>`.
Parameters
Expand Down Expand Up @@ -150,14 +150,14 @@ class TwoWayStandardScaler(BaseEstimator, TransformerMixin):
[ 1. 1.]]
See also
--------
twoway_standardize: Equivalent function without the estimator API.
two_way_standardize: Equivalent function without the estimator API.
:class:`sklearn.preprocessing.StandardScaler`
:class:`sklearn.decomposition.PCA`
Further removes the linear correlation across features with 'whiten=True'.
Notes
-----
See the implications of one-way vs. two-way standardization in here. TBD

""" # noqa

def __init__(self, copy=True, with_mean=True, with_std=True):
Expand Down Expand Up @@ -281,7 +281,7 @@ def transform(self, X, y='deprecated', copy=None):
raise NotImplemented(
"Algorithm for sparse matrices currently not supported.")
else:
X = twoway_standardize(X)
X = two_way_standardize(X)
return X

def inverse_transform(self, X, copy=None):
Expand Down