Reputation: 534
I am using the set.seed and kmeans function. Although I use set.seed my cluster centers keep changing but my data isn't. And, it only changes from day to day, not daily. So, within the same day there aren't any changes, but the next day my clusters will change. I'm assuming the set.seed function is causing this. If so, does anyone know how to set randomness within kmeans or similar function? Can someone give me some insight. Sample code below:
set.seed(1234)
ITsegment2 <- kmeans(iTeller_z, 4)
Upvotes: 1
Views: 1117
Reputation: 686
There is probably something more clever but here an easy solution :
set.seed(as.numeric(Sys.Date()))
Sys.Date() returns the today date, as.numeric transform's it into a number...So the number will change every day .
Cheers
Upvotes: 0