Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
different results using R in windows and linux

I have a problem using kmeans in a ubuntu system. I seem to be getting different results! My data is say:

x<- c(0.1295..,-0.58928,-0.244252,-0.41614,-0.58804,-0.74628,-0.9045188,-1.050903,-1.197288,-1.3353877,-1.47348656,-1.607894)

when I perform kmeans function and want to get only the max value of kmeans$centers in a windows system,

means <- max(kmeans(x, 3)$centers)
means
[1] -0.05892

When I run the exact code in ubuntu 12.04 system, I get a completely different answer

means <- max(kmeans(x,3)$centers)
means
[1] -0.1482334

So, I performed the kmeans again without the max function

means <- kmeans(x, 3)
means$centers
NULL

But, means itself has all the entries

means


Available components:
[1] "cluster" "centers" "tots" "withinss" "tot.withinss"
[6] "betweenss" "size" "iter" "ifault"

There seems to be something changing between the functionality in windows and linux. Can anyone help me figuring this out?!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

A k-means algorithm generally is not deterministic, i.e., it usually does not lead to perfectly reproducible results. The main reason is that in common algorithms the initialization is random.

As discussed in ?kmeans

trying several random starts (nstart> 1) is often recommended

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!