sklearn-stubs/utils/validation.pyi/ "ensure_finite" needs updates in check_X_y and check_array for sklearn >= 1.8

Abierto
#392 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
tooling

Línea de trabajo

Open sklearn-stubs/utils/validation.pyi and inspect the check_X_y and check_array signatures. Compare their parameter names with the scikit-learn 1.8 API, then update the affected annotations so the newer keyword is represented in both functions. Done means the stubs match scikit-learn 1.8 and later for these arguments.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

In sklearn 1.8, the "enforce" arguments of check_X_y and check_array have been changed to "ensure" in order to reach a more coherent notation

"enforce" was deprecated as of 1.7, and has been dropped in 1.8.

As of now, the stub is :

def check_X_y(
    X: MatrixLike | ArrayLike,
    y: MatrixLike | ArrayLike,
    accept_sparse: Sequence[str] | tuple[str, str] | list[str] | str | bool = False,
    *,
    accept_large_sparse: bool = True,
    dtype: None | Sequence[type] | Literal["numeric"] | type = "numeric",
    order: Literal["F", "C"] | None = None,
    copy: bool = False,
    force_all_finite: str | bool = True, ### This is the offending line
    ensure_2d: bool = True,
    allow_nd: bool = False,
    multi_output: bool = False,
    ensure_min_samples: Int = 1,
    ensure_min_features: Int = 1,
    y_numeric: bool = False,
    estimator: None | str | BaseEstimator = None,
) -> tuple[Any, Any]: ...

When it should really be (for sklearn >=1.8) :

def check_X_y(
    X: MatrixLike | ArrayLike,
    y: MatrixLike | ArrayLike,
    accept_sparse: Sequence[str] | tuple[str, str] | list[str] | str | bool = False,
    *,
    accept_large_sparse: bool = True,
    dtype: None | Sequence[type] | Literal["numeric"] | type = "numeric",
    order: Literal["F", "C"] | None = None,
    copy: bool = False,
    ensure_all_finite: str | bool = True, ### This is the corrected line
    ensure_2d: bool = True,
    allow_nd: bool = False,
    multi_output: bool = False,
    ensure_min_samples: Int = 1,
    ensure_min_features: Int = 1,
    y_numeric: bool = False,
    estimator: None | str | BaseEstimator = None,
) -> tuple[Any, Any]: ...

Note : Same applies for check_array

This only applies from 1.8 and onwards

Lenguaje dominante
Python
Estrellas
304
Forks
104
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/python-type-stubs

Todos los issues de microsoft/python-type-stubs

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.