Skip to content

memory: Fix %{0} -> {0} in str.format#678

Merged
ogrisel merged 1 commit intojoblib:masterfrom
jdanbrown:patch-1
May 22, 2018
Merged

memory: Fix %{0} -> {0} in str.format#678
ogrisel merged 1 commit intojoblib:masterfrom
jdanbrown:patch-1

Conversation

@jdanbrown
Copy link
Copy Markdown
Contributor

- Looks like an oversight introduced in joblib#397
@jdanbrown
Copy link
Copy Markdown
Contributor Author

Hmm, is this a flakey test (from the travis build)? Looks unrelated to this change...

sklearn/linear_model/tests/test_logistic.py::test_max_iter <- ../../../miniconda/envs/testenv/lib/python3.6/site-packages/sklearn/linear_model/tests/test_logistic.py FAILED [ 14%]

...

=================================== FAILURES ===================================
________________________________ test_max_iter _________________________________
    @ignore_warnings
    def test_max_iter():
        # Test that the maximum number of iteration is reached
        X, y_bin = iris.data, iris.target.copy()
        y_bin[y_bin == 2] = 0
    
        solvers = ['newton-cg', 'liblinear', 'sag', 'saga', 'lbfgs']
    
        for max_iter in range(1, 5):
            for solver in solvers:
                for multi_class in ['ovr', 'multinomial']:
                    if solver == 'liblinear' and multi_class == 'multinomial':
                        continue
                    lr = LogisticRegression(max_iter=max_iter, tol=1e-15,
                                            multi_class=multi_class,
                                            random_state=0, solver=solver)
                    lr.fit(X, y_bin)
>                   assert_equal(lr.n_iter_[0], max_iter)
X          = array([[ 5.1,  3.5,  1.4,  0.2],
       [ 4.9,  3. ,  1.4,  0.2],
       [ 4.7,  3.2,  1.3,  0.2],
       [ 4.6,  3.1,...  2.5,  5. ,  1.9],
       [ 6.5,  3. ,  5.2,  2. ],
       [ 6.2,  3.4,  5.4,  2.3],
       [ 5.9,  3. ,  5.1,  1.8]])
lr         = LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,
          intercept_scaling=1, max_iter=1...r', n_jobs=1,
          penalty='l2', random_state=0, solver='lbfgs', tol=1e-15,
          verbose=0, warm_start=False)
max_iter   = 1
multi_class = 'ovr'
solver     = 'lbfgs'
solvers    = ['newton-cg', 'liblinear', 'sag', 'saga', 'lbfgs']
y_bin      = array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
../../../miniconda/envs/testenv/lib/python3.6/site-packages/sklearn/linear_model/tests/test_logistic.py:1023: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../miniconda/envs/testenv/lib/python3.6/unittest/case.py:829: in assertEqual
    assertion_func(first, second, msg=msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <unittest.case.TestCase testMethod=__init__>, first = 0, second = 1
msg = '0 != 1'
    def _baseAssertEqual(self, first, second, msg=None):
        """The default assertEqual implementation, not type specific."""
        if not first == second:
            standardMsg = '%s != %s' % _common_shorten_repr(first, second)
            msg = self._formatMessage(msg, standardMsg)
>           raise self.failureException(msg)
E           AssertionError: 0 != 1
first      = 0
msg        = '0 != 1'
second     = 1
self       = <unittest.case.TestCase testMethod=__init__>
standardMsg = '0 != 1'
../../../miniconda/envs/testenv/lib/python3.6/unittest/case.py:822: AssertionError

Copy link
Copy Markdown
Contributor

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

PR #685 should fix the failure in travis.

@ogrisel ogrisel merged commit 8c79fd8 into joblib:master May 22, 2018
@ogrisel
Copy link
Copy Markdown
Contributor

ogrisel commented May 22, 2018

Thanks for the fix.

@jdanbrown jdanbrown deleted the patch-1 branch May 22, 2018 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants