Class IndexFeatureData<I>

java.lang.Object
es.uam.eps.ir.relison.links.recommendation.features.IndexFeatureData<I>
Type Parameters:
I - type of the items.
All Implemented Interfaces:
es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>, es.uam.eps.ir.ranksys.core.index.FeatureIndex<java.lang.String>, es.uam.eps.ir.ranksys.core.index.ItemIndex<I>

public class IndexFeatureData<I>
extends java.lang.Object
implements es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
Class for loading feature data from an index.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.util.Map<java.lang.String,​java.util.Map<I,​java.lang.Double>> featMap
    Feature to item map.
    private java.util.Map<I,​java.util.Map<java.lang.String,​java.lang.Double>> itemMap
    Item to feature map.
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected IndexFeatureData​(java.util.Map<I,​java.util.Map<java.lang.String,​java.lang.Double>> itemMap, java.util.Map<java.lang.String,​java.util.Map<I,​java.lang.Double>> featMap)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    boolean containsFeature​(java.lang.String f)  
    boolean containsItem​(I i)  
    java.util.stream.Stream<java.lang.String> getAllFeatures()  
    java.util.stream.Stream<I> getAllItems()  
    java.util.stream.Stream<org.jooq.lambda.tuple.Tuple2<I,​java.lang.Double>> getFeatureItems​(java.lang.String f)  
    java.util.stream.Stream<java.lang.String> getFeaturesWithItems()  
    java.util.stream.Stream<org.jooq.lambda.tuple.Tuple2<java.lang.String,​java.lang.Double>> getItemFeatures​(I i)  
    java.util.stream.Stream<I> getItemsWithFeatures()  
    static <I> IndexFeatureData<I> load​(ForwardIndex<I> fIndex)
    Loads the feature data from a forward index.
    int numFeatures()  
    int numFeatures​(I i)  
    int numFeaturesWithItems()  
    int numItems()  
    int numItems​(java.lang.String f)  
    int numItemsWithFeatures()  

    Methods inherited from class java.lang.Object

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

    • itemMap

      private final java.util.Map<I,​java.util.Map<java.lang.String,​java.lang.Double>> itemMap
      Item to feature map.
    • featMap

      private final java.util.Map<java.lang.String,​java.util.Map<I,​java.lang.Double>> featMap
      Feature to item map.
  • Constructor Details

    • IndexFeatureData

      protected IndexFeatureData​(java.util.Map<I,​java.util.Map<java.lang.String,​java.lang.Double>> itemMap, java.util.Map<java.lang.String,​java.util.Map<I,​java.lang.Double>> featMap)
      Constructor.
      Parameters:
      itemMap - item to features map.
      featMap - features to items map.
  • Method Details

    • numItemsWithFeatures

      public int numItemsWithFeatures()
      Specified by:
      numItemsWithFeatures in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • numFeaturesWithItems

      public int numFeaturesWithItems()
      Specified by:
      numFeaturesWithItems in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • getItemsWithFeatures

      public java.util.stream.Stream<I> getItemsWithFeatures()
      Specified by:
      getItemsWithFeatures in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • getFeaturesWithItems

      public java.util.stream.Stream<java.lang.String> getFeaturesWithItems()
      Specified by:
      getFeaturesWithItems in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • getFeatureItems

      public java.util.stream.Stream<org.jooq.lambda.tuple.Tuple2<I,​java.lang.Double>> getFeatureItems​(java.lang.String f)
      Specified by:
      getFeatureItems in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • getItemFeatures

      public java.util.stream.Stream<org.jooq.lambda.tuple.Tuple2<java.lang.String,​java.lang.Double>> getItemFeatures​(I i)
      Specified by:
      getItemFeatures in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • numFeatures

      public int numFeatures​(I i)
      Specified by:
      numFeatures in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • numItems

      public int numItems​(java.lang.String f)
      Specified by:
      numItems in interface es.uam.eps.ir.ranksys.core.feature.FeatureData<I,​java.lang.String,​java.lang.Double>
    • containsFeature

      public boolean containsFeature​(java.lang.String f)
      Specified by:
      containsFeature in interface es.uam.eps.ir.ranksys.core.index.FeatureIndex<I>
    • numFeatures

      public int numFeatures()
      Specified by:
      numFeatures in interface es.uam.eps.ir.ranksys.core.index.FeatureIndex<I>
    • getAllFeatures

      public java.util.stream.Stream<java.lang.String> getAllFeatures()
      Specified by:
      getAllFeatures in interface es.uam.eps.ir.ranksys.core.index.FeatureIndex<I>
    • containsItem

      public boolean containsItem​(I i)
      Specified by:
      containsItem in interface es.uam.eps.ir.ranksys.core.index.ItemIndex<I>
    • numItems

      public int numItems()
      Specified by:
      numItems in interface es.uam.eps.ir.ranksys.core.index.ItemIndex<I>
    • getAllItems

      public java.util.stream.Stream<I> getAllItems()
      Specified by:
      getAllItems in interface es.uam.eps.ir.ranksys.core.index.ItemIndex<I>
    • load

      public static <I> IndexFeatureData<I> load​(ForwardIndex<I> fIndex)
      Loads the feature data from a forward index.
      Type Parameters:
      I - type of the items.
      Parameters:
      fIndex - the forward index.
      Returns:
      the feature data object.