pyuoi.utils
Utility functions for the pyuoi
package.
Scoring Utilities
- pyuoi.utils.AICc(ll, n_features, n_samples)[source]
Calculate the corrected Akaike Information Criterion. This criterion is useful in cases when the number of samples is small.
If the number of features is equal to the number of samples plus one, then the AIC is returned (the AICc is undefined in this case).
- pyuoi.utils.log_likelihood_glm(model, y_true, y_pred)[source]
Calculates the log-likelihood of a generalized linear model given the true response variables and the “predicted” response variables. The “predicted” response variable varies by the specific generalized linear model under consideration.
- Parameters
model (string) – The generalized linear model to calculate the log-likelihood for.
y_true (nd-array, shape (n_samples,)) – Array of true response values.
y_pred (nd-array, shape (n_samples,)) – Array of predicted response values (conditional mean).
- Returns
ll – The log-likelihood.
- Return type
Other Utilities
- pyuoi.utils.sigmoid(x)[source]
Calculates the bernoulli distribution.
- Parameters
x (ndarray) – Log-probabilities.
- pyuoi.utils.softmax(y, axis=- 1)[source]
Calculates the softmax distribution.
- Parameters
y (ndarray) – Log-probabilities.