tecton.interactive.FeatureView¶
-
class
tecton.interactive.
FeatureView
(proto)¶ FeatureView class.
To get a FeatureView instance, call
tecton.get_feature_view()
.Methods
Returns a Tecton
DataFrame
that contains the output Feature Transformation of the Feature View.Returns a single Tecton
FeatureVector
from the Online Store.Returns all the feature values that are defined by this Feature View in the specified time range.
Returns a Tecton
DataFrame
of historical values for this feature view.Returns a single Tecton
FeatureVector
from the Online Store.Displays materialization information for the FeatureView, which may include past jobs, scheduled jobs, and job failures.
Shows a preview of the FeatureView’s features.
Runs the feature view against passed-in mock data rather than the actual data sources.
Returns various information about this feature definition, including the most critical metadata such as the name, owner, features, etc.
-
get_feature_dataframe
(spine=None, spine_time_key=None, use_materialized_data=True, save=None, save_as=None)¶ Returns a Tecton
DataFrame
that contains the output Feature Transformation of the Feature View.- Parameters
spine (
Union
[DataFrame
,DataFrame
,None
]) – (Optional) The spine to join against, as a dataframe. If present, the returned data frame will contain rollups for all (join key, temporal key) combinations that are required to compute a full frame from the spine. If spine is not specified, it’ll return a dataframe with sample feature vectors.spine_time_key (
Optional
[str
]) – (Optional) Name of the time column in spine. If unspecified, will default to the time column of the spine if there is only one present.use_materialized_data (
bool
) – (Optional) Use materialized data if materialization is enabledsave (
Optional
[bool
]) – (Optional) set to True to persist DataFrame as a Dataset objectsave_as (
Optional
[str
]) – (Optional) name to save the DataFrame as. Not applicable when save=False. If unspecified and save=True, a name will be generated.
- Returns
A Tecton
DataFrame
.
-
get_feature_vector
(join_keys=None, include_join_keys_in_response=False, request_context_map=None)¶ Returns a single Tecton
FeatureVector
from the Online Store. At least one of join_keys or request_context_map is required.- Parameters
join_keys (
Optional
[Mapping
[str
,Union
[int
,int64
,str
,bytes
]]]) – Join keys of the enclosed FeatureViews.include_join_keys_in_response (
bool
) – Whether to include join keys as part of the response FeatureVector.request_context_map (
Optional
[Mapping
[str
,Union
[int
,int64
,str
,bytes
,float
]]]) – Dictionary of request context values.
- Returns
A
FeatureVector
of the results.
-
get_features
(entities=None, start_time=None, end_time=None, from_source=False)¶ Returns all the feature values that are defined by this Feature View in the specified time range.
- Parameters
entities (
Union
[DataFrame
,DataFrame
,None
]) – (Optional) Filter feature data to a set of entity IDs. If specified, this DataFrame should only contain join key columns.start_time (
Union
[DateTime
,datetime
,None
]) – (Optional) The interval start time from when we want to retrieve features.end_time (
Union
[DateTime
,datetime
,None
]) – (Optional) The interval end time until when we want to retrieve features.from_source (
bool
) – Whether feature values should be recomputed from the original data source. If False, we will attempt to read the values from the materialized store.
- Returns
A Tecton DataFrame with features values.
-
get_historical_features
(spine=None, timestamp_key=None, start_time=None, end_time=None, entities=None, from_source=False, save=False, save_as=None)¶ Returns a Tecton
DataFrame
of historical values for this feature view. If no arguments are passed in, all feature values for this feature view will be returned in a Tecton DataFrame. Note: Thetimestamp_key
parameter is only applicable when a spine is passed in. Parametersstart_time`, ``end_time
, andentities
are only applicable when a spine is not passed in.- Parameters
spine (
Union
[DataFrame
,DataFrame
,DataFrame
,None
]) –- (Optional) The spine to join against, as a dataframe.
If present, the returned DataFrame will contain rollups for all (join key, temporal key) combinations that are required to compute a full frame from the spine.
- To distinguish between spine columns and feature columns, feature columns are labeled as
feature_view_name.feature_name
in the returned DataFrame. If spine is not specified, it’ll return a DataFrame of feature values in the specified time range.
timestamp_key (
Optional
[str
]) – (Optional) Name of the time column in spine. If unspecified, will default to the time column of the spine if there is only one present.start_time (
Union
[DateTime
,datetime
,None
]) – (Optional) The interval start time from when we want to retrieve features. If no timezone is specified, will default to using UTC.end_time (
Union
[DateTime
,datetime
,None
]) – (Optional) The interval end time until when we want to retrieve features. If no timezone is specified, will default to using UTC.entities (
Union
[DataFrame
,DataFrame
,DataFrame
,None
]) – (Optional) Filter feature data returned to a set of entity IDs. If specified, this DataFrame should only contain join key columns.from_source (
bool
) – (Optional) Whether feature values should be recomputed from the original data source. If False, we will read the values from the materialized store.save (
bool
) – (Optional) set to True to persist DataFrame as a Dataset object. Default is False.save_as (
Optional
[str
]) – (Optional) name to save the DataFrame as. If unspecified and save=True, a name will be generated.
- Returns
A Tecton
DataFrame
.
-
get_online_features
(join_keys, include_join_keys_in_response=False)¶ Returns a single Tecton
FeatureVector
from the Online Store. At least one of join_keys or request_data is required.- Parameters
- Returns
A
FeatureVector
of the results.
-
materialization_status
(verbose=False, limit=1000, sort_columns=None, errors_only=False)¶ Displays materialization information for the FeatureView, which may include past jobs, scheduled jobs, and job failures.
This method returns different information depending on the type of FeatureView. It is not currently supported by
OnDemandFeatureView
, as it does not involve materialization.- Parameters
verbose – If set to true, method will display additional low level materialization information, useful for debugging.
sort_columns – A comma-separated list of column names by which to sort the rows
-
preview
(limit=10, time_range=None, use_materialized_data=True)¶ Shows a preview of the FeatureView’s features. Random, unique join_keys are chosen to showcase the features.
- Parameters
- Returns
A Tecton
DataFrame
.
-
run
(**mock_inputs)¶ Runs the feature view against passed-in mock data rather than the actual data sources.
-
summary
()¶ Returns various information about this feature definition, including the most critical metadata such as the name, owner, features, etc.
Attributes
batch_materialization_schedule
This represents how often we schedule batch materialization jobs.
created_at
Returns the creation date of this Tecton Primitive.
defined_in
Returns filename where this Tecton Primitive has been declared.
description
The description of this Tecton Primitive, set by user.
entity_names
Returns a list of entity names.
family
The family of this Tecton Primitive, used to group Primitives.
feature_start_time
This represents the time at which features are first available.
features
Returns the names of the (output) features.
id
Returns the id of this object
is_online
Returns whether or not this FeatureView is of type OnDemandFeatureView.
is_temporal
Returns whether or not this FeatureView is of type TemporalFeatureView.
is_temporal_aggregate
Returns whether or not this FeatureView is of type TemporalAggregateFeatureView.
join_keys
Returns the join key column names
name
The name of this Tecton Primitive.
online_serving_index
Returns Defines the set of join keys that will be indexed and queryable during online serving.
owner
The owner of this Tecton Primitive (typically the email of the primary maintainer.)
schedule_offset
If this attribute is non-empty, Tecton will schedule materialization jobs at an offset equal to this.
tags
Tags associated with this Tecton Primitive (key-value pairs of arbitrary metadata set by user.)
timestamp_key
Returns the timestamp_key column name of this FeatureView.
type
Returns the FeatureView type.
url
Returns a link to the Tecton Web UI.
wildcard_join_key
Returns a wildcard join key column name if it exists; Otherwise returns None.
workspace
Returns the workspace this Tecton Primitive was created in.
-