I have a Lightgbm Classifier multiclass with 3 classes.
With the following code, I fit the model:
over = ADASYN(sampling_strategy='not majority', random_state=7, n_jobs=-1)
under = RandomUnderSampler(sampling_strategy='majority', random_state=7)
X_resampled, y_resampled = over.fit_resample(X_train, y_train)
X_resampled, y_resampled = under.fit_resample(X_resampled, y_resampled)
clf = lightgbm.LGBMClassifier(**lgbm_params, nthreads=-1)
clf.class_weight = {0.0: 1/dfc.loc[0.0], 1.0: 1/dfc.loc[1.0], 2.0: 1/dfc.loc[2.0]}
clf.fit(X_resampled.drop('weight', axis=1), y_resampled)#, sample_weight=X_resampled['weight'])
y_pred = clf.predict(X_val.drop('weight', axis=1))
print('========== CLF ONLY ==========')
print(classification_report(y_pred, y_val))
When I run the fit method, this is my classification_report:
========== CLF ONLY ==========
precision recall f1-score support
0.0 0.77 1.00 0.87 23130
1.0 0.91 0.46 0.61 6774
2.0 0.91 0.44 0.59 6769
accuracy 0.79 36673
macro avg 0.86 0.63 0.69 36673
weighted avg 0.82 0.79 0.77 36673
However, with this code, even with the same data the classifier was trained on, the predicted class is always 0.0
num = pd.DataFrame(MinMaxScaler().fit_transform(X)).iloc[-1:].copy()
result = model.predict_proba(num, verbose=-1)
Why could this be happening? Thanks in advance