Created
January 28, 2023 22:21
-
-
Save mweinelt/e62e82595a30eeb79946d35131ecb970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
umap-learn> ============================= test session starts ============================== | |
umap-learn> platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0 | |
umap-learn> rootdir: /build/source | |
umap-learn> collecting ... 2023-01-28 22:09:52.880147: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX | |
umap-learn> To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. | |
umap-learn> collected 199 items / 4 deselected / 195 selected | |
umap-learn> | |
umap-learn> umap/tests/test_aligned_umap.py ... [ 1%] | |
umap-learn> umap/tests/test_chunked_parallel_spatial_metric.py sssssssssssssssssssss [ 12%] | |
umap-learn> sssssssssssssssssssss [ 23%] | |
umap-learn> umap/tests/test_composite_models.py .s.. [ 25%] | |
umap-learn> umap/tests/test_densmap.py .s. [ 26%] | |
umap-learn> umap/tests/test_parametric_umap.py ...... [ 29%] | |
umap-learn> umap/tests/test_umap_metrics.py ..................FFFFFFFFFFFFFFFFF..... [ 50%] | |
umap-learn> . [ 50%] | |
umap-learn> umap/tests/test_umap_nn.py ..sssssss.. [ 56%] | |
umap-learn> umap/tests/test_umap_on_iris.py ........... [ 62%] | |
umap-learn> umap/tests/test_umap_ops.py ..................F [ 71%] | |
umap-learn> umap/tests/test_umap_repeated_data.py ......... [ 76%] | |
umap-learn> umap/tests/test_umap_trustworthiness.py .......... [ 81%] | |
umap-learn> umap/tests/test_umap_validation_params.py .............................. [ 96%] | |
umap-learn> ...... [100%] | |
umap-learn> | |
umap-learn> =================================== FAILURES =================================== | |
umap-learn> ____________________________ test_sparse_euclidean _____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_euclidean(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("euclidean", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:245: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2039: in pairwise_distances | |
umap-learn> return _parallel_pairwise(X, Y, func, n_jobs, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:1579: in _parallel_pairwise | |
umap-learn> return func(X, Y, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:300: in euclidean_distances | |
umap-learn> X, Y = check_pairwise_arrays(X, Y) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_manhattan _____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_manhattan(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("manhattan", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:249: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2039: in pairwise_distances | |
umap-learn> return _parallel_pairwise(X, Y, func, n_jobs, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:1579: in _parallel_pairwise | |
umap-learn> return func(X, Y, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:948: in manhattan_distances | |
umap-learn> X, Y = check_pairwise_arrays(X, Y) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_chebyshev _____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_chebyshev(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("chebyshev", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:253: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_minkowski _____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_minkowski(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("minkowski", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:257: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> _____________________________ test_sparse_hamming ______________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_hamming(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("hamming", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:261: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> _____________________________ test_sparse_canberra _____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_canberra(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("canberra", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:265: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ______________________________ test_sparse_cosine ______________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_cosine(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("cosine", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:269: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2039: in pairwise_distances | |
umap-learn> return _parallel_pairwise(X, Y, func, n_jobs, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:1579: in _parallel_pairwise | |
umap-learn> return func(X, Y, **kwds) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:1000: in cosine_distances | |
umap-learn> S = cosine_similarity(X, Y) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:1393: in cosine_similarity | |
umap-learn> X, Y = check_pairwise_arrays(X, Y) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ___________________________ test_sparse_correlation ____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_correlation(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("correlation", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:273: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_braycurtis ____________________________ | |
umap-learn> | |
umap-learn> sparse_spatial_data = <12x20 sparse matrix of type '<class 'numpy.float64'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_braycurtis(sparse_spatial_data): | |
umap-learn> > sparse_spatial_check("braycurtis", sparse_spatial_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:277: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:125: in sparse_spatial_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_spatial_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[ 0. , 0. , 0. , 0.3154439 , -0.90423903, | |
umap-learn> 0. , -1.2634011 , -0.742659... , 0. , 0. , 0. , | |
umap-learn> 0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> _____________________________ test_sparse_jaccard ______________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_jaccard(sparse_binary_data): | |
umap-learn> > sparse_binary_check("jaccard", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:286: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> _____________________________ test_sparse_matching _____________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_matching(sparse_binary_data): | |
umap-learn> > sparse_binary_check("matching", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:290: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> _______________________________ test_sparse_dice _______________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_dice(sparse_binary_data): | |
umap-learn> > sparse_binary_check("dice", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:294: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_kulsinski _____________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_kulsinski(sparse_binary_data): | |
umap-learn> > sparse_binary_check("kulsinski", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:298: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> __________________________ test_sparse_rogerstanimoto __________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_rogerstanimoto(sparse_binary_data): | |
umap-learn> > sparse_binary_check("rogerstanimoto", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:302: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ____________________________ test_sparse_russellrao ____________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_russellrao(sparse_binary_data): | |
umap-learn> > sparse_binary_check("russellrao", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:306: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> __________________________ test_sparse_sokalmichener ___________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_sokalmichener(sparse_binary_data): | |
umap-learn> > sparse_binary_check("sokalmichener", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:310: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ___________________________ test_sparse_sokalsneath ____________________________ | |
umap-learn> | |
umap-learn> sparse_binary_data = <12x20 sparse matrix of type '<class 'numpy.bool_'>' | |
umap-learn> with 72 stored elements in Compressed Sparse Row format> | |
umap-learn> | |
umap-learn> def test_sparse_sokalsneath(sparse_binary_data): | |
umap-learn> > sparse_binary_check("sokalsneath", sparse_binary_data) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py:314: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/tests/test_umap_metrics.py:144: in sparse_binary_check | |
umap-learn> dist_matrix = pairwise_distances(sparse_binary_data.todense(), metric=metric) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:2027: in pairwise_distances | |
umap-learn> X, Y = check_pairwise_arrays( | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/metrics/pairwise.py:146: in check_pairwise_arrays | |
umap-learn> X = Y = check_array( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> array = matrix([[False, False, False, True, True, False, True, True, False, | |
umap-learn> True, True, False, False, False, Fa..., False, False, False, | |
umap-learn> False, False, False, False, False, False, False, False, False, | |
umap-learn> False, False]]) | |
umap-learn> accept_sparse = 'csr' | |
umap-learn> | |
umap-learn> def check_array( | |
umap-learn> array, | |
umap-learn> accept_sparse=False, | |
umap-learn> *, | |
umap-learn> accept_large_sparse=True, | |
umap-learn> dtype="numeric", | |
umap-learn> order=None, | |
umap-learn> copy=False, | |
umap-learn> force_all_finite=True, | |
umap-learn> ensure_2d=True, | |
umap-learn> allow_nd=False, | |
umap-learn> ensure_min_samples=1, | |
umap-learn> ensure_min_features=1, | |
umap-learn> estimator=None, | |
umap-learn> input_name="", | |
umap-learn> ): | |
umap-learn> | |
umap-learn> """Input validation on an array, list, sparse matrix or similar. | |
umap-learn> | |
umap-learn> By default, the input is checked to be a non-empty 2D array containing | |
umap-learn> only finite values. If the dtype of the array is object, attempt | |
umap-learn> converting to float, raising on failure. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> array : object | |
umap-learn> Input object to check / convert. | |
umap-learn> | |
umap-learn> accept_sparse : str, bool or list/tuple of str, default=False | |
umap-learn> String[s] representing allowed sparse matrix formats, such as 'csc', | |
umap-learn> 'csr', etc. If the input is sparse but not in the allowed format, | |
umap-learn> it will be converted to the first listed format. True allows the input | |
umap-learn> to be any format. False means that a sparse matrix input will | |
umap-learn> raise an error. | |
umap-learn> | |
umap-learn> accept_large_sparse : bool, default=True | |
umap-learn> If a CSR, CSC, COO or BSR sparse matrix is supplied and accepted by | |
umap-learn> accept_sparse, accept_large_sparse=False will cause it to be accepted | |
umap-learn> only if its indices are stored with a 32-bit dtype. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> | |
umap-learn> dtype : 'numeric', type, list of type or None, default='numeric' | |
umap-learn> Data type of result. If None, the dtype of the input is preserved. | |
umap-learn> If "numeric", dtype is preserved unless array.dtype is object. | |
umap-learn> If dtype is a list of types, conversion on the first type is only | |
umap-learn> performed if the dtype of the input is not in the list. | |
umap-learn> | |
umap-learn> order : {'F', 'C'} or None, default=None | |
umap-learn> Whether an array will be forced to be fortran or c-style. | |
umap-learn> When order is None (default), then if copy=False, nothing is ensured | |
umap-learn> about the memory layout of the output array; otherwise (copy=True) | |
umap-learn> the memory layout of the returned array is kept as close as possible | |
umap-learn> to the original array. | |
umap-learn> | |
umap-learn> copy : bool, default=False | |
umap-learn> Whether a forced copy will be triggered. If copy=False, a copy might | |
umap-learn> be triggered by a conversion. | |
umap-learn> | |
umap-learn> force_all_finite : bool or 'allow-nan', default=True | |
umap-learn> Whether to raise an error on np.inf, np.nan, pd.NA in array. The | |
umap-learn> possibilities are: | |
umap-learn> | |
umap-learn> - True: Force all values of array to be finite. | |
umap-learn> - False: accepts np.inf, np.nan, pd.NA in array. | |
umap-learn> - 'allow-nan': accepts only np.nan and pd.NA values in array. Values | |
umap-learn> cannot be infinite. | |
umap-learn> | |
umap-learn> .. versionadded:: 0.20 | |
umap-learn> ``force_all_finite`` accepts the string ``'allow-nan'``. | |
umap-learn> | |
umap-learn> .. versionchanged:: 0.23 | |
umap-learn> Accepts `pd.NA` and converts it into `np.nan` | |
umap-learn> | |
umap-learn> ensure_2d : bool, default=True | |
umap-learn> Whether to raise a value error if array is not 2D. | |
umap-learn> | |
umap-learn> allow_nd : bool, default=False | |
umap-learn> Whether to allow array.ndim > 2. | |
umap-learn> | |
umap-learn> ensure_min_samples : int, default=1 | |
umap-learn> Make sure that the array has a minimum number of samples in its first | |
umap-learn> axis (rows for a 2D array). Setting to 0 disables this check. | |
umap-learn> | |
umap-learn> ensure_min_features : int, default=1 | |
umap-learn> Make sure that the 2D array has some minimum number of features | |
umap-learn> (columns). The default value of 1 rejects empty datasets. | |
umap-learn> This check is only enforced when the input data has effectively 2 | |
umap-learn> dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 | |
umap-learn> disables this check. | |
umap-learn> | |
umap-learn> estimator : str or estimator instance, default=None | |
umap-learn> If passed, include the name of the estimator in warning messages. | |
umap-learn> | |
umap-learn> input_name : str, default="" | |
umap-learn> The data name used to construct the error message. In particular | |
umap-learn> if `input_name` is "X" and the data has NaN values and | |
umap-learn> allow_nan is False, the error message will link to the imputer | |
umap-learn> documentation. | |
umap-learn> | |
umap-learn> .. versionadded:: 1.1.0 | |
umap-learn> | |
umap-learn> Returns | |
umap-learn> ------- | |
umap-learn> array_converted : object | |
umap-learn> The converted and validated array. | |
umap-learn> """ | |
umap-learn> if isinstance(array, np.matrix): | |
umap-learn> > raise TypeError( | |
umap-learn> "np.matrix is not supported. Please convert to a numpy array with " | |
umap-learn> "np.asarray. For more information see: " | |
umap-learn> "https://numpy.org/doc/stable/reference/generated/numpy.matrix.html" | |
umap-learn> ) | |
umap-learn> E TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.html | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/validation.py:737: TypeError | |
umap-learn> ________________________ test_component_layout_options _________________________ | |
umap-learn> | |
umap-learn> nn_data = array([[0.77634894, 0.52528136, 0.97117066, 0.27605402, 0.74789432], | |
umap-learn> [0.07109226, 0.74870202, 0.57328734, 0.440... 0. , 0. , 0. , 0. ], | |
umap-learn> [0. , 0. , 0. , 0. , 0. ]]) | |
umap-learn> | |
umap-learn> def test_component_layout_options(nn_data): | |
umap-learn> dmat = pairwise_distances(nn_data[:1000]) | |
umap-learn> n_components = 5 | |
umap-learn> component_labels = np.repeat(np.arange(5), dmat.shape[0] // 5) | |
umap-learn> > single = component_layout( | |
umap-learn> dmat, | |
umap-learn> n_components, | |
umap-learn> component_labels, | |
umap-learn> 2, | |
umap-learn> np.random, | |
umap-learn> metric="precomputed", | |
umap-learn> metric_kwds={"linkage": "single"}, | |
umap-learn> ) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_ops.py:290: | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> umap/spectral.py:137: in component_layout | |
umap-learn> ).fit_transform(affinity_matrix) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/manifold/_spectral_embedding.py:713: in fit_transform | |
umap-learn> self.fit(X) | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/manifold/_spectral_embedding.py:675: in fit | |
umap-learn> self._validate_params() | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/base.py:581: in _validate_params | |
umap-learn> validate_parameter_constraints( | |
umap-learn> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
umap-learn> | |
umap-learn> parameter_constraints = {'affinity': [<sklearn.utils._param_validation.StrOptions object at 0x7ffbe1bedd50>, <built-in function callable>], 'e... object at 0x7ffbe1beda20>], 'gamma': [<sklearn.utils._param_validation.Interval object at 0x7ffbe1bedc60>, None], ...} | |
umap-learn> params = {'affinity': 'precomputed', 'eigen_solver': None, 'eigen_tol': 'auto', 'gamma': None, ...} | |
umap-learn> caller_name = 'SpectralEmbedding' | |
umap-learn> | |
umap-learn> def validate_parameter_constraints(parameter_constraints, params, caller_name): | |
umap-learn> """Validate types and values of given parameters. | |
umap-learn> | |
umap-learn> Parameters | |
umap-learn> ---------- | |
umap-learn> parameter_constraints : dict or {"no_validation"} | |
umap-learn> If "no_validation", validation is skipped for this parameter. | |
umap-learn> | |
umap-learn> If a dict, it must be a dictionary `param_name: list of constraints`. | |
umap-learn> A parameter is valid if it satisfies one of the constraints from the list. | |
umap-learn> Constraints can be: | |
umap-learn> - an Interval object, representing a continuous or discrete range of numbers | |
umap-learn> - the string "array-like" | |
umap-learn> - the string "sparse matrix" | |
umap-learn> - the string "random_state" | |
umap-learn> - callable | |
umap-learn> - None, meaning that None is a valid value for the parameter | |
umap-learn> - any type, meaning that any instance of this type is valid | |
umap-learn> - an Options object, representing a set of elements of a given type | |
umap-learn> - a StrOptions object, representing a set of strings | |
umap-learn> - the string "boolean" | |
umap-learn> - the string "verbose" | |
umap-learn> - the string "cv_object" | |
umap-learn> - the string "missing_values" | |
umap-learn> - a HasMethods object, representing method(s) an object must have | |
umap-learn> - a Hidden object, representing a constraint not meant to be exposed to the user | |
umap-learn> | |
umap-learn> params : dict | |
umap-learn> A dictionary `param_name: param_value`. The parameters to validate against the | |
umap-learn> constraints. | |
umap-learn> | |
umap-learn> caller_name : str | |
umap-learn> The name of the estimator or function or method that called this function. | |
umap-learn> """ | |
umap-learn> for param_name, param_val in params.items(): | |
umap-learn> # We allow parameters to not have a constraint so that third party estimators | |
umap-learn> # can inherit from sklearn estimators without having to necessarily use the | |
umap-learn> # validation tools. | |
umap-learn> if param_name not in parameter_constraints: | |
umap-learn> continue | |
umap-learn> | |
umap-learn> constraints = parameter_constraints[param_name] | |
umap-learn> | |
umap-learn> if constraints == "no_validation": | |
umap-learn> continue | |
umap-learn> | |
umap-learn> constraints = [make_constraint(constraint) for constraint in constraints] | |
umap-learn> | |
umap-learn> for constraint in constraints: | |
umap-learn> if constraint.is_satisfied_by(param_val): | |
umap-learn> # this constraint is satisfied, no need to check further. | |
umap-learn> break | |
umap-learn> else: | |
umap-learn> # No constraint is satisfied, raise with an informative message. | |
umap-learn> | |
umap-learn> # Ignore constraints that we don't want to expose in the error message, | |
umap-learn> # i.e. options that are for internal purpose or not officially supported. | |
umap-learn> constraints = [ | |
umap-learn> constraint for constraint in constraints if not constraint.hidden | |
umap-learn> ] | |
umap-learn> | |
umap-learn> if len(constraints) == 1: | |
umap-learn> constraints_str = f"{constraints[0]}" | |
umap-learn> else: | |
umap-learn> constraints_str = ( | |
umap-learn> f"{', '.join([str(c) for c in constraints[:-1]])} or" | |
umap-learn> f" {constraints[-1]}" | |
umap-learn> ) | |
umap-learn> | |
umap-learn> > raise InvalidParameterError( | |
umap-learn> f"The {param_name!r} parameter of {caller_name} must be" | |
umap-learn> f" {constraints_str}. Got {param_val!r} instead." | |
umap-learn> ) | |
umap-learn> E sklearn.utils._param_validation.InvalidParameterError: The 'random_state' parameter of SpectralEmbedding must be an int in the range [0, 4294967295], an instance of 'numpy.random.mtrand.RandomState' or None. Got <module 'numpy.random' from '/nix/store/jirzlk538n9bbbwp54rd9wcsb8nf3rf0-python3.10-numpy-1.23.5/lib/python3.10/site-packages/numpy/random/__init__.py'> instead. | |
umap-learn> | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/utils/_param_validation.py:97: InvalidParameterError | |
umap-learn> =============================== warnings summary =============================== | |
umap-learn> umap/tests/test_chunked_parallel_spatial_metric.py:234 | |
umap-learn> /build/source/umap/tests/test_chunked_parallel_spatial_metric.py:234: PytestUnknownMarkWarning: Unknown pytest.mark.benchmark - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html | |
umap-learn> @pytest.mark.benchmark( | |
umap-learn> | |
umap-learn> umap/tests/test_chunked_parallel_spatial_metric.py:258 | |
umap-learn> /build/source/umap/tests/test_chunked_parallel_spatial_metric.py:258: PytestUnknownMarkWarning: Unknown pytest.mark.benchmark - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html | |
umap-learn> @pytest.mark.benchmark( | |
umap-learn> | |
umap-learn> umap/tests/test_chunked_parallel_spatial_metric.py:288 | |
umap-learn> /build/source/umap/tests/test_chunked_parallel_spatial_metric.py:288: PytestUnknownMarkWarning: Unknown pytest.mark.benchmark - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html | |
umap-learn> @pytest.mark.benchmark( | |
umap-learn> | |
umap-learn> umap/tests/test_chunked_parallel_spatial_metric.py:312 | |
umap-learn> /build/source/umap/tests/test_chunked_parallel_spatial_metric.py:312: PytestUnknownMarkWarning: Unknown pytest.mark.benchmark - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html | |
umap-learn> @pytest.mark.benchmark( | |
umap-learn> | |
umap-learn> umap/plot.py:20 | |
umap-learn> /build/source/umap/plot.py:20: UserWarning: The umap.plot package requires extra plotting libraries to be installed. | |
umap-learn> You can install these via pip using | |
umap-learn> | |
umap-learn> pip install umap-learn[plot] | |
umap-learn> | |
umap-learn> or via conda using | |
umap-learn> | |
umap-learn> conda install pandas matplotlib datashader bokeh holoviews colorcet scikit-image | |
umap-learn> | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_aligned_umap.py::test_local_clustering | |
umap-learn> umap/tests/test_aligned_umap.py::test_local_clustering | |
umap-learn> umap/tests/test_umap_on_iris.py::test_umap_clusterability_on_supervised_iris | |
umap-learn> umap/tests/test_umap_ops.py::test_blobs_cluster | |
umap-learn> umap/tests/test_umap_ops.py::test_multi_component_layout | |
umap-learn> umap/tests/test_umap_ops.py::test_multi_component_layout_precomputed | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/cluster/_kmeans.py:870: FutureWarning: The default value of `n_init` will change from 10 to 'auto' in 1.4. Set the value of `n_init` explicitly to suppress the warning | |
umap-learn> warnings.warn( | |
umap-learn> | |
umap-learn> umap/tests/test_aligned_umap.py::test_aligned_update | |
umap-learn> /build/source/umap/aligned_umap.py:188: NumbaTypeSafetyWarning: unsafe cast from int64 to int32. Precision may be lost. | |
umap-learn> if i in relation_dict: | |
umap-learn> | |
umap-learn> umap/tests/test_parametric_umap.py::test_create_model | |
umap-learn> umap/tests/test_parametric_umap.py::test_global_loss | |
umap-learn> umap/tests/test_parametric_umap.py::test_inverse_transform | |
umap-learn> umap/tests/test_parametric_umap.py::test_nonparametric | |
umap-learn> umap/tests/test_parametric_umap.py::test_custom_encoder_decoder | |
umap-learn> umap/tests/test_parametric_umap.py::test_validation | |
umap-learn> /build/source/umap/parametric_umap.py:148: UserWarning: tensorflow_probability not installed or incompatible to current tensorflow installation. Setting global_correlation_loss_weight to zero. | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_parametric_umap.py::test_custom_encoder_decoder | |
umap-learn> umap/tests/test_parametric_umap.py::test_validation | |
umap-learn> /build/source/umap/parametric_umap.py:375: UserWarning: Data should be scaled to the range 0-1 for cross-entropy reconstruction loss. | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_metrics.py::test_hellinger | |
umap-learn> /build/source/umap/tests/test_umap_metrics.py:405: RuntimeWarning: invalid value encountered in sqrt | |
umap-learn> dist_matrix = np.sqrt(dist_matrix) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_transform_on_iris | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_sparse_transform_on_iris | |
umap-learn> umap/tests/test_umap_ops.py::test_multi_component_layout_precomputed | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[True-1] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[False-1] | |
umap-learn> umap/tests/test_umap_trustworthiness.py::test_sparse_precomputed_metric_umap_trustworthiness | |
umap-learn> umap/tests/test_umap_validation_params.py::test_umap_update_bad_params | |
umap-learn> /build/source/umap/umap_.py:1780: UserWarning: using precomputed metric; inverse_transform will be unavailable | |
umap-learn> warn("using precomputed metric; inverse_transform will be unavailable") | |
umap-learn> | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_transform_on_iris | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_sparse_transform_on_iris | |
umap-learn> /build/source/umap/umap_.py:2830: UserWarning: Transforming new data with precomputed metric. We are assuming the input data is a matrix of distances from the new points to the points in the training set. If the input matrix is sparse, it should contain distances from the new points to their nearest neighbours or approximate nearest neighbours in the training set. | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_sparse_transform_on_iris | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[True-1] | |
umap-learn> umap/tests/test_umap_trustworthiness.py::test_sparse_precomputed_metric_umap_trustworthiness | |
umap-learn> /build/source/umap/umap_.py:2378: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information. | |
umap-learn> Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations | |
umap-learn> (X.shape[0], self.n_neighbors), dtype=np.int | |
umap-learn> | |
umap-learn> umap/tests/test_umap_on_iris.py::test_precomputed_sparse_transform_on_iris | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[True-1] | |
umap-learn> umap/tests/test_umap_trustworthiness.py::test_sparse_precomputed_metric_umap_trustworthiness | |
umap-learn> /build/source/umap/umap_.py:2380: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. | |
umap-learn> Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations | |
umap-learn> self._knn_dists = np.zeros(self._knn_indices.shape, dtype=np.float) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_ops.py::test_multi_component_layout | |
umap-learn> umap/tests/test_umap_ops.py::test_multi_component_layout_precomputed | |
umap-learn> /nix/store/5l733c5yjbmkd53d0nd35aln9jmpka8y-python3.10-scikit-learn-1.2.1/lib/python3.10/site-packages/sklearn/manifold/_spectral_embedding.py:274: UserWarning: Graph is not fully connected, spectral embedding may not work as expected. | |
umap-learn> warnings.warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[True-jaccard-1] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[True-jaccard-5] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[True-hellinger-1] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[True-hellinger-5] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[False-jaccard-1] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[False-jaccard-5] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[False-hellinger-1] | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data[False-hellinger-5] | |
umap-learn> /nix/store/z5pkmmsdg3bmb35pmsv4rjca1qi7dbnf-python3.10-pytest-7.2.0/lib/python3.10/site-packages/_pytest/python.py:195: PytestRemovedIn8Warning: Passing None has been deprecated. | |
umap-learn> See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases. | |
umap-learn> result = testfunction(**testargs) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[True-1] | |
umap-learn> /build/source/umap/umap_.py:125: UserWarning: A few of your vertices were disconnected from the manifold. This shouldn't cause problems. | |
umap-learn> Disconnection_distance = 1 has removed 3 edges. | |
umap-learn> It has only fully disconnected 1 vertices. | |
umap-learn> Use umap.utils.disconnected_vertices() to identify them. | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_ops.py::test_disconnected_data_precomputed[False-1] | |
umap-learn> /build/source/umap/umap_.py:125: UserWarning: A few of your vertices were disconnected from the manifold. This shouldn't cause problems. | |
umap-learn> Disconnection_distance = 1 has removed 22 edges. | |
umap-learn> It has only fully disconnected 1 vertices. | |
umap-learn> Use umap.utils.disconnected_vertices() to identify them. | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_repeated_data.py::test_repeated_points_large_sparse_spatial | |
umap-learn> umap/tests/test_umap_repeated_data.py::test_repeated_points_small_sparse_spatial | |
umap-learn> umap/tests/test_umap_repeated_data.py::test_repeated_points_large_sparse_binary | |
umap-learn> umap/tests/test_umap_repeated_data.py::test_repeated_points_small_sparse_binary | |
umap-learn> /nix/store/jirzlk538n9bbbwp54rd9wcsb8nf3rf0-python3.10-numpy-1.23.5/lib/python3.10/site-packages/numpy/lib/arraysetops.py:272: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. | |
umap-learn> ar = np.asanyarray(ar) | |
umap-learn> | |
umap-learn> umap/tests/test_umap_repeated_data.py::test_repeated_points_large_n | |
umap-learn> umap/tests/test_umap_validation_params.py::test_umap_too_many_neighbors_warns | |
umap-learn> umap/tests/test_umap_validation_params.py::test_umap_inverse_transform_fails_expectedly | |
umap-learn> /build/source/umap/umap_.py:2344: UserWarning: n_neighbors is larger than the dataset size; truncating to X.shape[0] - 1 | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> umap/tests/test_umap_validation_params.py::test_umap_inverse_transform_fails_expectedly | |
umap-learn> /build/source/umap/umap_.py:1802: UserWarning: gradient function is not yet implemented for dice distance metric; inverse_transform will be unavailable | |
umap-learn> warn( | |
umap-learn> | |
umap-learn> -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html | |
umap-learn> =========================== short test summary info ============================ | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_euclidean - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_manhattan - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_chebyshev - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_minkowski - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_hamming - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_canberra - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_cosine - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_correlation - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_braycurtis - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_jaccard - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_matching - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_dice - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_kulsinski - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_rogerstanimoto - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_russellrao - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_sokalmichener - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_metrics.py::test_sparse_sokalsneath - TypeError: np.matrix is not supported. Please convert to a numpy array with... | |
umap-learn> FAILED umap/tests/test_umap_ops.py::test_component_layout_options - sklearn.utils._param_validation.InvalidParameterError: The 'random_state' p... | |
umap-learn> = 18 failed, 126 passed, 51 skipped, 4 deselected, 56 warnings in 575.50s (0:09:35) = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment