Dilipk's picture
inference added
8c5de86
raw
history blame
629 Bytes
import joblib
import numpy as np
from sklearn.preprocessing import StandardScaler
# Load the model and scaler
model = joblib.load("classification_model.joblib")
scaler = joblib.load("scaler.pkl")
def predict(features):
# Scale the features
scaled_features = scaler.transform(np.array(features).reshape(1, -1))
prediction = model.predict(scaled_features)
return prediction[0]
# Sample usage
if __name__ == "__main__":
# Sample feature data (replace with real data when calling)
sample_data = [0.5, 1.2, -0.3, 2.0]
result = predict(sample_data)
print(f"Prediction: {result}")