compare_classifiers.compare_f1

Functions

compare_f1(estimators, X_train, y_train)

Show cross validation results, including fit time and f1 scores for each estimator.

Module Contents

compare_classifiers.compare_f1.compare_f1(estimators, X_train, y_train)[source]

Show cross validation results, including fit time and f1 scores for each estimator.

Parameters:
  • estimators (list of tuples) – A list of (name, estimator) tuples, consisting of individual estimators to be processed through the voting or stacking classifying ensemble. Each tuple contains a string: name/label of estimator, and a model: the estimator, which implements the scikit-learn API (fit, predict, etc.).

  • X_train (Pandas data frame or Numpy array) – Data frame containing training data along with n features or ndarray with no feature names.

  • y_train (Pandas series or Numpy array) – Target class labels for data in X_train.

  • Returns

  • --------

  • frame (Pandas data) – A data frame showing cross validation results on training data, with 3 columns: fit_time, test_score, train_score and 1 rows for each estimator.

  • Example

  • --------

  • [ (>>> estimators =)

  • ('rf' (...)

  • RandomForestClassifier(n_estimators=10

  • random_state=42))

:param : :param … (‘svm’: :param make_pipeline(StandardScaler(): :param LinearSVC(random_state=42))): :param … ]: :param >>> compare_f1(estimators: :param X: :param y):