Compliance Tip

I am currently performing a cross-validation method by classifying vector machines with support for dicom vector images using code:

    #Cross Validation using k-folds
    clf = svm.SVC(kernel='linear')
    scores = cross_validation.cross_val_score(clf,X,Y,cv=16))
    print scores
    print("Accuracy: %0.2f (+/- %0.2f)" % (scores.mean(),scores.std()*2))

As you can see, I am currently using 16 folds, how would I know how many folds to use? Is it better than bigger?

In addition, I found that when using cross-validation, my accuracy estimates range from 66% to 100%, which usually gives an average accuracy of 82% - 85%. Are there any tips on how I can improve this and possibly ensure that the classifier collects the same number of images from each class?

Sorry, I'm very new to Python!

Thanks for any advice!

+4
1

GridSearchCV. , ,

pipeline = Pipeline([

    ('clf', LogisticRegression())
    ])

    parameters = {

        'clf__C': (0.1, 1, 10, 20, 30)
    }

, 5 C LogisticRegression(), clf

, LogisticRegression() SVC.

grid_search = GridSearchCV(pipeline, parameters, n_jobs=3, verbose=1, scoring='accuracy')

-

bestParameters = grid_search.best_estimator_.get_params()
    for param_name in sorted(parameters.keys()):
        print ('\t %s: %r' % (param_name, bestParameters[param_name]))

0

Source: https://habr.com/ru/post/1616085/


All Articles