On Sun, Nov 24, 2013 at 4:22 PM, Olivier Grisel <[email protected]>wrote:

> Could you please try to pull the branch from this pull request and
> check that it fixes your issue:
>
> https://github.com/scikit-learn/scikit-learn/pull/2355


I'm afraid it doesn't. With that PR branch I get the same error. Here is
some code that reproduces it:

import numpy as np
from sklearn.cluster import MiniBatchKMeans

K = 500
data = np.random.randn(42924, 128) # this is what my data looks like
mbk = MiniBatchKMeans(n_clusters=K, batch_size=100, verbose=1)
mbk.fit(data)
centroids = mbk.cluster_centers_

And the Traceback:

squacco:multimodal$ python testmbk.py
Init 1/3 with method: k-means++
/local/filespace/dk427/lib/python2.7/site-packages/sklearn/cluster/k_means_.py:1187:
RuntimeWarning: init_size=300 should be larger than k=500. Setting it to 3*k
  init_size=init_size)
Inertia for init 1/3: 20900.146448
Init 2/3 with method: k-means++
Inertia for init 2/3: 21291.729690
Init 3/3 with method: k-means++
Inertia for init 3/3: 22090.843365
Minibatch iteration 1/43000: mean batch inertia: 130.809849, ewa inertia:
130.809849
Minibatch iteration 2/43000: mean batch inertia: 127.865080, ewa inertia:
130.796128
Minibatch iteration 3/43000: mean batch inertia: 128.189004, ewa inertia:
130.783981
Minibatch iteration 4/43000: mean batch inertia: 126.905243, ewa inertia:
130.765909
Minibatch iteration 5/43000: mean batch inertia: 124.422746, ewa inertia:
130.736354
Minibatch iteration 6/43000: mean batch inertia: 125.622408, ewa inertia:
130.712527
Minibatch iteration 7/43000: mean batch inertia: 124.553921, ewa inertia:
130.683832
Minibatch iteration 8/43000: mean batch inertia: 126.097794, ewa inertia:
130.662464
Minibatch iteration 9/43000: mean batch inertia: 124.221944, ewa inertia:
130.632456
[MiniBatchKMeans] Reassigning 100 cluster centers.
Traceback (most recent call last):
  File "testmbk.py", line 11, in <module>
    mbk.fit(data)
  File
"/local/filespace/dk427/lib/python2.7/site-packages/sklearn/cluster/k_means_.py",
line 1231, in fit
    verbose=self.verbose)
  File
"/local/filespace/dk427/lib/python2.7/site-packages/sklearn/cluster/k_means_.py",
line 901, in _mini_batch_step
    centers[to_reassign] = X[new_centers]
ValueError: array is not broadcastable to correct shape

Thanks,

Douwe
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to