source code for k medoid algorithm using java
#1

i required source code of k-medioids algorithm in java for my proect work.
Reply
#2
source code for k medoid algorithm using java

Data Mining is a fairly recent and contemporary topic in computing. However, Data Mining applies many older computational techniques from statistics, machine learning and pattern recognition. This paper explores two most popular clustering techniques are the k-means& k-medoids clustering algorithm. However, k-means algorithm is cluster or to group your objects based on attributes into K number of group and k-medoids is a related to the K-means algorithm. These algorithms are based on the k partition algorithms and both attempt to minimize squared error. In contrast to the K-means algorithm K-medoids chooses data points as centres. The algorithms have been developed in Java, for integration with Weka Machine Learning Software. The algorithms have been run with two dataset Facial palsy and Stemming. It is having been shown that the algorithm is generally faster and more accurate than other clustering algorithms.

Data Mining derives its name from the similarities between searching for valuable business information in a large database (for example, finding linked products in gigabytes of store scanner data) and mining a mountain for a vein of valuable ore.[1] Both process requires either sifting through an immense amount of material. Or intelligently probing it to find exactly where the value resides.

/* vim: set ts=2: */
/**
* Copyright © 2008 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions, and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. Redistributions must acknowledge that this software was
* originally developed by the UCSF Computer Graphics Laboratory
* under support by the NIH National Center for Research Resources,
* grant P41-RR01081.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package clusterMaker.algorithms.attributeClusterers.kmedoid;

import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import javax.swing.JPanel;

// Cytoscape imports
import cytoscape.Cytoscape;
import cytoscape.data.CyAttributes;
import cytoscape.layout.Tunable;
import cytoscape.logger.CyLogger;
import cytoscape.task.TaskMonitor;

import clusterMaker.algorithms.ClusterAlgorithm;
import clusterMaker.algorithms.AbstractClusterAlgorithm;
import clusterMaker.algorithms.attributeClusterers.AbstractAttributeClusterer;
import clusterMaker.algorithms.attributeClusterers.DistanceMetric;
import clusterMaker.algorithms.attributeClusterers.Matrix;
import clusterMaker.ui.ClusterViz;
import clusterMaker.ui.KnnView;

// clusterMaker imports

public class KMedoidCluster extends AbstractAttributeClusterer {
int rNumber = 10;
KnnView knnView = null;

public KMedoidCluster() {
super();
logger = CyLogger.getLogger(KMedoidCluster.class);
initializeProperties();
}

public String getShortName() {return "kmedoid";};
public String getName() {return "K-Medoid cluster";};

public JPanel getSettingsPanel() {
// Everytime we ask for the panel, we want to update our attributes
Tunable attributeTunable = clusterProperties.get("attributeList");
attributeArray = getAllAttributes();
attributeTunable.setLowerBound((Object)attributeArray);

// We also want to update the number our "guestimate" for k and kMax
updateKEstimates();

return clusterProperties.getTunablePanel();
}

public ClusterViz getVisualizer() {
// if (knnView == null)
// knnView = new KnnView();

return new KnnView();
}

public void initializeProperties() {
super.initializeProperties();

/**
* Tuning values
*/

// K
addKTunables();

// Number of iterations
clusterProperties.add(new Tunable("iterations",
"Number of iterations",
Tunable.INTEGER, new Integer(rNumber),
(Object)rNumber, (Object)null, 0));

// The distance metric to use
clusterProperties.add(new Tunable("dMetric",
"Distance Metric",
Tunable.LIST, new Integer(0),
(Object)Matrix.distanceTypes, (Object)null, 0));

clusterProperties.add(new Tunable("attributeListGroup",
"Source for array data",
Tunable.GROUP, new Integer(1)));

// The attribute to use to get the weights
attributeArray = getAllAttributes();
clusterProperties.add(new Tunable("attributeList",
"Array sources",
Tunable.LIST, "",
(Object)attributeArray, (Object)null, Tunable.MULTISELECT));

// Whether or not to only cluster selected nodes/edges
clusterProperties.add(new Tunable("selectedOnly",
"Only use selected nodes/edges for cluster",
Tunable.BOOLEAN, new Boolean(selectedOnly)));

// Whether or not to cluster attributes as well as nodes
clusterProperties.add(new Tunable("clusterAttributes",
"Cluster attributes as well as nodes",
Tunable.BOOLEAN, new Boolean(clusterAttributes)));

// Whether or not to create groups
clusterProperties.add(new Tunable("createGroups",
"Create groups from clusters",
Tunable.BOOLEAN, new Boolean(createGroups)));

clusterProperties.initializeProperties();
updateSettings(true);
}

public void updateSettings() {
updateSettings(false);
updateKTunables(false);
}

public void updateSettings(boolean force) {
clusterProperties.updateValues();
super.updateSettings(force);
updateKTunables(force);

Tunable t = clusterProperties.get("iterations");
if ((t != null) && (t.valueChanged() || force))
rNumber = ((Integer) t.getValue()).intValue();

t = clusterProperties.get("dMetric");
if ((t != null) && (t.valueChanged() || force))
distanceMetric = Matrix.distanceTypes[((Integer) t.getValue()).intValue()];

t = clusterProperties.get("clusterAttributes");
if ((t != null) && (t.valueChanged() || force))
clusterAttributes = ((Boolean) t.getValue()).booleanValue();

t = clusterProperties.get("selectedOnly");
if ((t != null) && (t.valueChanged() || force))
selectedOnly = ((Boolean) t.getValue()).booleanValue();

t = clusterProperties.get("createGroups");
if ((t != null) && (t.valueChanged() || force))
createGroups = ((Boolean) t.getValue()).booleanValue();

t = clusterProperties.get("attributeList");
if ((t != null) && (t.valueChanged() || force)) {
dataAttributes = (String) t.getValue();
}
}

public void doCluster(TaskMonitor monitor) {
this.monitor = monitor;
// Sanity check all of our settings
if (debug)
logger.debug("Performing k-medoid cluster with k="+kNumber+" using "+distanceMetric+" and attributes: "+dataAttributes);

if (dataAttributes == null || dataAttributes.length() == 0) {
if (monitor != null) {
monitor.setException(null, "Error: no attribute list selected");
logger.warning("Must have an attribute list to use for cluster weighting");
} else
logger.error("Must have an attribute list to use for cluster weighting");
return;
}

// Get our attributes we're going to use for the cluster
String attributeArray[] = getAttributeArray(dataAttributes);
// To make debugging easier, sort the attribute array
Arrays.sort(attributeArray);

KMCluster algorithm = new KMCluster(attributeArray, distanceMetric, logger, monitor);
algorithm.setCreateGroups(createGroups);
algorithm.setIgnoreMissing(true); // KMedoid doesn't handle missing data well
algorithm.setSelectedOnly(selectedOnly);
algorithm.setDebug(debug);
algorithm.setUseSilhouette(useSilhouette);
algorithm.setKMax(kMax);
algorithm.setInitializeNearCenter(initializeNearCenter);
algorithm.setClusterInterface(this);

String resultsString = "K-Medoid results:";

// Cluster the attributes, if requested
if (clusterAttributes && attributeArray.length > 1) {
if (monitor != null)
monitor.setStatus("Clustering attributes");
resultsString = "\nAttributes: " + algorithm.cluster(kNumber, rNumber, true, "kmedoid");
}

// Cluster the nodes
if (monitor != null)
monitor.setStatus("Clustering nodes");
resultsString = "\nNodes: "+algorithm.cluster(kNumber, rNumber, false, "kmedoid");
if (monitor != null)
monitor.setStatus(resultsString);

// Tell any listeners that we're done
pcs.firePropertyChange(ClusterAlgorithm.CLUSTER_COMPUTED, null, this);
}

}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: modified k medoid clustering algorithm with source code in matlab, import no namespace, zfs import, source code for k medoid algorithm using java, k medoid program in java source code, k medoid java, k medoid clustering java program,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 18,986 20-07-2018, 12:08 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,231 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 18,495 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 7,930 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  image encryption and decryption using rsa algorithm in matlab 2 7,829 29-05-2017, 04:17 PM
Last Post: Priyanka Bidikar
  download liver tumor ct scan image in matlab with source code 4 7,987 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  online cab booking source code in asp net 3 7,863 11-05-2017, 10:39 AM
Last Post: jaseela123d
Thumbs Up online catering management system on php with report and source code and ppt 4 8,720 29-04-2017, 10:59 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,447 11-04-2017, 08:31 PM
Last Post: Guest
  automatic timetable generator source code vb 1 7,526 07-04-2017, 12:31 PM
Last Post: jaseela123d

Forum Jump: