Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9101309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:05:46+00:00 2026-06-17T01:05:46+00:00

I am using weka kmeans classifier and i have build it a model.Now i

  • 0

I am using weka kmeans classifier and i have build it a model.Now i want to cluster center value of each centroid.
I get it on weka UI

Attribute    Full Data          0          1
               (48836)    (39469)     (9367)
============================================
tt            428.6238   514.1345    68.3143

How can i get it using weka java jar?

My weka cluster training set has only one attribute.

To get attribute name i do:
String attname =clusterCenters.get(0).attribute(0).name();

How to get value of cluster center?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:05:47+00:00Added an answer on June 17, 2026 at 1:05 am

    When you call to the method getClusterCentroids() in SimpleKMeans you get an Instances object (in weka-3-6-8). This is a set of instances that represent your cluster centers (one for each specified cluster).

    SimpleKMeans kmeans = ...
    // your code
    ...
    Instances instances = kmeans.getClusterCentroids();
    

    Once we have the set of instances (centroids), we can guess its size by numInstances(), iterate through them using instance(int index) and getting their values with double value(int attIndex) this way:

    for ( int i = 0; i < instances.numInstances(); i++ ) {
        // for each cluster center
        Instance inst = instances.instance( i );
        // as you mentioned, you only had 1 attribute
        // but you can iterate through the different attributes
        double value = inst.value( 0 );
        System.out.println( "Value for centroid " + i + ": " + value );
    }
    

    And that is all.
    I have not compiled the code, but that is the way I do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been using the Weka Explorer GUI to build a few classifier models.
I have a simple naive bayes classifier from WEKA. I'm using a directory structure
I have been using WEKA to do some text classification work and I want
I start using NaiveBayes/Simple classifier for classification (Weka), however I have some problems to
I am currently writing a program using Weka that builds a model (using one
I'm generating a power model using Multilayer Perceptron on Weka which is a statistic
Hi, I am using weka.classifier.meta. Vote. I am combining three classifiers, one of them
I'm using the explorer feature of Weka for classification. So I have my .arff
I want to train a MultiLayerPerceptron using Weka with ~200 samples and 6 attributes.
Recently I started using Weka Explorer for classification problem. I have two types of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.