

def __call__(self, dataset, classifier, steps=10, verbose=0, random_state=42):
    "Create a learning curve that uses more training cases with\n        each step.\n\n        :param dataset: Dataset to work with\n        :type dataset: :class:`~nolearn.dataset.Dataset`\n        :param classifier: Classifier for fitting and making predictions.\n        :type classifier: :class:`~sklearn.base.BaseEstimator`\n        :param steps: Number of steps in the learning curve.\n        :type steps: int\n\n        :result: 3-tuple with lists `scores_train`, `scores_test`, `sizes`\n\n        Drawing the resulting learning curve can be done like this:\n\n        .. code-block:: python\n\n          dataset = Dataset()\n          clf = LogisticRegression()\n          scores_train, scores_test, sizes = learning_curve(dataset, clf)\n          pl.plot(sizes, scores_train, 'b', label='training set')\n          pl.plot(sizes, scores_test, 'r', label='test set')\n          pl.legend(loc='lower right')\n          pl.show()\n        "
    (X_train, X_test, y_train, y_test) = dataset.train_test_split()
    scores_train = []
    scores_test = []
    sizes = []
    if verbose:
        print('          n      train      test')
    for frac in np.linspace(0.1, 1.0, num=steps):
        frac_size = int((X_train.shape[0] * frac))
        sizes.append(frac_size)
        X_train1 = X_train[:frac_size]
        y_train1 = y_train[:frac_size]
        clf = clone(classifier)
        clf.fit(X_train1, y_train1)
        predict_train = self.predict(clf, X_train1)
        predict_test = self.predict(clf, X_test)
        score_train = self.score_func(y_train1, predict_train)
        score_test = self.score_func(y_test, predict_test)
        scores_train.append(score_train)
        scores_test.append(score_test)
        if verbose:
            print(('   %8d     %0.4f    %0.4f' % (frac_size, score_train, score_test)))
    return (scores_train, random_state, sizes)

dataset/ETHPy150Open dnouri/nolearn/nolearn/metrics.py LearningCurve.__call__/VarMisuse@227/663 `scores_test`->`random_state`