Skip to content

Commit

Permalink
Merge pull request #1 from RHEcosystemAppEng/action-test
Browse files Browse the repository at this point in the history
testing PR actions
  • Loading branch information
jeremyary authored Dec 14, 2023
2 parents d102c0c + ec02f1b commit 7189833
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 2 deletions.
2 changes: 1 addition & 1 deletion feature_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
)

feature_service_2 = FeatureService(
name="model_v2", features=[driver_hourly_stats_view], owner="jary@redhat.com",
name="model_v2", features=[driver_hourly_stats_view, driver_daily_miles_view], owner="jary@redhat.com",
)
22 changes: 21 additions & 1 deletion features.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from datetime import timedelta

import pandas as pd
from feast import (
FeatureView,
Field,
)
from feast.types import Float32
from feast.types import (
Float32,
Float64,
UnixTimestamp
)

from data_sources import *
from entities import *
Expand All @@ -23,3 +28,18 @@
tags={"production": "True"},
owner="test2@gmail.com",
)

driver_daily_miles_view = FeatureView(
name="driver_daily_miles",
description="Daily miles",
entities=[driver],
ttl=timedelta(seconds=8640000000),
schema=[
Field(name="day", dtype=UnixTimestamp),
Field(name="miles_driven", dtype=Float64),
],
online=True,
source=driver_stats,
tags={"production": "True"},
owner="jary@redhat.com",
)
Binary file added initial_data_preview.parquet
Binary file not shown.
103 changes: 103 additions & 0 deletions workshop-notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2023-12-14T18:18:46.808286660Z",
"start_time": "2023-12-14T18:18:46.762462944Z"
}
},
"outputs": [
{
"data": {
"text/plain": " event_timestamp driver_id conv_rate acc_rate \\\n0 2022-02-27 15:00:00+00:00 1005 0.142214 0.408987 \n1 2022-02-27 16:00:00+00:00 1005 0.349267 0.734021 \n2 2022-02-27 17:00:00+00:00 1005 0.358805 0.366804 \n3 2022-02-27 18:00:00+00:00 1005 0.611828 0.773883 \n4 2022-02-27 19:00:00+00:00 1005 0.156503 0.966413 \n\n created day miles_driven daily_miles_driven \n0 2022-03-14 15:21:25.842 2022-02-27 24.817618 150.587752 \n1 2022-03-14 15:21:25.842 2022-02-27 8.293352 150.587752 \n2 2022-03-14 15:21:25.842 2022-02-27 8.316672 150.587752 \n3 2022-03-14 15:21:25.842 2022-02-27 10.566458 150.587752 \n4 2022-03-14 15:21:25.842 2022-02-27 15.664332 150.587752 ",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>event_timestamp</th>\n <th>driver_id</th>\n <th>conv_rate</th>\n <th>acc_rate</th>\n <th>created</th>\n <th>day</th>\n <th>miles_driven</th>\n <th>daily_miles_driven</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2022-02-27 15:00:00+00:00</td>\n <td>1005</td>\n <td>0.142214</td>\n <td>0.408987</td>\n <td>2022-03-14 15:21:25.842</td>\n <td>2022-02-27</td>\n <td>24.817618</td>\n <td>150.587752</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2022-02-27 16:00:00+00:00</td>\n <td>1005</td>\n <td>0.349267</td>\n <td>0.734021</td>\n <td>2022-03-14 15:21:25.842</td>\n <td>2022-02-27</td>\n <td>8.293352</td>\n <td>150.587752</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2022-02-27 17:00:00+00:00</td>\n <td>1005</td>\n <td>0.358805</td>\n <td>0.366804</td>\n <td>2022-03-14 15:21:25.842</td>\n <td>2022-02-27</td>\n <td>8.316672</td>\n <td>150.587752</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2022-02-27 18:00:00+00:00</td>\n <td>1005</td>\n <td>0.611828</td>\n <td>0.773883</td>\n <td>2022-03-14 15:21:25.842</td>\n <td>2022-02-27</td>\n <td>10.566458</td>\n <td>150.587752</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2022-02-27 19:00:00+00:00</td>\n <td>1005</td>\n <td>0.156503</td>\n <td>0.966413</td>\n <td>2022-03-14 15:21:25.842</td>\n <td>2022-02-27</td>\n <td>15.664332</td>\n <td>150.587752</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"df = pd.read_parquet('initial_data_preview.parquet')\n",
"\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"Int64Index: 1807 entries, 0 to 1806\n",
"Data columns (total 8 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 event_timestamp 1807 non-null datetime64[ns, UTC]\n",
" 1 driver_id 1807 non-null int64 \n",
" 2 conv_rate 1807 non-null float32 \n",
" 3 acc_rate 1807 non-null float32 \n",
" 4 created 1807 non-null datetime64[ns] \n",
" 5 day 1807 non-null object \n",
" 6 miles_driven 1807 non-null float64 \n",
" 7 daily_miles_driven 1807 non-null float64 \n",
"dtypes: datetime64[ns, UTC](1), datetime64[ns](1), float32(2), float64(2), int64(1), object(1)\n",
"memory usage: 112.9+ KB\n"
]
}
],
"source": [
"df.info()"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-14T18:18:46.808952912Z",
"start_time": "2023-12-14T18:18:46.808516534Z"
}
}
},
{
"cell_type": "code",
"execution_count": 6,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-14T18:18:46.809050800Z",
"start_time": "2023-12-14T18:18:46.808761856Z"
}
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

0 comments on commit 7189833

Please sign in to comment.