I'm clustering a largeish dataset (3-4 million rows, 3+ features, all numeric), and I'm clustering with a large k (f~=2000). I'm not actually interested in finding clusters, I and just using kmeans because it relatively evenly partitions non-clustered data (by count). I need all clusters to be assigned to at least some data (ideally enough to do a linear regression on that cluster, so >50), but quite often the clustering fails and some clusters do not get assigned:  &gt;&gt;&gt; mbkmeans = MiniBatchKMeans(n_clusters=2187) &gt;&gt;&gt; len(np.unique(mbkmeans.fit_predict(X))) # .../k_means_.py:1381: RuntimeWarning: init_size=300 should be larger than k=2187. Setting it to 3*k   init_size=init_size) 2165 &gt;&gt;&gt; kmeans.n_iter_ 12   This is not due to duplicated data - in each dataset there are no more than 5% duplicated rows. I suspect it is due to the problem described at , whereby cluster centres end up in a no-man's land between two or more other clusters that are closer to all the intermediate data.  So, the question is, is there any general procedure for avoiding this problem?  And in particular, is there a way to do that in scikit-learn? Or is there a better set of arguments than  that I could use (there are a couple that I don't fully understand)?
I am solving a clustering problem on a trivial dataset with the k-means algorithm. I am running a couple of tests and, from time to time, one centroid doesn't attract any points, i.e. I've got an empty cluster (see the purple "x" in the picture).  What should I do? Shall I delete it or just stop updating its value? Why?    I am aware that built-in functions (e.g., kmeans() in R) have automatic ways of dealing with this situation, but I am trying to write the standard algorithm from scratch. As soon as I fix it I'll be able to compare my results to built-in functions. At this moment I'm looking for some theoretical reasons why I should prefer one solution or another.  In the picture each colour represents a cluster according to the current iteration and each "X" is its centroid (old ones have been kept and marked with the number of the iteration in which they were computed).      [Some related links about empty cluster case, added later by @ttnphns: ; ; ; ; ; ; ; ; ]
For starters I am using this GREAT answer to achieve custom post types as well as a custom way to insert those post types into other pages, you can view that answer here:   I am running into a problem however when wordpress auto saves itself, it clears whatever metadata i have put into the forms.  EXAMPLE:  I select the 3 drop downs I want from my metabox and hit update.  The page reloads and the 3 choices are still selected.  In phpMyAdmin i can look up the metadata and see the array in place as it should be.  I now wait for wordpress to auto save.  As soon as this happens i can either refresh the page (not update, just refresh) and the metadata is lost, or i can look up the metadata in phpMyAdmin and it will display nothing (ie: its gone).  I'm guessing that this has something to do with needing to tie into another hook (some sorta auto update hook) or something, but even then it doesn't make sense that it would actually delete your metadata (rather than just not auto updating it).  Last note: If you copy and paste Mikes code into functions.php, you should be able to recreate my error (in wordpress 3.1) very easy. How can I add the word "Chap" before the chapters numbers in the Toc in class report? At here  the word Chapter added in \documentclass{book}. Now I want to use them in \documentclass{report}. How can I do that? What is the path of an MTP device in Windows? I am running Windows XP and have a phone mounted through USB by MTP.  In Explorer, its address is:  My Computer\SAMSUNG-SGH-I547\Phone\DCIM   I would like to execute a command line command such as  explorer "My Computer\SAMSUNG-SGH-I547\Phone\DCIM\Camera"   so as to quickly go to the Camera folder. (Right-clicking the device or anything in it does NOT provide a "Create Shortcut" dialog.)  But "My Computer" is not a valid PATH in Windows. Unlike USB flash drives, it seems the phone mounted by MTP does not get a letter drive name.  So, what is the path of an MTP device in Windows?  If the answer is there is no command line path, is there workaround? What alternative notation of subscripts/superscripts that are also treated as SYMBOLS in Mathematica? Let K={(1),(12)(34),(13)(24),(14)(23)} show that K is a normal subgroup of the alternating group of degree A4 and find all the members of A4/K and write down the group table for A4/K.   i know that K is the Klein four group and i have already proven it is a normal subgroup but i need a start on approaching the A4/K part of this question no direct answers are necessary,just ideas thank you! :) Log4Net "Could not find schema information" messages folder content doesn't get refreshed automatically in ubuntu 14.04 I'm using Ubuntu 14.04 and when I'm doing experiments which creates new files inside a particular folder X. But I can't see these new files inside X without refreshing X.  I have increased the count to 1M in  /proc/sys/fs/inotify/max_user_watches   but still the issue is not fixed.   How to fix it?  EDIT As suggested, output of cat /etc/xdg/autostart/user-dirs-update-gtk.desktop  [Desktop Entry] Encoding=UTF-8 Exec=xdg-user-dirs-gtk-update Name=User folders update Comment=Update common folders names to match current locale Terminal=false OnlyShowIn=GNOME;LXDE;Unity; Type=Application StartupNotify=false X-KDE-autostart-after=panel NoDisplay=true X-Ubuntu-Gettext-Domain=xdg-user-dirs-gtk Why do we yawn? I've read a new study which suggests that yawning may help you keep a cool head. Also, the findings might hold some hope for sufferers of insomnia, migraines, and even epilepsy.  Is there any conclusion about what the function of yawning is and why do we yawn? Two "offtopic" flag reasons Catch Regex too complicated when splitting a string in salesforce I have created a function wherein I split a string from the csv filecsvAsString.split('\n') . It is working when the string is not so big. But when I try to split a very large string, an error will occur      regex too complicated   what I want to do is to catch if an error occur during the split process. How will I do it ? I've tried to use try and catch but the problem still occur. Is there any other possible solution? How can friction do no work in case of pure rolling? I have read various answers , on PSE and elsewhere , and most of them explain that the point of contact of the rolling object undergoes 0 instantaneous displacement in the direction of friction, I agree , but then there is a feeling that the friction does provide a torque , so how can it do 0 work . ( The pure rolling here is under a constant external force on the object so friction does act ). I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal  !! and prints   sudo: !!: command not found   If I use double quotes, it substitutes the double bang in the string itself, so that doesn't work.  Is there any way to make this work? Or an alternative alias? ` Device : Moto X Play ( Rooted, Stock, Android 6.0.1, msm8916 Board, XT1562)  Why do I want to limit charging ?  ( Let's leave out whether my reasons are valid or not and accept that I want to, if you disagree with my reasons)  To improve the longevity of battery , I wish to limit charging when it reaches 90%, as explained here    Is it possible?  Yes, at least on my previous device Honor 6, as brought out here , with two different ways of doing it  I have tried  unsuccessfully to identify the file responsible in which changing values would limit charging  I am looking for the system file responsible for stopping charging, with it's true path (without symlinks)  (as I saw on on my previous device, locating the path of file was a big challenge after identifying it) Why KL divergence is non-negative? Why is KL divergence non-negative?  From the perspective of information theory, I have such an intuitive understanding:  Say there are two ensembles $A$ and $B$ which are composed of the same set of elements labeled by $x$. $p(x)$ and $q(x)$ are different probability distributions over ensemble $A$ and $B$ respectively.   From the perspective of information theory, $\log_{2}(P(x))$ is the least amount of bits that required for recording an element $x$ for ensemble $A$. So that the expectation $$\sum_{x \in  ensemble}-p(x)\ln(p(x))$$ can be interpreted as at least how many bits that we need for recording an element in $A$ on average.   Since this formula puts a lower bound on the bits that we need on average, so that for a different ensemble $B$ which brings about a different probability distribution $q(x)$, the bound that it gives for each element $x$ will surely not bit that is given by $p(x)$, which means taking the expectation, $$\sum_{x\in ensemble}-p(x)\ln(q(x))$$ this average length will surely be greater than the former one, which leads to $$\sum_{x\in ensemble }p(x)\frac{\ln(p(x))}{\ln(q(x))} &gt; 0$$  I don't put $\ge$ here since $p(x)$ and $q(x)$ are different.  This is my intuitive understanding, is there a purely mathematical way of proving KL divergence is non-negative? The problem can be stated as:  Given $p(x)$ and $q(x)$ are both positive over real line, and $\int_{-\infty}^{+\infty}p(x)dx = 1$, $\int_{-\infty}^{+\infty}q(x)dx = 1$.  Prove $$\int_{-\infty}^{+\infty}p(x)\ln\frac{p(x)}{q(x)}$$ is non-negative.  How can this be proved? Or can this be proved without extra conditions? Can Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models? I just installed Ubuntu 13.10, and I can't configure my wi-fi Epson TX430W printer.  Using the Settings-&gt;Printers interface, I can detect the printer. When I click add, I briefly see a "Searching for drivers" dialog. It dissapears, and then I'm left with the printer forever in "Installing" status.  If I close the window and reopen Printers, it doesn't show up on the list.  How can I solve, or at least diagnose the problem? Android Phone SD Card Problem My Samsung Galaxy Admire phone is saying that an SD card isn't found when the SD card is inside the phone: it shows "Please insert SD Card".  What could be wrong? This isn't a particularly major issue, but I've had this thing nagging me for a while. When looking at QGIS 3.4's global variables, user_full_name is assigned my given and surname, which includes a diaeresis (¨) somewhere in there. I can't seem to find any way to get QGIS to switch/adapt encoding and display the name correctly. The accented character gets switched to that ubiquitous black rhombus.  I looked for info on this behavior and found moderately similar issues like  and  but it's not exactly the same problem as it's not a geodata encoding issue but rather how QGIS deals with values pulled from the OS.  I have tried unchecking the Override system locale tickbox in Options|General as I prefer to use American English even though my OS is set to Canadian French. No effect to observe.  There's somewhat of a workaround right now which is to fix the name in the Project variable project_author as it is editable (it's filled with the offending global variable by default).  I'm curious to know, though, if someone has encountered this before and if there's a solution in QGIS. Clicking to reload an updated answer removes the code snippet buttons and removes syntax highlighting Is it possible to wipe an entire iCloud Photo Library? I've been using the beta iCloud Photo Library for a week and a bunch of photos got duplicated and I'd like to wipe all the photos out and start over.  I have backups of all the photos and have turned off iPhoto Cloud Library on all iOS devices. When I log into the web app - it still shows dozens of albums and I can delete all the photos, then go to deleted items and then purge them, but the ghost albums are still there messing things up.  I've turned off the library entirely and you can see there is a 30 day waiting period.     If I click on albums, there are pages of them and no delete button anywhere. If I turn on the library on an iOS device, data starts flooding back as if I wanted to recover the photos.  I don't want to recover anything, I want a clean wipe and clean slate.  Currently, there are 7807 photos in the deleted album and no way to mass delete them. I have 31 albums that show up in iCloud and no way to delete them.  Is there some way to accelerate this or must people wait a month for a corrupt library to eventually be purged to start over?  (I have tickets open with AppleCare after  and it's escalated to engineering, but I was informed that it might be a week or two before it gets seen :-( Perhaps someone has a better idea to clear things out or noticed something I've missed.)