Skip to content

Commit

Permalink
Fix some warnings in the titanic sample (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlieven authored Nov 6, 2023
1 parent 8d6e79e commit ca2c8ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
31 changes: 12 additions & 19 deletions mlops/titanic/notebooks/exploration.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mlops/titanic/notebooks/model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
],
"source": [
"boto3.setup_default_session()\n",
"ssm = boto3.client('ssm')\n",
"ssm = boto3.client('ssm', region_name='eu-west-1')\n",
"parameter = ssm.get_parameter(Name='/conveyor-samples/bucket/name')\n",
"bucket = parameter['Parameter']['Value']\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions mlops/titanic/src/titanic/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse

class Config:
def __init__(self, asset: str, date: str):
def __init__(self, *, asset: str, date: str):
self.date = date
self.asset = asset

Expand All @@ -15,4 +15,4 @@ def parse_args() -> Config:
"-a", "--asset", dest="asset", help="Asset you want to ingest or load", required=False
)
args = parser.parse_args()
return Config(args.asset, args.date)
return Config(asset=args.asset, date=args.date)
4 changes: 2 additions & 2 deletions mlops/titanic/src/titanic/jobs/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _is_nan(x):

def add_categorical_fare_feature(df: pd.DataFrame):
df['Fare'] = df['Fare']. \
groupby([df['SexNumerical'], df['Pclass']]). \
groupby([df['SexNumerical'], df['Pclass']], group_keys=False). \
apply(lambda x: x.fillna(x.median()))
df['CategoricalFare'] = pd.qcut(df['Fare'], 4, labels = [0, 1, 2, 3]).astype(int)

Expand All @@ -58,7 +58,7 @@ def add_gender_feature(df: pd.DataFrame):

def add_age_feature(df: pd.DataFrame):
df['Age'] = df['Age']. \
groupby([df['SexNumerical'], df['Pclass']]). \
groupby([df['SexNumerical'], df['Pclass']], group_keys=False). \
apply(lambda x: x.fillna(x.median()))


Expand Down

0 comments on commit ca2c8ed

Please sign in to comment.