A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scikit-learn.org/dev/developers/../modules/generated/sklearn.utils.assert_all_finite.html below:

assert_all_finite — scikit-learn 1.8.dev0 documentation

assert_all_finite#
sklearn.utils.assert_all_finite(X, *, allow_nan=False, estimator_name=None, input_name='')[source]#

Throw a ValueError if X contains NaN or infinity.

Parameters:
X{ndarray, sparse matrix}

The input data.

allow_nanbool, default=False

If True, do not throw error when X contains NaN.

estimator_namestr, default=None

The estimator name, used to construct the error message.

input_namestr, default=””

The data name used to construct the error message. In particular if input_name is “X” and the data has NaN values and allow_nan is False, the error message will link to the imputer documentation.

Examples

>>> from sklearn.utils import assert_all_finite
>>> import numpy as np
>>> array = np.array([1, np.inf, np.nan, 4])
>>> try:
...     assert_all_finite(array)
...     print("Test passed: Array contains only finite values.")
... except ValueError:
...     print("Test failed: Array contains non-finite values.")
Test failed: Array contains non-finite values.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4