RJT1990 / pyflux

Open source time series library for Python
BSD 3-Clause "New" or "Revised" License
2.1k stars 240 forks source link

getting fitted values and residuals #88

Open wgmueller1 opened 7 years ago

wgmueller1 commented 7 years ago

Is there a better way to get the fitted values and residuals after fitting a model? I used the following code from plot_fit

mu,Y=model._model(model.latent_variables.get_z_values()) values=model.link(mu)

it would be nice if you could just do model.fit().residuals or model.fit().fitted or something like that.

RJT1990 commented 7 years ago

Hi Graham - agreed, it would be nice to make this easier rather than having to construct manually. The results objects are also in need of further documentation, so will make a note of that. For the meantime, the results objects do contain some properties of the model - such as model.fit().signal, model.fit().states, model.fit().data - but will look to document this and add some more properties (like residuals).

yuiant commented 6 years ago

Hello,I am a new hand on pyflux. mu,Y=model._model(model.latent_variables.get_z_values()) mu is the fitted values?

bastien-unchartech commented 5 years ago

Hi, Is there any update on this post ? I am struggling to get the residuals of a fitted model. As far as i'm concerned, model.link(mu) does not work. The function link is unknown., i get the following error: object has no attribute 'link'