Skip to content

LINOCS to share. Code for Mudrik, N., Yezerets, E., Chen, Y., Rozell, C., & Charles, A. (2024). Linocs: Lookahead inference of networked operators for continuous stability. arXiv preprint arXiv:2404.18267.

Notifications You must be signed in to change notification settings

NogaMudrik/LINOCS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LINOCS

Code for Mudrik, N., Yezerets, E., Chen, Y., Rozell, C., & Charles, A. (2024). Linocs: Lookahead inference of networked operators for continuous stability. arXiv preprint arXiv:2404.18267. Accepted at TMLR (Sep. 2024).

General main functions:

Main Functions (for LINOCS and plotting):

_main_functions_lookahead_linocs.py_

Basic functions (unrelated basic functions to use):

_basic_function_lookahead.py_

image

How to run?

EXAMPLE 1: LINEAR EXPERIMENT WITH OFFSET

image

K_b = 20
max_ord = 250

func_w = np.exp
sigma_w = 0.01
w = [] 
sigma_w_b = 1
w_b = [] 

opt_A, opt_b,b_hats = train_linear_system_opt_A(x_noisy, max_ord, Bs_main = [], constraint = [], w_offset = True, cal_offset=True, weights=w, infer_b_way='each', K_b = K_b, w_b = w_b
                              )
offset_hat_opt = np.mean(opt_b, 1)

"""
full lookahead prediction
"""
x_look_LINOCS = propagate_dyn_based_on_operator(x0,opt_A, offset = offset_hat_opt, max_t = T)

"""
1-step prediction
"""
x_step_LINOCS = one_step_prediction(x_noisy, np.dstack([opt_A]*T), offset = offset_hat_opt)

1-step vs. LINOCS

image

MSE

image

Test different training and prediction orders

image

Example 2 - dLDS-LINOCS:

See demo/tutorial in notebook https://github.com/NogaMudrik/LINOCS/blob/main/run_dLDS_Lorenz_example.ipynb

importantly, this requires installing pylops version 1.18.2:

!pip install pylops==1.18.2

To train dLDS:

np.random.seed(seed)
M = np.random.randint(3, 10)    
K = np.random.randint(1, 5)    
l1 = np.random.rand()*0.2 #1.2 # 0.9# 2 #  #5
decor_w = np.random.rand()*0.1
max_iters = 70
save_path = os.getcwd()
start_l1 = np.random.randint(0, 5)
start_l1  = np.random.choice([start_l1 , 0])

data_run = lorenz_mat


    
l2_F = np.random.rand()
freq_update_F = 5
cs_h, F_h, F_full_h, cs_full_h = train_dlds_LINOCS(data_run, F0 = [], M = M, max_iters = max_iters, l1 = l1, 
                                                   to_save = True, save_path = save_path, 
                                                    seed = seed, start_l1 = start_l1, K = K,freq_save = 1,
                                                   l1_int = 1,freq_update_F = freq_update_F,
                                                    interval_round = 1, l2_F = l2_F,  with_identity =  with_identity, decor = decor, addi_save = 'example', decor_w = decor_w 
                                    )

some results from applying dLDS-LINOCS on the Lorenz attractor:

LINOCS vs. 1-step

image image

sub-dynamics (as identified by LINOCS)

image

the associated coefficients

image image

Reconstructions with marking of active sub-dynamics

image

Lorenz x-values on identified $c$-space

image image

About

LINOCS to share. Code for Mudrik, N., Yezerets, E., Chen, Y., Rozell, C., & Charles, A. (2024). Linocs: Lookahead inference of networked operators for continuous stability. arXiv preprint arXiv:2404.18267.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published