Class Dyad

  • All Implemented Interfaces:
    org.api4.java.ai.ml.ranking.dyad.dataset.IDyad

    public class Dyad
    extends java.lang.Object
    implements org.api4.java.ai.ml.ranking.dyad.dataset.IDyad
    Represents a dyad consisting of an instance and an alternative, represented by feature vectors.
    • Constructor Summary

      Constructors 
      Constructor Description
      Dyad​(org.api4.java.common.math.IVector instance, org.api4.java.common.math.IVector alternative)
      Construct a new dyad consisting of the given instance and alternative.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      org.api4.java.common.math.IVector getAlternative()
      Get the alternative.
      org.api4.java.common.math.IVector getContext()
      Get the instance.
      int hashCode()  
      double[] toDoubleVector()  
      java.lang.String toString()  
      org.nd4j.linalg.api.ndarray.INDArray toVector()
      Converts a dyad to a INDArray row vector consisting of a concatenation of the instance and alternative features.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Dyad

        public Dyad​(org.api4.java.common.math.IVector instance,
                    org.api4.java.common.math.IVector alternative)
        Construct a new dyad consisting of the given instance and alternative.
        Parameters:
        instance - The instance
        alternative - The alternative
    • Method Detail

      • getContext

        public org.api4.java.common.math.IVector getContext()
        Get the instance.
        Specified by:
        getContext in interface org.api4.java.ai.ml.ranking.dyad.dataset.IDyad
        Returns:
        the instance
      • getAlternative

        public org.api4.java.common.math.IVector getAlternative()
        Get the alternative.
        Specified by:
        getAlternative in interface org.api4.java.ai.ml.ranking.dyad.dataset.IDyad
        Returns:
        the alternative
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toVector

        public org.nd4j.linalg.api.ndarray.INDArray toVector()
        Converts a dyad to a INDArray row vector consisting of a concatenation of the instance and alternative features.
        Returns:
        The dyad in INDArray row vector form.
      • toDoubleVector

        public double[] toDoubleVector()
        Specified by:
        toDoubleVector in interface org.api4.java.ai.ml.ranking.dyad.dataset.IDyad