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
167 changes: 27 additions & 140 deletions api_examples/feature_monitoring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "78326a44",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Connected. Call `.close()` to terminate connection gracefully.\n",
"\n",
"Logged in to project, explore it here https://hopsworks0.logicalclocks.com/p/120\n",
"Connected. Call `.close()` to terminate connection gracefully.\n"
]
}
],
"outputs": [],
"source": [
"import hopsworks\n",
"import numpy as np\n",
Expand All @@ -82,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "42e1c8b0",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -120,42 +109,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "a1ad04fa",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Feature Group created successfully, explore it at \n",
"https://hopsworks0.logicalclocks.com/p/120/fs/68/fg/14\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "719e5cea6dca47bdbfd8e87f5b145c45",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Uploading Dataframe: 0.00% | | Rows 0/106020 | Elapsed Time: 00:00 | Remaining Time: ?"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Launching job: trans_fg_1_offline_fg_materialization\n",
"Job started successfully, you can follow the progress at \n",
"https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fg_1_offline_fg_materialization/executions\n"
]
}
],
"outputs": [],
"source": [
"# Feature Group\n",
"trans_fg = fs.get_or_create_feature_group(\n",
Expand All @@ -174,32 +131,15 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "176ad761",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Feature view created successfully, explore it at \n",
"https://hopsworks0.logicalclocks.com/p/120/fs/68/fv/trans_fv/version/1\n",
"Training dataset job started successfully, you can follow the progress at \n",
"https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fv_1_create_fv_td_16022024133852/executions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"VersionWarning: Incremented version to `1`.\n"
]
}
],
"outputs": [],
"source": [
"query = trans_fg.select([\"fraud_label\", \"amount\", \"cc_num\"])\n",
"\n",
"min_max_scaler = fs.get_transformation_function(name=\"min_max_scaler\")\n",
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import min_max_scaler\n",
"\n",
"transformation_functions = [\n",
" min_max_scaler(\"amount\") \n",
Expand All @@ -224,26 +164,10 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "29ae9922",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Training dataset job started successfully, you can follow the progress at \n",
"https://hopsworks0.logicalclocks.com/p/120/jobs/named/trans_fv_1_create_fv_td_16022024134233/executions\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"VersionWarning: Incremented version to `2`.\n"
]
}
],
"outputs": [],
"source": [
"_, _ = trans_fv.create_train_validation_test_split(\n",
" description = 'test extra filters',\n",
Expand Down Expand Up @@ -275,7 +199,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "b82685fb",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -303,7 +227,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"id": "703da6cc",
"metadata": {},
"outputs": [],
Expand All @@ -325,7 +249,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "28a891bf",
"metadata": {},
"outputs": [],
Expand All @@ -347,7 +271,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "fa5651be",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -382,7 +306,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "dce248fb",
"metadata": {},
"outputs": [],
Expand All @@ -408,21 +332,10 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "7fcc0236",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"FeatureMonitoringConfig('fg_amount_monitoring_reference_value', STATISTICS_COMPARISON)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"fg_amount_monitoring_reference_value.with_reference_value(\n",
" value=100,\n",
Expand All @@ -444,7 +357,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "b5ecd419",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -477,7 +390,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "2acd07e4",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -530,7 +443,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"id": "07c863f2",
"metadata": {},
"outputs": [],
Expand All @@ -554,25 +467,10 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"id": "58483800",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[FeatureMonitoringConfig('fg_full_monitoring_sliding', STATISTICS_COMPUTATION),\n",
" FeatureMonitoringConfig('fg_full_monitoring', STATISTICS_COMPUTATION),\n",
" FeatureMonitoringConfig('fg_amount_monitoring_reference_value', STATISTICS_COMPARISON),\n",
" FeatureMonitoringConfig('fg_amount_monitoring_reference_sliding', STATISTICS_COMPARISON),\n",
" FeatureMonitoringConfig('fg_amount_feature_monitoring', STATISTICS_COMPUTATION)]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"trans_fg.get_feature_monitoring_configs()"
]
Expand All @@ -587,21 +485,10 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"id": "3372c2d8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"FeatureMonitoringConfig('fg_full_monitoring', STATISTICS_COMPUTATION)"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"trans_fg.get_feature_monitoring_configs(name=\"fg_full_monitoring\")"
]
Expand All @@ -624,7 +511,7 @@
"hash": "e1ddeae6eefc765c17da80d38ea59b893ab18c0c0904077a035ef84cfe367f83"
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -638,7 +525,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions batch-ai-systems/churn/2_churn_training_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@
"metadata": {},
"outputs": [],
"source": [
"# Load transformation functions from the feature store\n",
"min_max_scaler = fs.get_transformation_function(name=\"min_max_scaler\")\n",
"label_encoder = fs.get_transformation_function(name=\"label_encoder\")\n",
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import label_encoder, min_max_scaler\n",
"\n",
"\n",
"# Define lists of numerical and categorical features\n",
"numerical_features = [\"tenure\", \"monthlycharges\", \"totalcharges\"]\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@
"# Extracting the names of categorical columns in the 'selected_features_show5query_show5' DataFrame\n",
"cat_cols = selected_features_show5.dtypes[selected_features_show5.dtypes == 'object'].index\n",
"\n",
"# Retrieving the Label Encoder transformation function from Featuretools\n",
"label_encoder = fs.get_transformation_function(name='label_encoder') \n",
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import label_encoder\n",
"\n",
"# Creating a dictionary of transformation functions, where each categorical column is associated with the Label Encoder\n",
"transformation_functions = [\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Load transformation functions.\n",
"label_encoder = fs.get_transformation_function(name=\"label_encoder\")\n",
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import label_encoder\n",
"\n",
"# Map features to transformations.\n",
"transformation_functions = [\n",
Expand Down
5 changes: 2 additions & 3 deletions batch-ai-systems/hospital_wait_time/2_training_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@
"metadata": {},
"outputs": [],
"source": [
"label_encoder = fs.get_transformation_function(name=\"label_encoder\")\n",
"\n",
"standard_scaler = fs.get_transformation_function(name=\"standard_scaler\")"
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import label_encoder, standard_scaler"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def transform_custom(*args, **kwargs):
query = trans_fg.select(["fraud_label", "category", "amount", "age_at_transaction", "days_until_card_expires", "loc_delta"])\
.join(window_aggs_fg.select_except(["cc_num"]))

# Load transformation functions.
label_encoder = fs.get_transformation_function(name="label_encoder")
# Import transformation functions from Hopsworks.
from hopsworks.hsfs.builtin_transformations import label_encoder

# Map features to transformations.
transformation_functions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def create_feature_view(data, *args, **kwargs):
query = trans_fg.select(["fraud_label", "category", "amount", "age_at_transaction", "days_until_card_expires", "loc_delta"])\
.join(window_aggs_fg.select_except(["cc_num"]))

# Load transformation functions.
label_encoder = fs.get_transformation_function(name="label_encoder")
# Import transformation functions from Hopsworks.
from hopsworks.hsfs.builtin_transformations import label_encoder

# Map features to transformations.
transformation_functions = [
Expand Down
4 changes: 2 additions & 2 deletions integrations/neo4j/2_training_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Load built in transformation functions.\n",
"min_max_scaler = fs.get_transformation_function(name=\"min_max_scaler\")\n",
"# Import transformation functions from Hopsworks.\n",
"from hopsworks.hsfs.builtin_transformations import min_max_scaler\n",
"\n",
"# Map features to transformations.\n",
"transformation_functions = [\n",
Expand Down
Loading