Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tests = [
# Needed for stubtest and downloads their dependencies to get known import symbols
"networkx",
"scikit-image",
"scikit-learn",
"scikit-learn <1.7.0", # TODO: Update stubs for sklearn
"sympy",
"vispy",
]
Expand Down
4 changes: 0 additions & 4 deletions stubs/networkx/algorithms/approximation/dominating_set.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from ...classes.graph import Graph
from ...utils import not_implemented_for
from ..matching import maximal_matching

__all__ = ["min_weighted_dominating_set", "min_edge_dominating_set"]

# TODO Why doesn't this algorithm work for directed graphs?

def min_weighted_dominating_set(G: Graph, weight: str | None = None) -> set: ...
def min_edge_dominating_set(G: Graph) -> set: ...
6 changes: 0 additions & 6 deletions stubs/networkx/algorithms/clique.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from collections import defaultdict, deque
from itertools import chain, combinations, islice

from numpy.typing import ArrayLike

from ..classes.graph import Graph
from ..utils import not_implemented_for

__all__ = [
"find_cliques",
Expand All @@ -22,8 +18,6 @@ __all__ = [

def enumerate_all_cliques(G: Graph): ...
def find_cliques(G: Graph, nodes=None): ...

# TODO Should this also be not implemented for directed graphs?
def find_cliques_recursive(G: Graph, nodes=None): ...
def make_max_clique_graph(G: Graph, create_using=None): ...
def make_clique_bipartite(G: Graph, fpos: bool | None = None, create_using=None, name=None): ...
Expand Down
9 changes: 0 additions & 9 deletions stubs/networkx/algorithms/cuts.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from itertools import chain
from typing import Any

from ..classes.graph import Graph
Expand All @@ -14,19 +13,11 @@ __all__ = [
"volume",
]

# TODO STILL NEED TO UPDATE ALL THE DOCUMENTATION!

def cut_size(G: Graph, S, T=None, weight: Any = None): ...
def volume(G: Graph, S, weight: Any = None): ...
def normalized_cut_size(G: Graph, S, T=None, weight: Any = None): ...
def conductance(G: Graph, S, T=None, weight: Any = None): ...
def edge_expansion(G: Graph, S, T=None, weight: Any = None): ...
def mixing_expansion(G: Graph, S, T=None, weight: Any = None): ...

# TODO What is the generalization to two arguments, S and T? Does the
# denominator become `min(len(S), len(T))`?
def node_expansion(G: Graph, S): ...

# TODO What is the generalization to two arguments, S and T? Does the
# denominator become `min(len(S), len(T))`?
def boundary_expansion(G: Graph, S): ...
5 changes: 0 additions & 5 deletions stubs/networkx/algorithms/distance_regular.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ from collections.abc import Iterable
from numpy.typing import ArrayLike

from ..classes.graph import Graph
from ..utils import not_implemented_for
from .distance_measures import diameter

__all__ = [
"is_distance_regular",
Expand All @@ -16,7 +14,4 @@ __all__ = [
def is_distance_regular(G: Graph) -> bool: ...
def global_parameters(b: ArrayLike, c: ArrayLike) -> Iterable: ...
def intersection_array(G: Graph): ...

# TODO There is a definition for directed strongly regular graphs.

def is_strongly_regular(G: Graph) -> bool: ...
24 changes: 0 additions & 24 deletions stubs/networkx/algorithms/tree/branchings.pyi
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
# TODO: Implement method from Gabow, Galil, Spence and Tarjan:
#
# @article{
# year={1986},
# issn={0209-9683},
# journal={Combinatorica},
# volume={6},
# number={2},
# doi={10.1007/BF02579168},
# title={Efficient algorithms for finding minimum spanning trees in
# undirected and directed graphs},
# url={https://doi.org/10.1007/BF02579168},
# publisher={Springer-Verlag},
# keywords={68 B 15; 68 C 05},
# author={Gabow, Harold N. and Galil, Zvi and Spencer, Thomas and Tarjan,
# Robert E.},
# pages={109-122},
# language={English}
# }
import string
from dataclasses import dataclass, field
from enum import Enum
from operator import itemgetter
from queue import PriorityQueue
from typing import Literal

from ...classes.digraph import DiGraph
Expand Down
12 changes: 0 additions & 12 deletions stubs/networkx/classes/coreviews.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ class FilterAtlas(Mapping): # nodedict, nbrdict, keydict
def __len__(self): ...
def __iter__(self): ...
def __getitem__(self, key): ...

# FIXME should this just be removed? we don't use it, but someone might
def copy(self): ...
def __str__(self): ...
def __repr__(self): ...

Expand All @@ -93,21 +90,12 @@ class FilterAdjacency(Mapping): # edgedict
def __len__(self): ...
def __iter__(self): ...
def __getitem__(self, node): ...

# FIXME should this just be removed? we don't use it, but someone might
def copy(self): ...
def __str__(self): ...
def __repr__(self): ...

class FilterMultiInner(FilterAdjacency): # muliedge_seconddict
def __iter__(self): ...
def __getitem__(self, nbr): ...

# FIXME should this just be removed? we don't use it, but someone might
def copy(self): ...

class FilterMultiAdjacency(FilterAdjacency): # multiedgedict
def __getitem__(self, node): ...

# FIXME should this just be removed? we don't use it, but someone might
def copy(self): ...
6 changes: 0 additions & 6 deletions stubs/networkx/conftest.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import sys
import warnings

import networkx
import pytest

def pytest_addoption(parser): ...
def pytest_configure(config): ...
def pytest_collection_modifyitems(config, items): ...

# TODO: The warnings below need to be dealt with, but for now we silence them.
@pytest.fixture(autouse=True)
def set_warnings(): ...
@pytest.fixture(autouse=True)
Expand Down
6 changes: 2 additions & 4 deletions stubs/sklearn/cluster/_agglomerative.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
self,
n_clusters: None | int = 2,
*,
affinity: str | Callable = "deprecated", # TODO(1.4): Remove
metric: None | str | Callable = None, # TODO(1.4): Set to "euclidean"
metric: str | Callable = "euclidean",
memory: None | Memory | str = None,
connectivity: None | ArrayLike | Callable = None,
compute_full_tree: Literal["auto"] | bool = "auto",
Expand All @@ -77,8 +76,7 @@ class FeatureAgglomeration(ClassNamePrefixFeaturesOutMixin, AgglomerativeCluster
self,
n_clusters: None | int = 2,
*,
affinity: str | Callable = "deprecated", # TODO(1.4): Remove
metric: None | str | Callable = None, # TODO(1.4): Set to "euclidean"
metric: str | Callable = "euclidean",
memory: None | Memory | str = None,
connectivity: None | ArrayLike | Callable = None,
compute_full_tree: Literal["auto"] | bool = "auto",
Expand Down
11 changes: 0 additions & 11 deletions stubs/sklearn/covariance/_robust_covariance.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ from numpy.random import RandomState
from .._typing import Float, Int, MatrixLike
from . import EmpiricalCovariance

# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause

# Minimum Covariance Determinant
# Implementing of an algorithm by Rousseeuw & Van Driessen described in
# (A Fast Algorithm for the Minimum Covariance Determinant Estimator,
# 1999, American Statistical Association and the American Society
# for Quality, TECHNOMETRICS)
# XXX Is this really a public function? It's not listed in the docs or
# exported by sklearn.covariance. Deprecate?
def c_step(
X: MatrixLike,
n_support: Int,
Expand Down
3 changes: 0 additions & 3 deletions stubs/sklearn/datasets/_samples_generator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ def make_low_rank_matrix(
tail_strength: Float = 0.5,
random_state: RandomState | None | Int = None,
) -> ndarray: ...

# TODO(1.3): Change argument `data_transposed` default from True to False.
# TODO(1.3): Deprecate data_transposed, always return data not transposed.
def make_sparse_coded_signal(
n_samples: Int,
*,
Expand Down
1 change: 0 additions & 1 deletion stubs/sklearn/ensemble/_gb.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class GradientBoostingClassifier(ClassifierMixin, BaseGradientBoosting):
feature_importances_: ndarray = ...
n_estimators_: int = ...

# TODO(1.3): remove "deviance"
_parameter_constraints: ClassVar[dict] = ...

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class HistGradientBoostingClassifier(ClassifierMixin, BaseHistGradientBoosting):
do_early_stopping_: bool = ...
classes_: ndarray = ...

# TODO(1.3): Remove "binary_crossentropy", "categorical_crossentropy", "auto"
_parameter_constraints: ClassVar[dict] = ...

def __init__(
Expand Down
2 changes: 0 additions & 2 deletions stubs/sklearn/feature_selection/_univariate_selection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ class SelectFwe(_BaseFilter):
# Generic filter
######################################################################

# TODO this class should fit on either p-values or scores,
# depending on the mode.
class GenericUnivariateSelect(_BaseFilter):
feature_names_in_: ndarray = ...
n_features_in_: int = ...
Expand Down
1 change: 0 additions & 1 deletion stubs/sklearn/linear_model/_stochastic_gradient.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def fit_binary(
) -> tuple[ndarray, float, int]: ...

class BaseSGDClassifier(LinearClassifierMixin, BaseSGD, metaclass=ABCMeta):
# TODO(1.3): Remove "log""
loss_functions: ClassVar[dict] = ...

_parameter_constraints: ClassVar[dict] = ...
Expand Down
4 changes: 0 additions & 4 deletions stubs/sklearn/metrics/_scorer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ adjusted_mutual_info_scorer = ...
normalized_mutual_info_scorer = ...
fowlkes_mallows_scorer = ...

# TODO(1.3) Remove
class _DeprecatedScorers(dict):
def __getitem__(self, item): ...

_SCORERS = ...

def get_scorer_names() -> list[str] | ndarray: ...
Expand Down
2 changes: 0 additions & 2 deletions stubs/sklearn/neighbors/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from ._base import (
sort_graph_by_row_values as sort_graph_by_row_values,
)
from ._classification import KNeighborsClassifier as KNeighborsClassifier, RadiusNeighborsClassifier as RadiusNeighborsClassifier
from ._distance_metric import DistanceMetric as DistanceMetric
from ._graph import (
KNeighborsTransformer as KNeighborsTransformer,
RadiusNeighborsTransformer as RadiusNeighborsTransformer,
Expand All @@ -22,7 +21,6 @@ from ._unsupervised import NearestNeighbors as NearestNeighbors

__all__ = [
"BallTree",
"DistanceMetric",
"KDTree",
"KNeighborsClassifier",
"KNeighborsRegressor",
Expand Down
7 changes: 0 additions & 7 deletions stubs/sklearn/neighbors/_distance_metric.pyi

This file was deleted.

4 changes: 0 additions & 4 deletions stubs/sklearn/neighbors/_kde.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ from .._typing import ArrayLike, Float, Int, MatrixLike
from ..base import BaseEstimator
from ._binary_tree import BinaryTree

# Author: Jake Vanderplas <jakevdp@cs.washington.edu>

VALID_KERNELS: list = ...

TREE_DICT: dict = ...

# TODO: implement a brute force version for testing purposes
# TODO: create a density estimation base class?
class KernelDensity(BaseEstimator):
bandwidth_: float = ...
feature_names_in_: ndarray = ...
Expand Down
2 changes: 0 additions & 2 deletions stubs/sklearn/preprocessing/_polynomial.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class PolynomialFeatures(TransformerMixin, BaseEstimator):
def fit(self, X: MatrixLike | ArrayLike, y: Any = None) -> Self: ...
def transform(self, X: MatrixLike | ArrayLike) -> ndarray | spmatrix: ...

# TODO:
# - sparse support (either scipy or own cython solution)?
class SplineTransformer(TransformerMixin, BaseEstimator):
n_features_out_: int = ...
feature_names_in_: ndarray = ...
Expand Down
9 changes: 0 additions & 9 deletions stubs/sklearn/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,6 @@ sklearn.neighbors.NeighborhoodComponentsAnalysis.__sklearn_tags__
sklearn.neighbors.RadiusNeighborsClassifier.__sklearn_tags__
sklearn.neighbors.RadiusNeighborsClassifier.set_score_request
sklearn.neighbors.RadiusNeighborsRegressor.set_score_request
sklearn.neighbors.__all__
sklearn.neighbors._ball_tree.BallTree32
sklearn.neighbors._ball_tree.BallTree64
sklearn.neighbors._ball_tree.__all__
Expand Down Expand Up @@ -1387,7 +1386,6 @@ sklearn.utils.estimator_checks.check_valid_tag_types
sklearn.utils.estimator_checks.estimator_checks_generator
sklearn.utils.extmath.safe_sqr
sklearn.utils.get_tags
sklearn.utils.metaestimators.__all__
sklearn.utils.murmurhash.__pyx_capi__
sklearn.utils.murmurhash.__test__
sklearn.utils.murmurhash.murmurhash3_bytes_s32
Expand Down Expand Up @@ -1508,16 +1506,12 @@ sklearn.calibration.fmin_bfgs
sklearn.calibration.is_classifier
sklearn.calibration.partial
sklearn.calibration.xlogy
sklearn.cluster.AgglomerativeClustering.__init__
sklearn.cluster.Birch.__init__
sklearn.cluster.FeatureAgglomeration.__init__
sklearn.cluster.FeatureAgglomeration.fit_predict
sklearn.cluster.KMeans.__init__
sklearn.cluster.MiniBatchKMeans.__init__
sklearn.cluster.SpectralBiclustering.biclusters_
sklearn.cluster.SpectralCoclustering.biclusters_
sklearn.cluster._agglomerative.AgglomerativeClustering.__init__
sklearn.cluster._agglomerative.FeatureAgglomeration.__init__
sklearn.cluster._agglomerative.FeatureAgglomeration.fit_predict
sklearn.cluster._agglomerative._TREE_BUILDERS
sklearn.cluster._bicluster.SpectralBiclustering.biclusters_
Expand Down Expand Up @@ -2105,14 +2099,12 @@ sklearn.naive_bayes.Hidden
sklearn.naive_bayes.MultinomialNB.__init__
sklearn.naive_bayes.StrOptions
sklearn.naive_bayes._BaseDiscreteNB.__init__
sklearn.neighbors.DistanceMetric
sklearn.neighbors.NearestCentroid.__init__
sklearn.neighbors.VALID_METRICS
sklearn.neighbors.VALID_METRICS_SPARSE
sklearn.neighbors._base.VALID_METRICS
sklearn.neighbors._base.VALID_METRICS_SPARSE
sklearn.neighbors._binary_tree
sklearn.neighbors._distance_metric
sklearn.neighbors._nearest_centroid.NearestCentroid.__init__
sklearn.pipeline.FeatureUnion.__init__
sklearn.pipeline.Pipeline.__init__
Expand Down Expand Up @@ -2316,7 +2308,6 @@ sklearn.utils.is_scalar_nan
sklearn.utils.islice
sklearn.utils.issparse
sklearn.utils.metaestimators.attrgetter
sklearn.utils.metaestimators.if_delegate_has_method
sklearn.utils.multiclass.Sequence.index
sklearn.utils.multiclass.check_array
sklearn.utils.multiclass.dok_matrix
Expand Down
3 changes: 0 additions & 3 deletions stubs/sklearn/svm/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ LIBSVM_IMPL: list = ...
class BaseLibSVM(BaseEstimator, metaclass=ABCMeta):
_parameter_constraints: ClassVar[dict] = ...

# The order of these must match the integer values in LibSVM.
# XXX These are actually the same in the dense case. Need to factor
# this out.
_sparse_kernels: ClassVar[list] = ...

@abstractmethod
Expand Down
17 changes: 3 additions & 14 deletions stubs/sklearn/utils/metaestimators.pyi
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
import warnings
from abc import ABCMeta, abstractmethod
from collections.abc import Sequence
from contextlib import suppress as suppress
from operator import attrgetter as attrgetter
from typing import Any, Callable, ClassVar

import numpy as np
from typing import Any, ClassVar

from ..base import BaseEstimator
from ._available_if import _AvailableIfDescriptor, available_if
from ._available_if import available_if

__all__ = ["available_if", "if_delegate_has_method"]
__all__ = ["available_if"]

class _BaseComposition(BaseEstimator, metaclass=ABCMeta):
steps: ClassVar[list[Any]] = ...

@abstractmethod
def __init__(self) -> None: ...

# TODO(1.3) remove
class _IffHasAttrDescriptor(_AvailableIfDescriptor):
def __init__(self, fn, delegate_names, attribute_name) -> None: ...

# TODO(1.3) remove
def if_delegate_has_method(delegate: tuple[str, ...] | str | Sequence[str]) -> Callable: ...
Loading