Replies: 3 comments 2 replies
-
Hi @Murk89 — could you rework the example consistent with #5404? Thank you |
Beta Was this translation helpful? Give feedback.
-
Hi @Murk89 To do that modify this part of the code: def regress (x,y):
ols= linear_model.LinearRegression(),
model = ols.fit(x.reshape(1, -1), y.reshape(1, -1)),
return [model.score, model.coef_ , model.intercept_] Hope this fixes your issue |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to apply the ordinary least squares model from pythons's sklearn, to every gridbox of my dataset called 'merged'
This error comes up:
ValueError: Expected 2D array, got 1D array instead:
array=[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Would really appreciate some help with this error or an idea of how to apply multivariate regression using xarray's apply_ufunc
Beta Was this translation helpful? Give feedback.
All reactions