SHARE
TWEET

Untitled

a guest Aug 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # As the initial centroids are defined randomly,
  2. # we define a seed for purposes of reprodutability
  3. set.seed(123)
  4.  
  5. # Let's remove the column with the mammals' names, so it won't be used in the clustering
  6. input <- all.mammals.milk.1956[,2:6]
  7.  
  8. # The nstart parameter indicates that we want the algorithm to be executed 20 times.
  9. # This number is not the number of iterations, it is like calling the function 20 times and then
  10. # the execution with lower variance within the groups will be selected as the final result.
  11. kmeans(input, centers = 3, nstart = 20)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top