gzscore(a, *, axis=0, ddof=0, nan_policy='propagate')
Compute the geometric z score of each strictly positive value in the sample, relative to the geometric mean and standard deviation. Mathematically the geometric z score can be evaluated as
gzscore = log(a/gmu) / log(gsigma)
where gmu (resp. gsigma) is the geometric mean (resp. standard deviation).
This function preserves ndarray subclasses, and works also with matrices and masked arrays (it uses asanyarray instead of asarray for parameters).
Sample data.
Axis along which to operate. Default is 0. If None, compute over the whole array a.
Degrees of freedom correction in the calculation of the standard deviation. Default is 0.
Defines how to handle when input contains nan. 'propagate' returns nan, 'raise' throws an error, 'omit' performs the calculations ignoring nan values. Default is 'propagate'. Note that when the value is 'omit', nans in the input also propagate to the output, but they do not affect the geometric z scores computed for the non-nan values.
The geometric z scores, standardized by geometric mean and geometric standard deviation of input array a.
Compute the geometric standard score.
gmean
gstd
zscore
import numpy as np
from scipy.stats import zscore, gzscore
import matplotlib.pyplot as plt
rng = np.random.default_rng()
mu, sigma = 3., 1. # mean and standard deviation
x = rng.lognormal(mu, sigma, size=500)
fig, ax = plt.subplots()
ax.hist(x, 50)
plt.show()
fig, ax = plt.subplots()
ax.hist(zscore(x), 50)
plt.show()
fig, ax = plt.subplots()
ax.hist(gzscore(x), 50)
plt.show()
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them