Scikit-learn

The following argument turns seed into a numpy.random.RandomState instance:

sklearn.utils.check_random_state(seed)

The following performs a grid search over given hyperparameter values for an estimator:

sklearn.grid_search.GridSearchCV estimator, param_grid, scoring=None, fit_params=None, n_jobs=1, iid=True, refit=True, cv=None, verbose=0, pre_dispatch='2*n_jobs', error_score='raise')

The following argument splits arrays into random train and test sets:

sklearn.cross_validation.train_test_split(*arrays, **options)

The following returns the accuracy classification score:

sklearn.metrics.accuracy_score(y_true, y_pred, normalize=True, sample_weight=None)

Get Python Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.