Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[budi] update python sdk quickstart #196

Merged
merged 2 commits into from
May 17, 2019
Merged
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
80 changes: 45 additions & 35 deletions sdk/python/examples/quickstart/Quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"import feast.specs.FeatureSpec_pb2 as feature_pb\n",
"\n",
"from feast.sdk.importer import Importer\n",
"\n",
"from feast.sdk.client import Client, ServingRequestType"
"from feast.sdk.client import Client"
]
},
{
Expand Down Expand Up @@ -124,19 +123,13 @@
"# Initialise client\n",
"fs = Client(core_url=FEAST_CORE_URL, verbose=True)\n",
"\n",
"serving_ds=Datastore(id='REDIS1')\n",
"warehouse_ds=Datastore(id='NOOP')\n",
"\n",
"# Create importer\n",
"importer = Importer.from_df(df_complete, \n",
" entity='ride', \n",
" granularity=Granularity.NONE,\n",
" owner='user@website.com', \n",
" staging_location=STAGING_LOCATION,\n",
" id_column='ride', \n",
" timestamp_column='pickup_datetime',\n",
" serving_store=serving_ds,\n",
" warehouse_store=warehouse_ds)\n",
" timestamp_column='pickup_datetime')\n",
"\n",
"# Update feature and entity metadata. Ideally you want to update these manually\n",
"# so that they contain adequate information for the next user\n",
Expand Down Expand Up @@ -168,18 +161,18 @@
"# Retrieving data: Training\n",
"\n",
"feature_set = FeatureSet(entity=\"ride\", \n",
" features=[\"ride.none.log_trip_duration\", \n",
" \"ride.none.distance_haversine\",\n",
" \"ride.none.distance_dummy_manhattan\",\n",
" \"ride.none.direction\",\n",
" \"ride.none.month\",\n",
" \"ride.none.day_of_month\",\n",
" \"ride.none.hour\",\n",
" \"ride.none.day_of_week\",\n",
" \"ride.none.vi_1\",\n",
" \"ride.none.vi_2\",\n",
" \"ride.none.sf_n\",\n",
" \"ride.none.sf_y\"])\n",
" features=[\"ride.log_trip_duration\", \n",
" \"ride.distance_haversine\",\n",
" \"ride.distance_dummy_manhattan\",\n",
" \"ride.direction\",\n",
" \"ride.month\",\n",
" \"ride.day_of_month\",\n",
" \"ride.hour\",\n",
" \"ride.day_of_week\",\n",
" \"ride.vi_1\",\n",
" \"ride.vi_2\",\n",
" \"ride.sf_n\",\n",
" \"ride.sf_y\"])\n",
"dataset_info = fs.create_dataset(feature_set, \"2016-06-01\", \"2016-08-01\")\n",
"dataset = fs.download_dataset_to_df(dataset_info, staging_location=STAGING_LOCATION)\n",
"\n",
Expand Down Expand Up @@ -210,25 +203,33 @@
"fs = Client(serving_url=FEAST_SERVING_URL, verbose=True)\n",
"\n",
"feature_set = FeatureSet(entity=\"ride\", \n",
" features=[\"ride.none.log_trip_duration\", \n",
" \"ride.none.distance_haversine\",\n",
" \"ride.none.distance_dummy_manhattan\",\n",
" \"ride.none.direction\",\n",
" \"ride.none.month\",\n",
" \"ride.none.day_of_month\",\n",
" \"ride.none.hour\",\n",
" \"ride.none.day_of_week\",\n",
" \"ride.none.vi_1\",\n",
" \"ride.none.vi_2\",\n",
" \"ride.none.sf_n\",\n",
" \"ride.none.sf_y\"])\n",
" features=[\"ride.log_trip_duration\", \n",
" \"ride.distance_haversine\",\n",
" \"ride.distance_dummy_manhattan\",\n",
" \"ride.direction\",\n",
" \"ride.month\",\n",
" \"ride.day_of_month\",\n",
" \"ride.hour\",\n",
" \"ride.day_of_week\",\n",
" \"ride.vi_1\",\n",
" \"ride.vi_2\",\n",
" \"ride.sf_n\",\n",
" \"ride.sf_y\"])\n",
"\n",
"# retrieve features\n",
"feats = fs.get_serving_data(feature_set, entity_keys=[\"id2875421\",\"id1244481\"])\n",
"feats.head()\n",
"\n",
"# Feed data into model\n",
"# ..."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -247,9 +248,18 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.6.7"
},
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"source": [],
"metadata": {
"collapsed": false
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}