Class ExternalClustering

  • All Implemented Interfaces:
    elki.Algorithm, ClusteringAlgorithm<Clustering<? extends Model>>

    @Description("Load clustering results from an external file. Each line is expected to consists of one clustering, one integer per point and an (optional) non-numeric label.")
    public class ExternalClustering
    extends java.lang.Object
    implements ClusteringAlgorithm<Clustering<? extends Model>>
    Read an external clustering result from a file, such as produced by ClusteringVectorDumper.

    The input format of this parser is text-based:

     # Optional comment
     1 1 1 2 2 2 -1 Example label
     
    Where non-negative numbers are cluster assignments, negative numbers are considered noise clusters.
    Since:
    0.7.0
    Author:
    Erich Schubert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ExternalClustering.Par
      Parameterization class
      • Nested classes/interfaces inherited from interface elki.Algorithm

        elki.Algorithm.Utils
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String COMMENT
      The comment character.
      private java.net.URI file
      The file to be reparsed.
      private static elki.logging.Logging LOG
      The logger for this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExternalClustering​(java.net.URI file)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void attachToRelation​(elki.database.relation.Relation<?> r, it.unimi.dsi.fastutil.ints.IntArrayList assignment, java.util.ArrayList<java.lang.String> name)
      Build a clustering from the file result.
      Clustering<? extends Model> autorun​(elki.database.Database database)
      Run the algorithm.
      elki.data.type.TypeInformation[] getInputTypeRestriction()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final elki.logging.Logging LOG
        The logger for this class.
      • COMMENT

        public static final java.lang.String COMMENT
        The comment character.
        See Also:
        Constant Field Values
      • file

        private java.net.URI file
        The file to be reparsed.
    • Constructor Detail

      • ExternalClustering

        public ExternalClustering​(java.net.URI file)
        Constructor.
        Parameters:
        file - File to load
    • Method Detail

      • getInputTypeRestriction

        public elki.data.type.TypeInformation[] getInputTypeRestriction()
        Specified by:
        getInputTypeRestriction in interface elki.Algorithm
      • autorun

        public Clustering<? extends Model> autorun​(elki.database.Database database)
        Run the algorithm.
        Specified by:
        autorun in interface elki.Algorithm
        Specified by:
        autorun in interface ClusteringAlgorithm<Clustering<? extends Model>>
        Parameters:
        database - Database to use
        Returns:
        Result
      • attachToRelation

        private void attachToRelation​(elki.database.relation.Relation<?> r,
                                      it.unimi.dsi.fastutil.ints.IntArrayList assignment,
                                      java.util.ArrayList<java.lang.String> name)
        Build a clustering from the file result.
        Parameters:
        r - Result to attach to
        assignment - Cluster assignment
        name - Name