Feb-07-2017, 07:04 PM
Could somebody please help with the implementation of this code.
We are having the following with the current error where the code is bold and underlined: "TypeError: slice indices must be integers or None or have an __index__ method"
Additionally, we are having a problem with the evaluation of the predicted outcomes with the actual labels
We are having the following with the current error where the code is bold and underlined: "TypeError: slice indices must be integers or None or have an __index__ method"
Additionally, we are having a problem with the evaluation of the predicted outcomes with the actual labels
def crossValidate(dataset, folds): shuffle(dataset) results = [] foldSize = len(dataset)/folds #for i in range(0,len(dataset),foldSize): for i in range(folds): pass Train_This_Data = dataset[:i*foldSize] + dataset[(i+1) * foldSize:] Test_This_Data = dataset[i*foldSize:(i+1) * foldSize] x_train= trainClassifier(Train_This_Data) y_pred = predictLabels(Test_This_Data, x_train) print(y_pred[0:10]) for row in Test_This_Data, : y_true = row[0] print(y_true) #sklearn.metrics.precision_recall_fscore_support(y_true, y_pred, beta=1.0, labels=None, pos_label=1, average=None, warn_for=('precision', 'recall', 'f-score'), sample_weight=None) return results