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

Some fixes to imports and names. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IDE configs
.idea/

# Juypter Notebook Checkpoitns
.ipynb_checkpoints
.pytest_cache
2 changes: 1 addition & 1 deletion sparsemf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .sparse_soft_impute import SoftImpute
from .sparse_als_soft_impute import SoftImputeALS
from .sparse_als_soft_impute import SparseSoftImputeALS
from .sparse_biscale import SBiScale
from .splr_matrix import SPLR
6 changes: 3 additions & 3 deletions sparsemf/sparse_als_soft_impute.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from scipy.sparse import coo_matrix, csc_matrix, issparse, csr_matrix
from sklearn.metrics import mean_squared_error

from sparse_biscale import SBiScale
from sparse_solver import Solver
from splr_matrix import SPLR
from .sparse_biscale import SBiScale
from .sparse_solver import Solver
from .splr_matrix import SPLR
from sklearn.base import TransformerMixin


Expand Down
2 changes: 1 addition & 1 deletion sparsemf/sparse_biscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def fit(self, x):
'''
self._add_variables(x)
self._center_scale_I()
for i in xrange(self.maxit):
for i in range(self.maxit):
# Centering
## Column mean
if self.col_center:
Expand Down
8 changes: 4 additions & 4 deletions sparsemf/sparse_soft_impute.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from scipy.sparse import coo_matrix, csc_matrix, issparse, csr_matrix
from sklearn.metrics import mean_squared_error

from sparse_biscale import SBiScale
from sparse_solver import Solver
from splr_matrix import SPLR
from .sparse_biscale import SBiScale
from .sparse_solver import Solver
from .splr_matrix import SPLR


class SoftImpute(Solver):
Expand Down Expand Up @@ -119,7 +119,7 @@ def _xhat_pred(self):
row_ids, col_ids, _ = self.missing_mask
x_svd = self.X_fill
targets = zip(row_ids, col_ids)
n_preds = len(targets)
n_preds = len(list(targets))
res = np.empty(n_preds)

for idx, (r, c) in enumerate(targets):
Expand Down
2 changes: 1 addition & 1 deletion sparsemf/sparse_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np
from six.moves import range
from scipy.sparse import issparse, coo_matrix, csr_matrix
from sparse_biscale import SBiScale
from .sparse_biscale import SBiScale


class Solver(object):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_soft_impute.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from sparse_soft_impute import SoftImpute, SPLR
from sparsemf import SoftImpute, SPLR
from scipy.sparse import coo_matrix, csr_matrix, csc_matrix, lil_matrix
from sklearn.utils.testing import assert_raises, assert_equal, assert_array_equal
import unittest
Expand Down