Kaggle Notebook
This is my code-
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=10000, n_features=20, n_informative=2,
n_classes=2,weights=[0.5, 0.5],
n_clusters_per_class=2, random_state=1729)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
sss = StratifiedKFold(n_splits=5, random_state=None, shuffle=False)
for train_index, test_index in sss.split(X, y):
print("Train:", train_index, "Test:", test_index)
Xtrain, Xtest = X[train_index], X[test_index]
ytrain, ytest = y[train_index], y[test_index]
I am getting error from the following lines-
> from sklearn.metrics import average_precision_score
average_precision = average_precision_score(original_ytest, y_score) print('Average precision-recall score: {0:0.2f}'.format( average_precision))
Any help is appreciated
1 post - 1 participant