2011-07-29 19:06:35 +08:00
|
|
|
"""Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
|
|
|
|
|
regression (:ref:`least_angle_regression`)
|
|
|
|
|
|
|
|
|
|
The input data is mostly low rank but is a fat infinite tail.
|
|
|
|
|
"""
|
|
|
|
|
import gc
|
|
|
|
|
import sys
|
2013-02-12 06:11:57 +08:00
|
|
|
from time import time
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
2019-03-06 15:06:47 +08:00
|
|
|
from sklearn.linear_model import lars_path, lars_path_gram, orthogonal_mp
|
2019-10-28 05:17:23 +08:00
|
|
|
from sklearn.datasets import make_sparse_coded_signal
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def compute_bench(samples_range, features_range):
|
|
|
|
|
|
|
|
|
|
it = 0
|
|
|
|
|
|
2011-08-04 11:00:48 +08:00
|
|
|
results = dict()
|
|
|
|
|
lars = np.empty((len(features_range), len(samples_range)))
|
|
|
|
|
lars_gram = lars.copy()
|
|
|
|
|
omp = lars.copy()
|
|
|
|
|
omp_gram = lars.copy()
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
max_it = len(samples_range) * len(features_range)
|
2011-08-04 11:00:48 +08:00
|
|
|
for i_s, n_samples in enumerate(samples_range):
|
|
|
|
|
for i_f, n_features in enumerate(features_range):
|
2011-07-29 19:06:35 +08:00
|
|
|
it += 1
|
|
|
|
|
n_informative = n_features / 10
|
2013-02-12 06:11:57 +08:00
|
|
|
print('====================')
|
|
|
|
|
print('Iteration %03d of %03d' % (it, max_it))
|
|
|
|
|
print('====================')
|
2011-08-02 23:56:44 +08:00
|
|
|
# dataset_kwargs = {
|
|
|
|
|
# 'n_train_samples': n_samples,
|
|
|
|
|
# 'n_test_samples': 2,
|
|
|
|
|
# 'n_features': n_features,
|
|
|
|
|
# 'n_informative': n_informative,
|
|
|
|
|
# 'effective_rank': min(n_samples, n_features) / 10,
|
|
|
|
|
# #'effective_rank': None,
|
|
|
|
|
# 'bias': 0.0,
|
|
|
|
|
# }
|
2011-07-29 19:06:35 +08:00
|
|
|
dataset_kwargs = {
|
2011-08-02 23:56:44 +08:00
|
|
|
'n_samples': 1,
|
|
|
|
|
'n_components': n_features,
|
|
|
|
|
'n_features': n_samples,
|
|
|
|
|
'n_nonzero_coefs': n_informative,
|
|
|
|
|
'random_state': 0
|
2011-07-29 19:06:35 +08:00
|
|
|
}
|
2013-02-12 06:11:57 +08:00
|
|
|
print("n_samples: %d" % n_samples)
|
|
|
|
|
print("n_features: %d" % n_features)
|
2011-08-04 21:50:47 +08:00
|
|
|
y, X, _ = make_sparse_coded_signal(**dataset_kwargs)
|
2011-08-02 18:08:47 +08:00
|
|
|
X = np.asfortranarray(X)
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
gc.collect()
|
2013-05-28 14:27:20 +08:00
|
|
|
print("benchmarking lars_path (with Gram):", end='')
|
2011-07-29 19:06:35 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
tstart = time()
|
2011-08-03 22:04:26 +08:00
|
|
|
G = np.dot(X.T, X) # precomputed Gram matrix
|
2011-07-29 19:06:35 +08:00
|
|
|
Xy = np.dot(X.T, y)
|
2019-03-06 15:06:47 +08:00
|
|
|
lars_path_gram(Xy=Xy, Gram=G, n_samples=y.size,
|
|
|
|
|
max_iter=n_informative)
|
2011-07-29 19:06:35 +08:00
|
|
|
delta = time() - tstart
|
2013-02-12 06:11:57 +08:00
|
|
|
print("%0.3fs" % delta)
|
2011-08-04 11:00:48 +08:00
|
|
|
lars_gram[i_f, i_s] = delta
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
gc.collect()
|
2013-05-28 14:27:20 +08:00
|
|
|
print("benchmarking lars_path (without Gram):", end='')
|
2011-07-29 19:06:35 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
tstart = time()
|
|
|
|
|
lars_path(X, y, Gram=None, max_iter=n_informative)
|
|
|
|
|
delta = time() - tstart
|
2013-02-12 06:11:57 +08:00
|
|
|
print("%0.3fs" % delta)
|
2011-08-04 11:00:48 +08:00
|
|
|
lars[i_f, i_s] = delta
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
gc.collect()
|
2013-05-28 14:27:20 +08:00
|
|
|
print("benchmarking orthogonal_mp (with Gram):", end='')
|
2011-07-29 19:06:35 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
tstart = time()
|
2015-02-09 03:14:22 +08:00
|
|
|
orthogonal_mp(X, y, precompute=True,
|
2011-07-29 19:06:35 +08:00
|
|
|
n_nonzero_coefs=n_informative)
|
|
|
|
|
delta = time() - tstart
|
2013-02-12 06:11:57 +08:00
|
|
|
print("%0.3fs" % delta)
|
2011-08-04 11:00:48 +08:00
|
|
|
omp_gram[i_f, i_s] = delta
|
2011-07-29 19:06:35 +08:00
|
|
|
|
|
|
|
|
gc.collect()
|
2013-05-28 14:27:20 +08:00
|
|
|
print("benchmarking orthogonal_mp (without Gram):", end='')
|
2011-07-29 19:06:35 +08:00
|
|
|
sys.stdout.flush()
|
|
|
|
|
tstart = time()
|
2015-02-09 03:14:22 +08:00
|
|
|
orthogonal_mp(X, y, precompute=False,
|
2011-07-29 19:06:35 +08:00
|
|
|
n_nonzero_coefs=n_informative)
|
|
|
|
|
delta = time() - tstart
|
2013-02-12 06:11:57 +08:00
|
|
|
print("%0.3fs" % delta)
|
2011-08-04 11:00:48 +08:00
|
|
|
omp[i_f, i_s] = delta
|
|
|
|
|
|
|
|
|
|
results['time(LARS) / time(OMP)\n (w/ Gram)'] = (lars_gram / omp_gram)
|
|
|
|
|
results['time(LARS) / time(OMP)\n (w/o Gram)'] = (lars / omp)
|
2011-07-29 19:06:35 +08:00
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2020-06-24 22:51:51 +08:00
|
|
|
samples_range = np.linspace(1000, 5000, 5).astype(int)
|
|
|
|
|
features_range = np.linspace(1000, 5000, 5).astype(int)
|
2011-07-29 19:06:35 +08:00
|
|
|
results = compute_bench(samples_range, features_range)
|
2012-04-05 06:03:42 +08:00
|
|
|
max_time = max(np.max(t) for t in results.values())
|
2011-08-04 11:00:48 +08:00
|
|
|
|
[MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 (#6762)
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
- bench_glm.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 21 remaining occurrences of pylab replaced with
matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
glmnet.elastic_net
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
- File "bench_plot_omp_lars.py", line 111, in <module>
- ax = fig.add_subplot(1, 2, i)
- ValueError: num must be 1 <= num <= 2, not 0
- line 111 should probably be ax = fig.add_subplot(1, 2, i+1)
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_ward.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_sgd_regression.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_tree.py now free of pylab references
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons
* fix: Fix bug that prevented graphs from displaying
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly
* docs: removed pylab references from comments
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed pylab references from comments
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
<module>
- from sklearn.gaussian_process import GaussianProcessRegressor
- ImportError: cannot import name GaussianProcessRegressor
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
<module>
- from sklearn.gaussian_process import GaussianProcessClassifier
- ImportError: cannot import name GaussianProcessClassifier
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* style: Indent properly
* style: indent properly
* style: Indent properly
* docs: Add missing .pyplot
* docs: Fix typo
* style: Indent properly
2016-05-10 17:34:33 +08:00
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
fig = plt.figure('scikit-learn OMP vs. LARS benchmark results')
|
2019-01-03 21:50:05 +08:00
|
|
|
for i, (label, timings) in enumerate(sorted(results.items())):
|
[MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 (#6762)
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
- bench_glm.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 21 remaining occurrences of pylab replaced with
matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
glmnet.elastic_net
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
- File "bench_plot_omp_lars.py", line 111, in <module>
- ax = fig.add_subplot(1, 2, i)
- ValueError: num must be 1 <= num <= 2, not 0
- line 111 should probably be ax = fig.add_subplot(1, 2, i+1)
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_ward.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_sgd_regression.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_tree.py now free of pylab references
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons
* fix: Fix bug that prevented graphs from displaying
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly
* docs: removed pylab references from comments
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed pylab references from comments
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
<module>
- from sklearn.gaussian_process import GaussianProcessRegressor
- ImportError: cannot import name GaussianProcessRegressor
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
<module>
- from sklearn.gaussian_process import GaussianProcessClassifier
- ImportError: cannot import name GaussianProcessClassifier
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* style: Indent properly
* style: indent properly
* style: Indent properly
* docs: Add missing .pyplot
* docs: Fix typo
* style: Indent properly
2016-05-10 17:34:33 +08:00
|
|
|
ax = fig.add_subplot(1, 2, i+1)
|
2011-08-21 03:34:33 +08:00
|
|
|
vmax = max(1 - timings.min(), -1 + timings.max())
|
[MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 (#6762)
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
- bench_glm.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 21 remaining occurrences of pylab replaced with
matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
glmnet.elastic_net
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
- File "bench_plot_omp_lars.py", line 111, in <module>
- ax = fig.add_subplot(1, 2, i)
- ValueError: num must be 1 <= num <= 2, not 0
- line 111 should probably be ax = fig.add_subplot(1, 2, i+1)
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_ward.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_sgd_regression.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_tree.py now free of pylab references
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons
* fix: Fix bug that prevented graphs from displaying
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly
* docs: removed pylab references from comments
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed pylab references from comments
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
<module>
- from sklearn.gaussian_process import GaussianProcessRegressor
- ImportError: cannot import name GaussianProcessRegressor
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
<module>
- from sklearn.gaussian_process import GaussianProcessClassifier
- ImportError: cannot import name GaussianProcessClassifier
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* style: Indent properly
* style: indent properly
* style: Indent properly
* docs: Add missing .pyplot
* docs: Fix typo
* style: Indent properly
2016-05-10 17:34:33 +08:00
|
|
|
plt.matshow(timings, fignum=False, vmin=1 - vmax, vmax=1 + vmax)
|
2016-11-26 01:43:51 +08:00
|
|
|
ax.set_xticklabels([''] + [str(each) for each in samples_range])
|
|
|
|
|
ax.set_yticklabels([''] + [str(each) for each in features_range])
|
[MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 (#6762)
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
- bench_glm.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 21 remaining occurrences of pylab replaced with
matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
glmnet.elastic_net
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
- File "bench_plot_omp_lars.py", line 111, in <module>
- ax = fig.add_subplot(1, 2, i)
- ValueError: num must be 1 <= num <= 2, not 0
- line 111 should probably be ax = fig.add_subplot(1, 2, i+1)
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_plot_ward.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_sgd_regression.py now free of pylab references
- code executes properly
* Fix: Replace pylab with matplotlib.pyplot #6754
- bench_tree.py now free of pylab references
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons
* fix: Fix bug that prevented graphs from displaying
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly
* docs: removed pylab references from comments
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed pylab references from comments
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
<module>
- from sklearn.gaussian_process import GaussianProcessRegressor
- ImportError: cannot import name GaussianProcessRegressor
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
- File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
<module>
- from sklearn.gaussian_process import GaussianProcessClassifier
- ImportError: cannot import name GaussianProcessClassifier
* docs: removed all pylab references
- replaced with matplotlib.pyplot
- pl --> plt
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* refactor: Replace pl with plt
- replace instances of pl (as on import pylab as pl)
with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* docs: removed all pylab references
- replaced with matplotlib.pyplot
* style: Indent properly
* style: indent properly
* style: Indent properly
* docs: Add missing .pyplot
* docs: Fix typo
* style: Indent properly
2016-05-10 17:34:33 +08:00
|
|
|
plt.xlabel('n_samples')
|
|
|
|
|
plt.ylabel('n_features')
|
|
|
|
|
plt.title(label)
|
|
|
|
|
|
|
|
|
|
plt.subplots_adjust(0.1, 0.08, 0.96, 0.98, 0.4, 0.63)
|
|
|
|
|
ax = plt.axes([0.1, 0.08, 0.8, 0.06])
|
|
|
|
|
plt.colorbar(cax=ax, orientation='horizontal')
|
|
|
|
|
plt.show()
|