CPCLAB-UNIPI / SIPPY

Systems Identification Package for PYthon
GNU Lesser General Public License v3.0
269 stars 92 forks source link

rescale method of functionset.py error #24

Open andialles opened 3 years ago

andialles commented 3 years ago

the rescale method of functionset.py errors if stdev == 0.

def rescale(y): ystd = np.std(y) if ystd != 0: y_scaled = old_div(y, ystd) else: y_scaled = y return ystd, y_scaled

fixes it for me. idk if this is desired behavior.

EDIT: Found a second occurrence of the problem in lines 205ff. Fix: for j in range(m): if Ustd[j] != 0: B[:, j] = old_div(B[:, j], Ustd[j]) D[:, j] = old_div(D[:, j], Ustd[j])

RBdC commented 3 years ago

Dear andialles, thank you very much for your post and your interest in Sippy. Your simple solution actually fixes the problem, but it is not definitive. Please note that system identification should be avoided when input/output data are low informative, that is, when the standard deviation of even one input/output vector is equal (or very close to) zero. It will be our our care to solve this issue by implementing a function that checks stdev of I/O data, and then rejects to perform sys-id (and/or emits a warning) below a suitable threshold value. We will release this update in the next future All the best Sippy Team