Class TuplesLinkPredictionFormat<U>

java.lang.Object
es.uam.eps.ir.relison.links.linkprediction.io.TuplesLinkPredictionFormat<U>
Type Parameters:
U - type of the users.
All Implemented Interfaces:
LinkPredictionFormat<U>
Direct Known Subclasses:
SimpleLinkPredictionFormat

public class TuplesLinkPredictionFormat<U>
extends java.lang.Object
implements LinkPredictionFormat<U>
Format for writing the link predictions. This format writes tuples in the format

origin_node, destination_node, score

  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    protected class  TuplesLinkPredictionFormat.Reader
    The reader for the format.
    protected class  TuplesLinkPredictionFormat.Writer
    Writer for the format.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private boolean sortByDecreasingScore
    True if we want to sort the tuples by decreasing score, false otherwise.
    private java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader
    Function for transforming a read tuple into a ((node1, node2), value) triplet.
    private org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter
    Function for setting triplets into text.
  • Constructor Summary

    Constructors 
    Constructor Description
    TuplesLinkPredictionFormat​(org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter, java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader)
    Constructor.
    TuplesLinkPredictionFormat​(org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter, java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader, boolean sortByDecreasingScore)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    LinkPredictionFormat.Reader<U> getReader​(java.io.InputStream in)
    Gets a reader for an input stream.
    LinkPredictionFormat.Writer<U> getWriter​(java.io.OutputStream out)
    Gets a writer for an output stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.relison.links.linkprediction.io.LinkPredictionFormat

    getReader, getReader, getReader, getWriter, getWriter, getWriter
  • Field Details

    • tupleWriter

      private final org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter
      Function for setting triplets into text.
    • tupleReader

      private final java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader
      Function for transforming a read tuple into a ((node1, node2), value) triplet.
    • sortByDecreasingScore

      private final boolean sortByDecreasingScore
      True if we want to sort the tuples by decreasing score, false otherwise.
  • Constructor Details

    • TuplesLinkPredictionFormat

      public TuplesLinkPredictionFormat​(org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter, java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader)
      Constructor.
      Parameters:
      tupleWriter - tuple writer.
      tupleReader - tuple reader.
    • TuplesLinkPredictionFormat

      public TuplesLinkPredictionFormat​(org.jooq.lambda.function.Function3<U,​U,​java.lang.Double,​java.lang.String> tupleWriter, java.util.function.Function<java.lang.String,​org.ranksys.core.util.tuples.Tuple2od<Pair<U>>> tupleReader, boolean sortByDecreasingScore)
      Constructor.
      Parameters:
      tupleWriter - tuple writer.
      tupleReader - tuple reader.
      sortByDecreasingScore - true if we want to sort the tuples by decreasing score, false otherwise.
  • Method Details