4

mca_23_nestmom

 2 years ago
source link: https://gist.github.com/h3ik0th/fd93ad4cda4c1e4f25183b01ca290023
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
mca_23_nestmom · GitHub

Instantly share code, notes, and snippets.

# moments mean = rand_CL.mean() s = rand_CL.std() min = rand_CL.min() max = rand_CL.max() skew = np.asscalar(stats.skew(rand_CL)) kurt = np.asscalar(stats.kurtosis(rand_CL))

moments = {"mean":mean, "std":s, "min":min, "max":max, "skew":skew, "kurt":kurt} _ = [print(k,":",f'{v:.3f}') for k,v in moments.items()]

# quantiles q1 = np.array([0.001, 0.01, 0.99, 0.999]) q2 = np.arange(0.05, 0.95, 0.05) q = np.concatenate((q1,q2)) q.sort() xq = np.quantile(rand_CL, q) quantiles = dict(zip(q,xq)) print("\nquantiles:") _ = [print(f'{q:.3f}',":",f'{xq:,.0f}') for q,xq in quantiles.items()]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK