LogoLogo
👋 Get in touch⭐️ GitHub
  • Welcome
  • Getting Started
    • Why Superlinked?
    • Setup Superlinked
    • Basic Building Blocks
  • Run in Production
    • Overview
    • Setup Superlinked Server
      • Configuring your app
      • Interacting with app via API
    • Supported Vector Databases
      • Redis
      • Mongo DB
      • Qdrant
  • Concepts
    • Overview
    • Combining Multiple Embeddings for Better Retrieval Outcomes
    • Dynamic Parameters/Query Time weights
  • Reference
    • Overview
    • Changelog
    • Components
      • Dag
        • Period Time
      • Parser
        • Json Parser
        • Dataframe Parser
        • Data Parser
      • Schema
        • Id Schema Object
        • Schema Object
        • Schema
        • Event Schema Object
        • Event Schema
      • App
        • App
        • Interactive
          • Interactive App
        • Online
          • Online App
        • Rest
          • Rest App
        • In Memory
          • In Memory App
      • Space
        • Custom Space
        • Exception
        • Has Space Field Set
        • Number Space
        • Image Space Field Set
        • Text Similarity Space
        • Input Aggregation Mode
        • Image Space
        • Recency Space
        • Space Field Set
        • Categorical Similarity Space
        • Space
      • Executor
        • Exception
        • Executor
        • Interactive
          • Interactive Executor
        • Rest
          • Rest Descriptor
          • Rest Handler
          • Rest Executor
          • Rest Configuration
        • In Memory
          • In Memory Executor
        • Query
          • Query Executor
      • Registry
        • Superlinked Registry
        • Exception
      • Storage
        • Mongo Db Vector Database
        • Vector Database
        • Redis Vector Database
        • In Memory Vector Database
        • Qdrant Vector Database
      • Index
        • Effect
        • Index
        • Util
          • Aggregation Node Util
          • Event Aggregation Node Util
          • Event Aggregation Effect Group
          • Effect With Referenced Schema Object
          • Aggregation Effect Group
      • Source
        • Data Loader Source
        • Interactive Source
        • Types
        • In Memory Source
        • Source
        • Rest Source
      • Query
        • Param
        • Typed Param
        • Query
        • Query Weighting
        • Query Descriptor
        • Nlq Param Evaluator
        • Space Weight Param Info
        • Query Param Information
        • Query Filters
        • Nlq Pydantic Model Builder
        • Clause Params
        • Param Evaluator
        • Query Mixin
        • Query Param Value Setter
        • Query Filter Validator
        • Natural Language Query Param Handler
        • Query Filter Information
        • Query Vector Factory
        • Query Clause
        • Result
        • Query Result Converter
          • Default Query Result Converter
          • Query Result Converter
          • Serializable Query Result Converter
        • Predicate
          • Binary Op
          • Query Predicate
          • Binary Predicate
        • Query Clause
          • Similar Filter Clause
          • Overriden Now Clause
          • Looks Like Filter Clause
          • Space Weight Map
          • Nlq System Prompt Clause
          • Nlq Clause
          • Radius Clause
          • Weight By Space Clause
          • Base Looks Like Filter Clause
          • Limit Clause
          • Select Clause
          • Looks Like Filter Clause Weights By Space
          • Single Value Param Query Clause
          • Hard Filter Clause
          • Query Clause
        • Nlq
          • Nlq Compatible Clause Handler
          • Exception
          • Nlq Clause Collector
          • Nlq Handler
          • Suggestion
            • Query Suggestion Model
            • Query Suggestions Prompt Builder
          • Param Filler
            • Query Param Model Validator
            • Query Param Model Validator Info
            • Query Param Model Builder
            • Query Param Prompt Builder
            • Nlq Annotation
            • Templates
  • Recipes
    • Overview
    • Multi-Modal Semantic Search
      • Hotel Search
    • Recommendation System
      • E-Commerce RecSys
  • Tutorials
    • Overview
    • Semantic Search - News
    • Semantic Search - Movies
    • Semantic Search - Product Images & Descriptions
    • RecSys - Ecommerce
    • RAG - HR
    • Analytics - User Acquisition
    • Analytics - Keyword Expansion
  • Help & FAQ
    • Logging
    • Support
    • Discussion
  • Policies
    • Terms of Use
    • Privacy Policy
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Reference
  2. Components
  3. Space

Recency Space

Classes

RecencySpace(timestamp: superlinked.framework.common.schema.schema_object.Timestamp | None | collections.abc.Sequence[superlinked.framework.common.schema.schema_object.Timestamp | None], time_period_hour_offset: datetime.timedelta = datetime.timedelta(0), period_time_list: list[superlinked.framework.common.dag.period_time.PeriodTime] | superlinked.framework.common.dag.period_time.PeriodTime | None = None, aggregation_mode: superlinked.framework.dsl.space.input_aggregation_mode.InputAggregationMode = InputAggregationMode.INPUT_AVERAGE, negative_filter: float = 0.0) : Recency space encodes timestamp type data measured in seconds and in unix timestamp format. Recency space is utilized to encode how recent items are. Use period_time_list to mark the time periods of interest. Items older than the largest period_time are going to have uniform recency score. (0 or negative_filter if set) You can use multiple period_times to give additional emphasis to sub time periods. Like using 2 days and 5 days gives extra emphasis to the first 2 days. The extent of which can be controlled with the respective weight parameters. Unit weights would give double emphasis on the first 2 days, 1 and 0.1 weights respectively would give tenfold importance to the first 2 days. All items older than 5 days would get 0 or negative_filter recency score. Negative_filter is useful for effectively filtering out entities that are older than the oldest period time. You can think of the value of negative_filter as it offsets that amount of similarity stemming from other spaces in the index. For example setting it -1 would offset any text similarity that has weight 1 - effectively filtering out all old items however similar they are in terms of their text.

Attributes:
    timestamp (SpaceFieldSet): A set of Timestamp objects. The actual data is expected to be unix timestamps
        in seconds.
        It is a SchemaFieldObject not regular python ints or floats.
    time_period_hour_offset (timedelta): Starting period time will be set to this hour.
        Day will be the next day of context.now(). Defaults to timedelta(hours=0).
    period_time_list (list[PeriodTime] | None): A list of period time parameters.
        Weights default to 1. Period time to 14 days.
    aggregation_mode (InputAggregationMode): The  aggregation mode of the number embedding.
        Possible values are: maximum, minimum and average. Defaults to InputAggregationMode.INPUT_AVERAGE.
    negative_filter (float): The recency score of items that are older than the oldest period time. Defaults to 0.0.

Initialize the RecencySpace.

Args:
    timestamp (SpaceFieldSet): A set of Timestamp objects. The actual data is expected to be unix timestamps
        in seconds.
        It is a SchemaFieldObject not regular python ints or floats.
    time_period_hour_offset (timedelta): Starting period time will be set to this hour.
        Day will be the next day of context.now(). Defaults to timedelta(hours=0).
    period_time_list (list[PeriodTime] | None): A list of period time parameters.
        Weights default to 1. Period time to 14 days.
    aggregation_mode (InputAggregationMode): The  aggregation mode of the recency embedding.
        Possible values are: maximum, minimum and average. Defaults to InputAggregationMode.INPUT_AVERAGE.
    negative_filter (float): The recency score of items that are older than the oldest period time.
        Defaults to 0.0.

### Ancestors (in MRO)

* superlinked.framework.dsl.space.space.Space
* superlinked.framework.common.space.interface.has_transformation_config.HasTransformationConfig
* superlinked.framework.common.interface.has_length.HasLength
* typing.Generic
* superlinked.framework.dsl.space.has_space_field_set.HasSpaceFieldSet
* abc.ABC

### Instance variables

`allow_similar_clause: bool`
:

`space_field_set: superlinked.framework.dsl.space.space_field_set.SpaceFieldSet`
:

`transformation_config: superlinked.framework.common.space.config.transformation_config.TransformationConfig[int, int]`
:
PreviousImage SpaceNextSpace Field Set

Last updated 2 months ago

Was this helpful?