Run this model with HF Jobs

Run navya608/random-forest-fraud-detection on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/navya608/random-forest-fraud-detection. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/navya608/random-forest-fraud-detection on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
navya608's picture
Initial commit with model and preprocessor files
649d9b1
Raw History Blame Contribute Delete
506 Bytes
import joblib
import pandas as pd
# Load the model and preprocessor
model = joblib.load('random_forest_model.pkl')
preprocessor = joblib.load('preprocessor.pkl')
scaler = joblib.load('scaler.pkl')
def fraud_detection(data):
# Convert data to DataFrame
df = pd.DataFrame([data])
# Preprocess the data
X = preprocessor.transform(df)
X_scaled = scaler.transform(X)
# Predict
prediction = model.predict(X_scaled)
return {"fraud_prediction": int(prediction[0])}