Class NominalStats

java.lang.Object
es.uam.eps.ir.ranksys.core.util.Stats
es.uam.eps.ir.relison.links.data.letor.NominalStats

public class NominalStats
extends es.uam.eps.ir.ranksys.core.util.Stats
Statistics values for nominal features.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.List<java.lang.Long> counter
    Counts the number of values for each nominal value.
    private it.unimi.dsi.fastutil.doubles.Double2IntMap index
    Maps doubles to integers.
    private java.util.List<java.lang.Double> list
    Maps integers to doubles.
    private int numValues
    Number of different values for the attribute.
  • Constructor Summary

    Constructors 
    Constructor Description
    NominalStats()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    void accept​(double value)  
    void combine​(es.uam.eps.ir.ranksys.core.util.Stats stats)  
    long getCount​(double value)
    Obtains the number of elements for some nominal value.
    long getCount​(int idx)
    Obtains the number of times that the i-th nominal value has appeared in the collection.
    int getNumValues()
    Obtains the number of different values for the feature.
    double getProportion​(double value)
    Obtains the proportion of the examples which have the given nominal value for the corresponding parameter.
    double getProportion​(int idx)
    Obtains the proportion of the examples which have the i-th nominal value for the corresponding parameter.
    double getValue​(int idx)
    Obtains the value of the i-th nominal value.
    java.util.List<java.lang.Double> getValues()
    Obtains the different possible values for the features.
    int indexOfValue​(double value)
    Obtains the index for some value.
    void reset()  

    Methods inherited from class es.uam.eps.ir.ranksys.core.util.Stats

    getMax, getMean, getMin, getN, getStandardDeviation, getVariance

    Methods inherited from class java.lang.Object

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

    • counter

      private final java.util.List<java.lang.Long> counter
      Counts the number of values for each nominal value.
    • index

      private final it.unimi.dsi.fastutil.doubles.Double2IntMap index
      Maps doubles to integers.
    • list

      private final java.util.List<java.lang.Double> list
      Maps integers to doubles.
    • numValues

      private int numValues
      Number of different values for the attribute.
  • Constructor Details

  • Method Details

    • accept

      public void accept​(double value)
      Overrides:
      accept in class es.uam.eps.ir.ranksys.core.util.Stats
    • combine

      public void combine​(es.uam.eps.ir.ranksys.core.util.Stats stats)
      Overrides:
      combine in class es.uam.eps.ir.ranksys.core.util.Stats
    • reset

      public void reset()
      Overrides:
      reset in class es.uam.eps.ir.ranksys.core.util.Stats
    • getNumValues

      public int getNumValues()
      Obtains the number of different values for the feature.
      Returns:
      the number of different values for the feature.
    • getValues

      public java.util.List<java.lang.Double> getValues()
      Obtains the different possible values for the features.
      Returns:
      the values for the features.
    • getValue

      public double getValue​(int idx)
      Obtains the value of the i-th nominal value.
      Parameters:
      idx - index for the value.
      Returns:
      the value if it exists, NaN otherwise
    • indexOfValue

      public int indexOfValue​(double value)
      Obtains the index for some value.
      Parameters:
      value - the value.
      Returns:
      the index if it exists, -1 otherwise.
    • getCount

      public long getCount​(int idx)
      Obtains the number of times that the i-th nominal value has appeared in the collection.
      Parameters:
      idx - the index of the nominal value.
      Returns:
      the index of the nominal value.
    • getCount

      public long getCount​(double value)
      Obtains the number of elements for some nominal value.
      Parameters:
      value - the nominal value.
      Returns:
      the numbe of elements for that value.
    • getProportion

      public double getProportion​(int idx)
      Obtains the proportion of the examples which have the i-th nominal value for the corresponding parameter.
      Parameters:
      idx - the index of the nominal value.
      Returns:
      the corresponding proportion.
    • getProportion

      public double getProportion​(double value)
      Obtains the proportion of the examples which have the given nominal value for the corresponding parameter.
      Parameters:
      value - the nominal value.
      Returns:
      the corresponding proportion, NaN if something failed.