Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/images/product_recommendation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/product_recommendation_advanced.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions feathr_project/feathr/udf/_preprocessing_pyudf_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def build_anchor_preprocessing_metadata(anchor_list, local_workspace_dir):
feature_names_to_func_mapping[string_feature_list] = _PreprocessingPyudfManager._parse_function_str_for_name(anchor.source.preprocessing)
else:
# it's a callable function
feature_names_to_func_mapping[string_feature_list] = anchor.source.preprocessing.__name__
feature_names_to_func_mapping[string_feature_list] = anchor.source.preprocessing.__name__

if not features_with_preprocessing:
return
Expand Down Expand Up @@ -87,9 +87,9 @@ def _parse_function_str_for_name(source: str) -> str:

@staticmethod
def persist_pyspark_udf_to_file(user_func, local_workspace_dir):
"""persist the pyspark UDF to a file in `local_workspace_dir` for later usage.
The user_func could be either a string that represents a function body, or a callable object.
The reason being - if we are defining a regular Python function, it will be a callable object;
"""persist the pyspark UDF to a file in `local_workspace_dir` for later usage.
The user_func could be either a string that represents a function body, or a callable object.
The reason being - if we are defining a regular Python function, it will be a callable object;
however if we reterive features from registry, the current implementation is to use plain strings to store the function body. In that case, the user_fuc will be string.
"""
if isinstance(user_func, str):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
product_id,category,price,quantity,recent_sold,made_in_state,discount
1,1,22,100,0,CA,7.5
2,2,17,300,1,CA,7.5
3,1,40,0,2,WA,7.5
4,1,25,100,3,WA,7.5
5,1,33,0,2,PA,0
6,2,19,0,2,CA,7.5
7,2,22,200,1,WA,7.5
8,2,59,300,0,PA,8.5
9,0,80,100,1,WA,8.5
10,0,39,100,0,WA,7.5
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
user_id,event_timestamp,product_rating
1,2021-04-01,4
2,2021-04-01,5
3,2021-04-01,5
4,2021-04-01,1
5,2021-04-01,5
6,2021-04-01,2
7,2021-04-01,5
8,2021-04-01,2
9,2021-04-01,5
10,2021-04-01,3
user_id,product_id,event_timestamp,product_rating
1,1,2021-04-01,4
1,2,2021-04-01,4
1,3,2021-04-01,4
1,4,2021-04-01,4
1,5,2021-04-01,4
2,1,2021-04-01,5
2,2,2021-04-01,5
2,3,2021-04-01,5
2,4,2021-04-01,5
2,5,2021-04-01,5
3,1,2021-04-01,5
3,2,2021-04-01,5
3,3,2021-04-01,5
3,4,2021-04-01,5
3,5,2021-04-01,5
4,1,2021-04-01,1
4,2,2021-04-01,1
4,3,2021-04-01,1
4,4,2021-04-01,1
4,5,2021-04-01,1
5,1,2021-04-01,5
5,2,2021-04-01,5
6,1,2021-04-01,2
7,1,2021-04-01,5
7,2,2021-04-01,5
7,3,2021-04-01,5
8,1,2021-04-01,2
8,2,2021-04-01,2
8,3,2021-04-01,2
9,1,2021-04-01,5
9,2,2021-04-01,5
9,3,2021-04-01,5
9,4,2021-04-01,5
10,1,2021-04-01,3
Loading