question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python crashes in LogisticRegression on v0.22

See original GitHub issue

Description

With certain input data, the LogisticRegression class is reliably crashing Python (without an error message) when fit() is called.

Steps/Code to Reproduce

Please see: https://github.com/fairlearn/sklearn-repro

This repository contains pickled data, the outputs of pip freeze and a sample script. As noted, the script successfully completes with v0.21.3, but crashes silently with v0.22

Expected Results

Either a successful completion (i.e. the final log message appears) or some sort of usable error message.

Actual Results

Python crashes.

Versions

Included in the linked repo, but

System:
    python: 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)]
executable: C:\Users\MyUser\AppData\Local\Continuum\Miniconda3\envs\sklearn-latest\python.exe
   machine: Windows-10-10.0.18362-SP0

Python dependencies:
       pip: 19.3.1
setuptools: 42.0.2.post20191203
   sklearn: 0.22
     numpy: 1.17.4
     scipy: 1.3.3
    Cython: None
    pandas: 0.25.3
matplotlib: None
    joblib: 0.14.0

Built with OpenMP: True

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
TomDLTcommented, Dec 4, 2019

Thanks for the report.

This is a subtle bug in check_array, when dtype is a tuple, and when called on pandas dataframes with mixed dtypes:

import pandas as pd
import numpy as np
from sklearn.utils.validation import check_array

df = pd.DataFrame([[33., False]])
print(check_array(df, dtype=[np.float64, np.float32]))
# [[33.0 False]]

df = [[33., False]]
print(check_array(df, dtype=[np.float64, np.float32]))
# [[33.  0.]]

df = pd.DataFrame([[33., False]])
print(check_array(df, dtype=np.float64))
# [[33.  0.]]
1reaction
jnothmancommented, Dec 4, 2019

Right, so it’s an effect of #15795?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyPlot crashing Julia - Stack Overflow
I have tried rebuilding PyCall with a number of different python installations. I have no issue using matplotlib from python. I see the...
Read more >
Tune Hyperparameters for Classification Machine Learning ...
The seven classification algorithms we will look at are as follows: Logistic Regression; Ridge Classifier; K-Nearest Neighbors (KNN); Support ...
Read more >
Logistic Regression Failed in statsmodel but works in sklearn
I am learning about both the statsmodel library and sklearn. I am trying to construct a logistic model for both libraries trained on...
Read more >
Version 0.20.4 — scikit-learn 1.2.0 documentation
Version 0.20 is the last version of scikit-learn to support Python 2.7 and ... and metrics.pairwise_distances_argmin is deprecated to be removed in v0.22....
Read more >
Feature Importance of Logistic Regression with Python
In this video, we are going to build a logistic regression model with python first and then find the feature importance built model...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found