CompStats.measurements¶
- CI(samples: ndarray, alpha=0.05)[source]¶
Compute the Confidence Interval of a statistic using bootstrap. :param samples: Bootstrap samples :type samples: np.ndarray :param alpha: \([\frac{\alpha}{2}, 1 - \frac{\alpha}{2}]\). :type alpha: float
>>> from CompStats import StatisticSamples, CI >>> from sklearn.metrics import accuracy_score >>> import numpy as np >>> labels = np.r_[[0, 0, 0, 0, 0, 1, 1, 1, 1, 1]] >>> pred = np.r_[[0, 0, 1, 0, 0, 1, 1, 1, 0, 1]] >>> bootstrap = StatisticSamples(statistic=accuracy_score) >>> samples = bootstrap(labels, pred) >>> CI(samples) (0.6, 1.0)
- SE(samples: ndarray)[source]¶
Compute the Standard Error of a statistic using bootstrap.
>>> from CompStats import StatisticSamples, SE >>> from sklearn.metrics import accuracy_score >>> import numpy as np >>> labels = np.r_[[0, 0, 0, 0, 0, 1, 1, 1, 1, 1]] >>> pred = np.r_[[0, 0, 1, 0, 0, 1, 1, 1, 0, 1]] >>> bootstrap = StatisticSamples(statistic=accuracy_score) >>> samples = bootstrap(labels, pred) >>> SE(samples)