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

Fix for seed value checking, can be int or long #12

Open
wants to merge 2 commits 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
2 changes: 1 addition & 1 deletion modl/recsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def fit(self, X, y=None):
self.feature_freq_ = np.bincount(X.indices) / n_samples
self.feature_n_iter_ = np.zeros(n_features, dtype=int)

sparsity = X.nnz / n_samples / n_features
sparsity = float(X.nnz) / n_samples / n_features
if self.batch_size is None:
batch_size = int(ceil(1. / sparsity))
else:
Expand Down
2 changes: 2 additions & 0 deletions modl/utils/randomkit/random_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ cdef class RandomState:
elif isinstance(seed, np.integer):
iseed = int(seed)
rk_seed(iseed, self.internal_state)
elif isinstance(seed, (int, long)):
rk_seed(seed, self.internal_state)
else:
raise ValueError("Wrong seed")

Expand Down