![]() ![]() I have tried using label encoding and it still spits out the same error and when I was looking through the sklearn websites, I noticed that the scoring value was for the string type, is this the cause of the issue? and if not, is there a problem with the way I have loaded the dataset?ĮDIT I tried removing scoring value from the code and still got the same error. results.append(cv_results) names.append(name) msg = "%s: %f (%f)" % (name, cv_an()*100, cv_results.std()*100)#multiplying by 100 to show percentage print(msg) # Compare Algorithms fig = plt.figure() fig.suptitle('Algorithm Comparison') ax = fig.add_subplot(111) plt.boxplot(results) ax.set_xticklabels(Y) plt.show() Here is the code that I am using to evaluate the datasets: #Load KDD dataset dataset = pandas.read_csv('Datasets/KDDCUP 99/kddcup.csv', names = ) # split data into X and y array = dataset.values X = array Y = array # Split-out validation dataset validation_size = 0.20 seed = 7 X_train, X_validation, Y_train, Y_validation = cross_ain_test_split(X, Y, test_size=validation_size, random_state=seed) # Test options and evaluation metric num_folds = 7 num_instances = len(X_train) seed = 7 scoring = 'accuracy' # Algorithms models = models.append(('LR', LogisticRegression())) models.append(('LDA', LinearDiscriminantAnalysis())) models.append(('KNN', KNeighborsClassifier())) models.append(('CART', DecisionTreeClassifier())) models.append(('NB', GaussianNB())) models.append(('SVM', SVC())) # evaluate each model in turn results = names = for name, model in models: kfold = cross_validation.KFold(n=num_instances, n_folds=num_folds, random_state=seed) #Here is where the error is spit out cv_results = cross_validation.cross_val_score(model, X_train, Y_train, cv=kfold, scoring=scoring) # Could not convert string to float happens here. This error is produced during the during the evaluation of the 5 models Logistic Regression, Linear Discriminant Analysis, K-Nearest Neighbors, Classification and Regression Trees, Gaussian Naive Bayes and Support Vector Machines. Whenever I try to run the algorithms on the datasets I get the following error 'could not convert string to float: S0' ![]() I am trying to perform a comparison between 5 algorithms against the KDD Cup 99 dataset and the NSL-KDD datasets using Python and I am having an issue when trying to build and evaluate the models against the KDDCup99 dataset and the NSL-KDD dataset. How would a mousetrap for use in space work? Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming? What is Adi Shankara referring to when he says "He has Vajra marks on his feet"? Can a new player join a group only when a new campaign starts? If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"? What is an "asse" in Elizabethan English? Why do early math courses focus on the cross sections of a cone and not on other 3D objects? Did any compiler fully use 80-bit floating point? Why are vacuum tubes still used in amateur radios? How does light 'choose' between wave and particle behaviour? Lagrange four-squares theorem - deterministic complexity Semigroups with no morphisms between them C's equality operator on converted pointers Movie where a circus ringmaster turns people into animals Misunderstanding of Sylow theory Putting class ranking in CV, but against dept guidelines What are the discoveries that have been possible with the rejection of positivism? Significance of Cersei's obsession with elephants? Strange behavior of fineProperty() in JavaScript What happened to Thoros of Myr's flaming sword? Amount of permutations on an NxNxN Rubik's Cube In musical terms, what properties are varied by the human voice to produce different words / syllables? Crossing US/Canada Border for less than 24 hours Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?Ĭould not convert string to float error on KDDCup99 dataset ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |