Class ExternalClustering

  • All Implemented Interfaces:
    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
    • 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 Logging LOG
      The logger for this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExternalClustering​(java.net.URI file)
      Constructor.
    • Field Detail

      • LOG

        private static final 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 TypeInformation[] getInputTypeRestriction()
        Description copied from interface: Algorithm
        Get the input type restriction used for negotiating the data query.
        Specified by:
        getInputTypeRestriction in interface Algorithm
        Returns:
        Type restriction
      • attachToRelation

        private void attachToRelation​(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