Update example_03_chaos_mode.py

This commit is contained in:
PSBigBig 2025-06-11 20:42:14 +08:00 committed by GitHub
parent 24f2a34681
commit ecad664a93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,19 +1,13 @@
# example_03_chaos_mode.py
# Exaggerated noise / γ to test stability limits
# examples/example_03_chaos_mode.py
import numpy as np, wfgy_sdk as w
rng = np.random.default_rng(3)
engine = w.get_engine(reload=True) # fresh state
eng = w.get_engine(reload=True)
eng.gamma = 0.9
I, G = np.random.randn(256), np.random.randn(256)
logits = np.random.randn(4096)
G = rng.normal(size=256); G /= np.linalg.norm(G)
I = G + rng.normal(scale=0.1, size=256) # larger noise
logits = rng.normal(size=8192)
# Temporarily tweak parameters
engine.gamma = 0.9 # stronger attenuation
state = engine.run(
input_vec=I,
ground_vec=G,
logits=logits,
window_size=7, # local variance mode
return_all=True
)
state = eng.run(input_vec=I, ground_vec=G, logits=logits, return_all=True)
print(f"Chaos mode — ‖B‖={state['B_norm']:.3f} | f_S={state['f_S']:.3f}")