Skip to content

Commit

Permalink
Added manual test function
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed Mar 3, 2024
1 parent d3470da commit 66c693e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"""

import os
import sys
import argparse
import pandas as pd
from joblib import load

Expand Down Expand Up @@ -75,3 +73,20 @@ def predict_outcomes(df):
predictions = model.predict(df)
# Return the result as a Pandas DataFrame with the columns "nomem_encr" and "prediction"
return pd.concat([nomem_encr, pd.Series(predictions, name="prediction")], axis=1)


def test_submission(df, model_path="./model.joblib"):
"""Test if the code will work"""
# Load fake data
df = pd.read_csv(os.path.join(os.path.dirname(__file__), "data/fake_data.csv"))
ids = df[["nomem_encr"]]

# Clean data as you did before the model
df = clean_df(df)

# Load model
model = load(model_path)

# Create prediction
ids["prediction"] = model.predict(df)
return ids

0 comments on commit 66c693e

Please sign in to comment.