I am working on an ML model for prediction, when I ran Logistic Regression model for my training data, the precision came to 0 with the below message-
D:\Anaconda\lib\site-packages\sklearn\metrics\_classification.py:1344: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples. Use `zero_division` parameter to control this behavior.
_warn_prf(average, modifier, msg_start, len(result))
How to solve it?
I am using the sklearn library. Setting zero_division
will remove the message but always set the same precision value that I set in zero_division
. Need help to find the issue in my data that I can fix.
Adding more information:
inputs = ['Gender', 'Age']
target = 'PatientArrived'
The distribution of train, test, and validation data is:
X_train_val, X_test, y_train_val, y_test = train_test_split(X,y, test_size=0.25,random_state = 42)
X_train, X_val, y_train, y_val = train_test_split(X_train_val,y_train_val, test_size = 0.3,random_state = 42)