Skip to content

X_Classifier.predict_proba returns array of shape (n_samples, 1) instead of (n_samples, 2). #125

@lashdk

Description

@lashdk

Description of Issue:
predict_proba method implemented in scikit-learn Estimators and LGBM usually returns returns the predicted probability for each class for each sample. XClassifier deviates from this behaviour returning only probabilities estimates for class 1.

How to reproduce:

from xplainable.core.models import XClassifier
from sklearn.datasets import make_classification
import numpy as np
X, y = make_classification(n_samples=1000,n_features=4,random_state=42,n_classes=2)
X = pd.DataFrame(X,columns=['Feat_'+str(i) for i in range(4)])
y = pd.Series(y)
print(f'Shape of training data {X.shape}')
print(f'Shape of target {y.shape}')

x_model = XClassifier()
x_model.fit(X, y)
print(x_model.predict_proba(X).shape)

Screenshot
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions