All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.mallet.cluster.Clusterer Maven / Gradle / Ivy

Go to download

MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.

The newest version!
/* Copyright (C) 2003 Univ. of Massachusetts Amherst, Computer Science Dept.
   This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).
   http://www.cs.umass.edu/~mccallum/mallet
   This software is provided under the terms of the Common Public License,
   version 1.0, as published by http://www.opensource.org.  For further
   information, see the file `LICENSE' included with this distribution. */

package cc.mallet.cluster;


import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

import cc.mallet.pipe.Pipe;
import cc.mallet.types.InstanceList;

/**
 * An abstract class for clustering a set of points.
 * @author Jerod Weinman [email protected]
 */
public abstract class Clusterer implements Serializable {
	
	Pipe instancePipe;
	
	/**
	 * Creates a new Clusterer instance.
	 *
	 * @param instancePipe Pipe that created the InstanceList to be
	 * clustered.
	 */
	public Clusterer(Pipe instancePipe) {
		this.instancePipe = instancePipe;
	}
	
	/** Return a clustering of an InstanceList */
	public abstract Clustering cluster (InstanceList trainingSet);

	public Pipe getPipe () { return instancePipe; }
	
	// SERIALIZATION

  private static final long serialVersionUID = 1;
  private static final int CURRENT_SERIAL_VERSION = 1;

  private void writeObject (ObjectOutputStream out) throws IOException {
    out.defaultWriteObject ();
    out.writeInt (CURRENT_SERIAL_VERSION);
  }

  private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject ();
    int version = in.readInt ();
  }	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy