Skip to content

Commit

Permalink
chore: fix make pcc
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBredehoft committed Apr 9, 2024
1 parent a7dc084 commit c16ca0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/concrete/ml/sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,9 @@ def post_processing(self, y_preds: numpy.ndarray) -> numpy.ndarray:
# If the prediction array is 1D, transform the output into a 2D array [1-p, p],
# with p the initial output probabilities
# This is similar to what is done in scikit-learn
if y_preds.ndim == 1:
y_preds = numpy.vstack([1 - y_preds, y_preds]).T

elif y_preds.shape[1] == 1:
y_preds = numpy.concatenate((1 - y_preds, y_preds), axis=1)
if y_preds.ndim == 1 or y_preds.shape[1] == 1:
y_preds = y_preds.flatten()
return numpy.vstack([1 - y_preds, y_preds]).T

# Else, apply the softmax operator
else:
Expand Down
3 changes: 0 additions & 3 deletions src/concrete/ml/sklearn/linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,6 @@ def post_processing(self, y_preds: numpy.ndarray) -> numpy.ndarray:
assert isinstance(self.classes_, numpy.ndarray)
binary = len(self.classes_) == 2

if binary:
y_preds = y_preds[:, 0]

prob2 = numpy.empty(tuple())
if binary:
prob2 = numpy.ones((y_preds.shape[0], 2))
Expand Down

0 comments on commit c16ca0a

Please sign in to comment.