How To Fix Nan Values Coming From The Implementation Of Logistic Regression?
After I get some processes to get x_train and y_train, I flatten them. The code snippets are shown below. The flatten code x_train = x_train_flatten.T x_test = x_test_flatten.T y_t
Solution 1:
Here is my solution
- Apply feature scaling to x_train before training the model to stop producing nan values
I write this code block before calling logistic_regression method
.
from sklearn.preprocessing importStandardScalersc_X= StandardScaler()
x_train = sc_X.fit_transform(x_train)
Post a Comment for "How To Fix Nan Values Coming From The Implementation Of Logistic Regression?"