watex.utils.funcutils.get_confidence_ratio#

watex.utils.funcutils.get_confidence_ratio(ar, /, axis=0, invalid='NaN')[source]#

Get ratio of confidence in array by counting the number of invalid values.

Parameters:
  • ar (arraylike 1D or 2D) – array for checking the ratio of confidence

  • axis (int, default=0,) – Compute the ratio of confidence alongside the rows by defaults.

  • invalid (int, foat, default='NaN') – The value to consider as invalid in the data might be listed if applicable. The default is NaN.

Returns:

ratio – The ratio of confidence array alongside the axis.

Return type:

arraylike 1D

Examples

>>> import numpy as np
>>> np.random.seed (0)
>>> test = np.random.randint (1, 20 , 10 ).reshape (5, 2 )
>>> test
array([[13, 16],
       [ 1,  4],
       [ 4,  8],
       [10, 19],
       [ 5,  7]])
>>> from watex.utils.funcutils import get_confidence_ratio
>>> get_confidence_ratio (test)
>>> array([1., 1.])
>>> get_confidence_ratio (test, invalid= ( 13, 19) )
array([0.8, 0.8])
>>> get_confidence_ratio (test, invalid= ( 13, 19, 4) )
array([0.6, 0.6])
>>> get_confidence_ratio (test, invalid= ( 13, 19, 4), axis =1 )
array([0.5, 0.5, 0.5, 0.5, 1. ])