Skip to content

Commit

Permalink
updated doc for the kwargs and partiton keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yogesh266 committed Aug 4, 2023
1 parent d41e081 commit b30f09a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
7 changes: 7 additions & 0 deletions ads/feature_store/docs/source/feature_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ A ``FeatureGroup`` instance will be created.
:caption: Python

from ads.feature_store.feature_group import FeatureGroup
# Dictionary containing arguments for the feature group for the transformation function.
transformation_kwargs = {}

feature_group_flights = (
FeatureGroup()
.with_feature_store_id(feature_store.id)
.with_primary_keys(["col1"])
.with_partition_keys(["col1", "col2"])
.with_name("flights_feature_group")
.with_entity_id("<entity_id>")
.with_compartment_id("ocid1.compartment..<unique_id>")
.with_schema_details_from_dataframe(dataframe)
.with_transformation_kwargs(transformation_kwargs)
)

.. code-tab:: Python3
Expand All @@ -52,6 +56,9 @@ A ``FeatureGroup`` instance will be created.
primaryKeys:
items:
- name: col1
partitionKeys:
items:
- name: col1
statisticsConfig:
isEnabled: true
type: featureGroup
Expand Down
30 changes: 19 additions & 11 deletions ads/feature_store/docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,24 @@ Background reading to understand the concepts of Feature Store and OCI Data Scie


# step2: Create feature store
def transactions_df(dataframe):
def transactions_df(dataframe, **kwargs):
columns = kwargs.get('columns', '*') # Default to select all columns if 'columns' not provided
where_clause = kwargs.get('where_clause', '') # Default to empty where clause if 'where_clause' not provided
sql_query = f"""
SELECT
col1,
col2
{columns}
FROM
{dataframe}
{table_name}
{where_clause}
"""
return sql_query

transformation = feature_store.create_transformation(
transformation_mode=TransformationMode.SQL,
source_code_func=transactions_df
)

transformation = feature_store.create_transformation(transformation_mode=TransformationMode.SQL,
source_code_func=transactions_df)

# step3: Create expectation
expectation_suite = ExpectationSuite(expectation_suite_name="feature_definition")
Expand All @@ -102,14 +107,17 @@ Background reading to understand the concepts of Feature Store and OCI Data Scie
stats_config = StatisticsConfig().with_is_enabled(False)

# step5: Create feature group
transformation_args = {"columns": "col1, col2", "where_clause": "col3 > 100"}
feature_group = entity.create_feature_group(
["name"],
primary_keys=["name"],
partition_keys=["name"],
input_feature_details,
expectation_suite,
ExpectationType.LENIENT,
stats_config,
expectation_suite=expectation_suite,
expectation_type=ExpectationType.LENIENT,
statistics_config=stats_config,
name="<feature_group_name>",
transformation_id=transformation.id
transformation_id=transformation.id,
transformation_kwargs=transformation_args
)


Expand Down

0 comments on commit b30f09a

Please sign in to comment.