You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #150 we should write a xarray wrapper for the numpy based auto regression prediction. It is not yet entirely clear to me how this should look, though.
The text was updated successfully, but these errors were encountered:
_fit_auto_regression_xr and _draw_auto_regression_correlated_np don't work together super smoothly yet. This is how we can make it work:
importmesmerimportnumpyasnpimportxarrayasxrair=xr.tutorial.open_dataset("air_temperature")
# a 2D array is required - would be a flattened (unstructured) grid# for simplicity use one row of longitudes data=air.air.isel(lat=0)
params=mesmer.stats.auto_regression._fit_auto_regression_xr(data, dim="time", lags=2)
mesmer.stats.auto_regression._draw_auto_regression_correlated_np(
intercept=params.intercept.values,
coeffs=params.coeffs.T.values, # unfortunate...covariance=np.diag(params.covariance), # diag to ensure cov is invertible n_samples=3,
n_ts=50,
seed=0,
buffer=20,
)
_fit_auto_regression_xr and _draw_auto_regression_correlated_np don't work together super smoothly yet.
This already works better after #306. Maybe we should also transform the coeffs?
What bugs me, though - how to we populate the resulting DataArray how can we pass dimension names and coordinates? This is further complicated by the fact that I expect coords for the time dim but not for the sample dim. Also is sample a good name?
After #150 we should write a xarray wrapper for the numpy based auto regression prediction. It is not yet entirely clear to me how this should look, though.
The text was updated successfully, but these errors were encountered: