GerbenBeintema / deepSI

Dynamical System Identification using python incorporating numerous powerful deep learning methods. (deepSI = deep System Identification)
Other
43 stars 16 forks source link

Fix initialization of SS_linear #10

Closed Enderdead closed 6 months ago

Enderdead commented 8 months ago

The actual version of deepSI provide a bad behavior with the SS_linear constructor.

This is a little example to hightight the problem:

import deepSI as  deepSI
import numpy as np 

system = deepSI.fit_systems.SS_linear(A=np.array([[0.9,0.1],[0.0,0.7]]), B=np.array([[1,0.0],[0.0, 2]]),
                                      C=np.array([[1.0,2.],[0.0,1.0]]), k0=3)

print("ny : ", system.ny)
print("nu : ", system.nu)

Actual output:

ny :  None
nu :  None

The problem here is that even if we initialize SS_linear.ny and SS_linear.nu line 262, an override is done with the System_ss constructor that uses it's default kwargs parameters (see 470)

I just pass the computed nu and ny to the constructor of System_ss to fix the problem.

New output with the fix:

ny :  2
nu :  2

Thank you for considering this fix. Best regards,