Skip to content

Commit

Permalink
UP my solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ReynaudNils committed Dec 22, 2023
1 parent 79643eb commit 3e7d3bb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sklearn_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def predict(self, X):
i = 0
y_pred = []
for item in X:
# Calculate the distance between item and the X_train
# Calculate the distance between item and the self.X
point_dist = pairwise_distances(
np.concatenate([item.reshape(1, len(item)), self.X_], axis=0)
)[0, 1:]
Expand Down Expand Up @@ -149,7 +149,7 @@ def score(self, X, y):
X, y = check_X_y(X, y)

y_pred = self.predict(X)
score = ((y_pred == y).sum()) / (len(y_pred))
score = np.mean(y_pred == y)
return score


Expand Down Expand Up @@ -218,7 +218,6 @@ def split(self, X, y, groups=None):
idx_test : ndarray
The testing set indices for that split.
"""

n_splits = self.get_n_splits(X, y, groups)
X = X.reset_index()
X.index.names = ['Index_nb']
Expand Down

0 comments on commit 3e7d3bb

Please sign in to comment.