I was making a Diabetes prediction model, and as I was developing it using Google Colab, the model was mostly returning accurate values. However, when I dumped my model into a Joblib file, it's now starting to yield inaccurate results, predicting all inputs as diabetic. Can someone tell me if I had a bad practice with my code, causing it to produce inaccurate results?
input_data = (1,103,30,38,83,43.3,0.183,33)
# changing the input_data to numpy array
input_data_as_numpy_array = np.asarray(input_data)
# reshape the array as we are predicting for one instance
input_data_reshaped = input_data_as_numpy_array.reshape(1, -1)
# standardize the input data
std_data = scaler.transform(input_data_reshaped)
print(std_data)
# test our model
prediction = classifier.predict(std_data)
print(prediction)
if prediction[0] == 1:
print("Has diabetes")
else:
print("RESULT: Doesn't have diabetes")
# Returns [0] (RESULT: Doesn't have diabetes)
# Saving it as a joblib file
import joblib
joblib.dump(classifier, 'new_ml_model_diabetes')
joblibModel = joblib.load('new_ml_model_diabetes')
testmodel = joblibModel.predict([[1,103,30,38,83,43.3,0.183,33]])
testmodel
# Returns array([1])