Skip to content

Commit afaf9d0

Browse files
authored
Merge pull request #9 from mwojtyczka/update
refactor
2 parents 4759c03 + 7e218e6 commit afaf9d0

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

mlops_demo/deployment/batch_inference/PrepareBatchInferenceInput.py renamed to mlops_demo/deployment/batch_inference/notebooks/PrepareBatchInferenceInput.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
import pyspark.sql.functions as F
77
from datetime import timedelta, timezone
88
import math
9-
import mlflow.pyfunc
10-
import pyspark.sql.functions as F
119
from pyspark.sql.types import IntegerType
1210

11+
1312
def rounded_unix_timestamp(dt, num_minutes=15):
1413
"""
1514
Ceilings datetime dt to interval num_minutes, then returns the unix timestamp.
@@ -18,27 +17,21 @@ def rounded_unix_timestamp(dt, num_minutes=15):
1817
delta = math.ceil(nsecs / (60 * num_minutes)) * (60 * num_minutes) - nsecs
1918
return int((dt + timedelta(seconds=delta)).replace(tzinfo=timezone.utc).timestamp())
2019

20+
2121
rounded_unix_timestamp_udf = F.udf(rounded_unix_timestamp, IntegerType())
2222

23+
2324
def rounded_taxi_data(taxi_data_df):
2425
# Round the taxi data timestamp to 15 and 30 minute intervals so we can join with the pickup and dropoff features
2526
# respectively.
2627
taxi_data_df = (
2728
taxi_data_df.withColumn(
2829
"rounded_pickup_datetime",
29-
F.to_timestamp(
30-
rounded_unix_timestamp_udf(
31-
taxi_data_df["tpep_pickup_datetime"], F.lit(15)
32-
)
33-
),
30+
F.to_timestamp(rounded_unix_timestamp_udf(taxi_data_df["tpep_pickup_datetime"], F.lit(15))),
3431
)
3532
.withColumn(
3633
"rounded_dropoff_datetime",
37-
F.to_timestamp(
38-
rounded_unix_timestamp_udf(
39-
taxi_data_df["tpep_dropoff_datetime"], F.lit(30)
40-
)
41-
),
34+
F.to_timestamp(rounded_unix_timestamp_udf(taxi_data_df["tpep_dropoff_datetime"], F.lit(30))),
4235
)
4336
.drop("tpep_pickup_datetime")
4437
.drop("tpep_dropoff_datetime")
@@ -59,4 +52,3 @@ def rounded_taxi_data(taxi_data_df):
5952
# MAGIC select * from qa_mlops_demo.marcin_wojtyczka.feature_store_inference_input
6053

6154
# COMMAND ----------
62-

mlops_demo/validation/notebooks/ModelValidation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,7 @@ def get_fs_model(df):
299299

300300
try:
301301
eval_result = mlflow.evaluate(
302-
303302
model=get_fs_model,
304-
305303
data=data,
306304
targets=targets,
307305
model_type=model_type,

0 commit comments

Comments
 (0)