Commit Graph

793 Commits

Author SHA1 Message Date
Peter Fischer 6cb51b2a28 Initialize ARPACK eigsh
`v0 = random_state.rand(M.shape[0])` leads to an initial residual vector in ARPACK which is all positive. However, this is not the absolute or squared residual, but a true difference. Thus, it is better to initialize with `v0=random_state.uniform(-1, 1, M.shape[0])` to have an equally distributed sign. This is the way that ARPACK initializes the residuals.
The effect of the previous initialization is that eigsh frequently does not converge to the correct eigenvalues, e.g. negative eigenvalues for s.p.d. matrix, which leads to an incorrect null-space.

- initialized all occurences of sklearn.utils.arpack.eigsh the same way it would be initialzed by ARPACK
- regression test to test behavior of new initialization
2015-10-23 08:57:30 +02:00
Arnaud Rachez 5db2adf93c MAINT Removed deprecated stuff. 2015-10-21 10:24:23 +02:00
Jake VanderPlas 904c667570 MAINT: use xrange from six 2015-10-20 06:40:01 -07:00
Raghav R V e3afc0e8c9 MAINT move custom error/warning classes into sklearn.exceptions
ENH NonBLASDotWarning -> EfficiencyWarning; Improve error message
DOC Add exceptions module to modules/classes.rst
MAINT Move ConvergenceWarning, UndefinedMetricWarning et al into exceptions
MAINT Remove ChangedBehaviorWarning from base
DOC/FIX Improve DataConversionWarning's docstring
2015-10-19 22:35:35 +02:00
Raghav R V a87011262a FIX precision to float64 across the codebase 2015-10-16 11:20:29 +02:00
Andreas Mueller c66689c4f4 FIX Don't compare arrays to strings!!!! 2015-10-15 16:07:17 -04:00
Manoj Kumar d77ea1220d Merge pull request #4707 from amueller/k_means_init_mismatch
[MGR] Raise error when init shape doesn't match n_clusters in KMeans
2015-10-07 17:51:09 -04:00
Vighnesh Birodkar f4e16580f5 Added explanatory comment 2015-10-06 14:31:31 -04:00
Vighnesh Birodkar ddc985292f Added check for max_iter and test 2015-10-06 14:31:31 -04:00
Vighnesh Birodkar fc1875627c moved condition out of the loop 2015-10-06 14:30:07 -04:00
Vighnesh Birodkar 687af98f9d added predict_equal_labels test and changed kmeans single 2015-10-06 14:30:06 -04:00
Olivier Grisel f1c5924b36 ENH better error message for estimators with ensure_min_* checks 2015-10-01 14:44:05 +02:00
MechCoder 0c1afd7e05 [BUG] _init_centroids has an optional x_squared_norms parameter which is not exactly optional 2015-09-10 15:14:32 -04:00
Vighnesh Birodkar 2f099334f9 MAINT deprecate 1d input arrays for all estimators
Passing 1D arrays to check_array, without setting `ensure_2d` to false now
raises a deprecation warning before reshaping it. This will later throw an
error.

All Scaler classes also throw warnings when 1D arrays are passed.

All unit tests/doctests are modified to ensure that no 1D arrays are passed,
except in explicit 1D array tests where the warnings have been silenced.

Additional tests are also included which check for different 1D array cases.

2D array tests with one samples and one features are also added and where
they failed, `check_array` call has been modified to give a more useful error
message
2015-09-09 15:49:58 +02:00
Andreas Mueller 08bf350d4b Merge pull request #5199 from ogrisel/joblib-0.9.0b4
[MRG+1] MAINT bump joblib to 0.9.0b4 to use forkserver for Py3 & POSIX
2015-09-08 18:04:13 -04:00
Olivier Grisel 1529a1e548 MAINT enable multiprocessing + kmeans test on Python 3.4 2015-09-04 11:47:34 +02:00
Joel Nothman 343f9b4dcb ENH sparse precomputed distance matrix in DBSCAN 2015-09-01 11:31:54 +10:00
Gael Varoquaux 0bf75367c9 Merge pull request #5189 from GaelVaroquaux/pr_4779
Pr 4779: Implemented parallelised version of mean_shift and test function
2015-08-30 19:49:24 +01:00
Gael Varoquaux 55c32ef25c Merge pull request #4779 from martinosorb/parallel-ms
[MRG+1] Implemented parallelised version of mean_shift and test function.
2015-08-30 16:28:27 +01:00
Gael Varoquaux c4721f36d8 TST: No n_jobs=-1 in the test
Use n_jobs=2, to avoid blowing up on hugely parallel machines.
2015-08-30 16:00:57 +01:00
Joel Nothman 847e366a2e FIX test with invalid input; simplify dbscan precomputed 2015-08-30 13:49:46 +01:00
martinosorb 3d097ae7df pep8 style 2015-06-20 17:32:52 +01:00
Andreas Mueller 0650d5502e DOC adding backlinks to docstrings 2015-06-03 00:24:04 -04:00
martinosorb de4577b047 Trivial function name bug fixed 2015-05-29 12:18:19 +01:00
martinosorb a8f33d3531 Minor appearance changes 2015-05-29 10:55:34 +01:00
Andreas Mueller a8626b36a6 TST/COSMIT remove nose call boilerplate 2015-05-28 14:54:01 -04:00
martinosorb 4c4b1f7067 Change par system to joblib and n_jobs convention 2015-05-28 12:23:13 +01:00
martinosorb 7041ed283d Implemented parallelised version of mean_shift and test function. 2015-05-27 17:46:00 +01:00
TomDLT 89c1018c64 ENH improve check_array
ENH improve check_array to warn on dtype conversions

ENH make check_array accept several dtypes

ENH change validation with improved check_array

ENH change astype to avoid copy if possible

ENH remove warn_if_not_float
2015-05-19 16:13:42 +02:00
Andreas Mueller ec1bba7f52 FIX / TST raise error when init shape doesn't match n_clusters in KMeans, check for sensible errors. 2015-05-13 09:58:35 -04:00
Loïc Estève af1b652080 FIX DBSCAN fit with precomputed matrix in edge cases
and add test.
2015-04-30 13:40:59 +02:00
Omer Katz 7461b6c84b Nest the for loops because they don't need to run if the condition is not true. 2015-04-11 12:07:34 +03:00
zhai_pro d0302d629e TST: add a test for fortran-aligned data be used in KMeans. 2015-04-07 01:43:12 +08:00
zhai_pro 5527084d6a FIX KMeans with fortran-aligned data.
bad case:
X = np.asfortranarray([[0, 0], [0, 1], [0, 1]])
labels = np.array([0, 1, 1])
km = KMeans(n_init=1, init=centers, precompute_distances=False)
km.fit(X)
print km.cluster_centers_
print km.labels_
print km.n_iter_
2015-04-07 01:29:27 +08:00
Olivier Grisel 56546a7a32 Merge pull request #4423 from vortex-ape/agg_clustering
[MRG + 1] Raising an error when n_clusters <= 0 in AgglomerativeClustering
2015-03-31 10:15:43 +02:00
Raghav R V cd2ee7e454 MAINT docstring --> comments to prevent nose from using doc in verbose mode 2015-03-21 11:16:49 +05:30
Vinayak Mehta ea5474bb77 Raising an error when n_clusters <= 0
Changed ValueError wording
2015-03-21 04:23:35 +05:30
Andreas Mueller d133b1b69c DOC fix n_jobs docs in KMeans as in 0a611193b1. 2015-03-20 11:35:19 -04:00
Olivier Grisel cd4fef9a4a Merge pull request #4322 from amueller/kneighbors_include_self_fixes
[MRG+2] Pass include_self=True to kneighbors_graph
2015-03-20 13:05:10 +01:00
Andreas Mueller 6beacc3fb6 remove deprecated stuff from 0.17 2015-03-18 14:49:04 -04:00
Olivier Grisel 2e99294a54 FIX & TST at least min_samples to be considered a core sample 2015-03-17 16:21:10 +01:00
Lars Buitinck 27d4376dcf ENH optimize DBSCAN by rewriting in Cython
~30% off the running time for a 3.7e5 set of 3-d points.
2015-03-17 16:21:10 +01:00
Andreas Mueller 46060feddc Pass the appropriate include_self argument to kneighbors_graph everywhere. 2015-03-16 13:30:22 -04:00
Joel Nothman 15c9c0f01a FIX/TST boundary cases in dbscan (closes #4073) 2015-03-05 23:31:54 +01:00
Erich Schubert a2087d8eee Do not shuffle in DBSCAN (warn if `random_state` is used).
This makes little difference, and original DBSCAN did not shuffle.
Warn if `random_state` is used.

As is `random_state` encourages users to experiment with different
randomization, as you would do with k-means. But in contrast to
k-means, the output of DBSCAN is deterministic except for cluster
enumeration and "rare" cases, where a point is on the border of
two clusters at the same time. As this affects single points only,
the measureable performance difference will be close to zero.

Also, incorporate fix for minpts including the query point.
2015-03-05 23:31:54 +01:00
Olivier Grisel 0dcd7d3bdd STYLE trailing spaces 2015-03-04 15:06:19 +01:00
Olivier Grisel ed5519fe8a Merge pull request #4307 from amueller/more_quite_testing
[MRG] catch some warnings, be less verbose in testing.
2015-03-03 09:27:15 +01:00
Olivier Grisel 9e20fb6767 Merge pull request #4313 from vortex-ape/spectral_clustering
[MRG + 1] Fixes issue #4304: SpectralClustering should be explicit about include_self
2015-03-02 23:37:53 +01:00
Andreas Mueller f1b8283c95 catch some warnings, be less verbose in testing. 2015-03-02 14:40:35 -05:00
Andreas Mueller 9bc4de8dae some fixes for sphinx and in examples 2015-03-02 12:50:53 -05:00