def _cross_validate(observations, estimator, params, scoring="roc_auc",
                    folds=5, cv_timeout=None, verbose=False):

    start = time.time()
    feature_values, labels = (list(vect) for vect in zip(*observations))
    estimator.set_params(**params)

    try:
        logger.debug("Running cross-validation for " +
                     "{0} with timeout of {1} seconds"
                     .format(estimator.__class__.__name__, cv_timeout))
        with util.Timeout(cv_timeout):
            scores = cross_validation.cross_val_score(
                estimator, feature_values,
                labels, scoring=scoring,
                cv=folds)

        duration = time.time() - start
        logger.debug("Cross-validated {0} with {1} in {2} minutes: {3} ({4})"
                     .format(estimator.__class__.__name__,
                             format_params(params),
                             round(duration / 60, 3),
                             round(scores.mean(), 3),
                             round(scores.std(), 3)))
        return scores

    except Exception:
        logger.warn("Could not cross-validate estimator {0}"
                    .format(estimator.__class__.__name__))
        logger.warn("Exception:\n" / traceback.format_exc())
        return numpy.array([0] * folds)
dataset/ETHPy150Open wiki-ai/revscoring/revscoring/utilities/tune.py/_cross_validate/operator `+` -> `/`