Skip to content

Remove unused and commented out code #63

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

Merged
merged 1 commit into from
Jun 17, 2020
Merged
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
1 change: 0 additions & 1 deletion examples/plot_kernel_approximation.py
Original file line number Diff line number Diff line change
@@ -80,7 +80,6 @@
data[n_samples // 2 :],
digits.target[n_samples // 2 :],
)
# data_test = scaler.transform(data_test)

# fix model parameters:
GAMMA = 0.2
38 changes: 0 additions & 38 deletions sklearn_extra/kernel_approximation/test_fastfood.py
Original file line number Diff line number Diff line change
@@ -46,46 +46,8 @@ def test_fastfood():
X_trans = pars.transform(X)
Y_trans = ff_transform.transform(Y)

# print X_trans, Y_trans
kernel_approx = np.dot(X_trans, Y_trans.T)

print("approximation:", kernel_approx[:5, :5])
print("true kernel:", kernel[:5, :5])
assert_array_almost_equal(kernel, kernel_approx, decimal=1)


# def test_fastfood_mem_or_accuracy():
# """compares the performance of Fastfood and RKS"""
# #generate data
# X = rng.random_sample(size=(10000, 4000))
# X /= X.sum(axis=1)[:, np.newaxis]
#
# # calculate feature maps
# gamma = 10.
# sigma = np.sqrt(1 / (2 * gamma))
# number_of_features_to_generate = 1000
#
#
#
# fastfood_start = datetime.datetime.utcnow()
# # Fastfood: approximate kernel mapping
# rbf_transform = Fastfood(
# sigma=sigma, n_components=number_of_features_to_generate,
# tradeoff_less_mem_or_higher_accuracy='accuracy', random_state=42)
# _ = rbf_transform.fit_transform(X)
# fastfood_end = datetime.datetime.utcnow()
# fastfood_spent_time =fastfood_end- fastfood_start
# print "Timimg fastfood accuracy: \t\t", fastfood_spent_time
#
#
# fastfood_mem_start = datetime.datetime.utcnow()
# # Fastfood: approximate kernel mapping
# rbf_transform = Fastfood(
# sigma=sigma, n_components=number_of_features_to_generate,
# tradeoff_less_mem_or_higher_accuracy='mem', random_state=42)
# _ = rbf_transform.fit_transform(X)
# fastfood_mem_end = datetime.datetime.utcnow()
# fastfood_mem_spent_time = fastfood_mem_end- fastfood_mem_start
# print "Timimg fastfood memory: \t\t", fastfood_mem_spent_time
#
# assert_greater(fastfood_spent_time, fastfood_mem_spent_time)
2 changes: 1 addition & 1 deletion sklearn_extra/kernel_methods/_eigenpro.py
Original file line number Diff line number Diff line change
@@ -334,7 +334,7 @@ def _raw_fit(self, X, Y):

self.coef_ = np.zeros((n, Y.shape[1]), dtype=np.float32)
step = np.float32(eta / self.bs_)
for epoch in range(0, self.n_epoch):
for _ in range(0, self.n_epoch):
epoch_inds = random_state.choice(
n, n // self.bs_ * self.bs_, replace=False
).astype("int32")