home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 671609109 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, created_at (date), updated_at (date)

user 6

  • AndrewILWilliams 3
  • clausmichele 2
  • shoyer 1
  • aulemahal 1
  • TomNicholas 1
  • slevang 1

author_association 2

  • CONTRIBUTOR 7
  • MEMBER 2

issue 1

  • General curve fitting method · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
770133047 https://github.com/pydata/xarray/issues/4300#issuecomment-770133047 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDc3MDEzMzA0Nw== slevang 39069044 2021-01-30T01:38:18Z 2021-01-30T01:38:18Z CONTRIBUTOR

I needed this functionality for a project, and piggy-backing off the last couple of comments decided the curve_fit wrapped by apply_ufunc approach works quite well. I put together a PR in #4849. Any feedback welcome!

{
    "total_count": 2,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 2,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
677666962 https://github.com/pydata/xarray/issues/4300#issuecomment-677666962 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3NzY2Njk2Mg== clausmichele 31700619 2020-08-20T13:32:33Z 2020-08-20T13:40:07Z CONTRIBUTOR

cheers @TomNicholas , that's helpful. :) I've started messing with the idea in this Gist if you want to have a look.

It's pretty hacky at the moment, but might be helpful as a testbed. (And a way of getting my head around how apply_ufunc would work in this context)

@AndrewWilliams3142 I've tried to extend this to a 3d matrix (timeseries of 2d matrices) using Dask, it seems to work! Have a look here https://gist.github.com/clausmichele/8350e1f7f15e6828f29579914276de71

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
673593388 https://github.com/pydata/xarray/issues/4300#issuecomment-673593388 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3MzU5MzM4OA== AndrewILWilliams 56925856 2020-08-13T16:59:30Z 2020-08-13T16:59:30Z CONTRIBUTOR

cheers @TomNicholas , that's helpful. :) I've started messing with the idea in this Gist if you want to have a look.

It's pretty hacky at the moment, but might be helpful as a testbed. (And a way of getting my head around how apply_ufunc would work in this context)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
672987876 https://github.com/pydata/xarray/issues/4300#issuecomment-672987876 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3Mjk4Nzg3Ng== TomNicholas 35968931 2020-08-12T16:45:23Z 2020-08-12T16:45:23Z MEMBER

@AndrewWilliams3142 fair question: what I was envisaging was taking slices along that dimension(s), performing the curve fitting once for each slice (which should parallelize through apply_ufunc), then returning the optimised fitting parameters as a DataArray/Dataset which varied along that dimension. For example:

```python

2D dataarray of surface height with x & t dependence

height_data

def pulse_shape(x, peak_height, peak_location, FWHM): return peak_height * np.exp(-((x-peak_location)/FWHM)^2.0)

returned fit_params has t dependence

fit_params = height_data.fit(pulse_shape, fit_along='x')

Plot a graph of change in peak height over t

fit_params['peak_height'].plot(x='t') ```

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
672084619 https://github.com/pydata/xarray/issues/4300#issuecomment-672084619 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3MjA4NDYxOQ== AndrewILWilliams 56925856 2020-08-11T16:49:00Z 2020-08-11T16:49:29Z CONTRIBUTOR

@TomNicholas I'm a bit confused about how the fit_along argument would work actually. If you had 2D data and wanted to fit a 1D function to one of the dimensions, wouldn't you have to either take a mean (or slice?) across the other dimension?

Edit: It's been a hot day here, so apologies if this turns out to be a dumb q haha

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
671475798 https://github.com/pydata/xarray/issues/4300#issuecomment-671475798 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3MTQ3NTc5OA== shoyer 1217238 2020-08-10T17:06:11Z 2020-08-10T17:06:11Z MEMBER

+1 for just wrapping the existing functionality in SciPy for now. If we want a version of curve_fitthat supports dask, I would suggest implementingcurve_fit` with dask first, and then using that from xarray.

I am OK with using inspect from the standard library for determining default parameter names. inspect.signature is reasonably robust. But there should definitely be an optional argument for setting parameter names explicitly.

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
671442450 https://github.com/pydata/xarray/issues/4300#issuecomment-671442450 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY3MTQ0MjQ1MA== AndrewILWilliams 56925856 2020-08-10T16:01:06Z 2020-08-10T16:01:06Z CONTRIBUTOR

This sounds very cool! :) I'm not sure that I have much to add, but given @aulemahal 's good point about the complexity of rewriting curve_fit from scratch, it seems that maybe a good first step would just be to wrap the existing scipy functionality?

Alternatively, given that xr.apply_ufunc can already do this (though it's probably complicated), perhaps it would be good to just have an example in the documentation?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
669065910 https://github.com/pydata/xarray/issues/4300#issuecomment-669065910 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY2OTA2NTkxMA== clausmichele 31700619 2020-08-05T08:44:06Z 2020-08-05T08:44:06Z CONTRIBUTOR

I am also trying to get similar results of scipy curve_fit with xarray and dask. Is there a workaround I can use to fit a sinusoidal function with the current functions/methods? This is the function I use to fit a seasonal trend with scipy: t = 365 def timeseries_function_season (x,a0,a1,a2): return a0+(a1*np.cos(2*np.pi/t*x)+a2*np.sin(2*np.pi/t*x)) timeseries_model_fit,pcov= curve_fit(timeseries_function_season,x,y)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109
668264540 https://github.com/pydata/xarray/issues/4300#issuecomment-668264540 https://api.github.com/repos/pydata/xarray/issues/4300 MDEyOklzc3VlQ29tbWVudDY2ODI2NDU0MA== aulemahal 20629530 2020-08-03T22:05:25Z 2020-08-03T22:05:25Z CONTRIBUTOR

My comments Q.1 : For now xr.apply_ufunc does not accept core dimensions to be chunked along, which would be kinda a sad for curve fitting. However, dask's least square method does, which is part of the reason why I used it in polyfit. On the other hand, scipy's least-squares procedure is not simple. Curve fitting is quite complex and rewriting all the code to use dask might be a project too ambitious, and surely out-of-scope for xarray...

Q.3 : For simple directly declared function, inspect does a good job, but it can get tricky with wrapped functions, which might arise in more complex workflows. Could we have a params arg that takes in a list of names?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  General curve fitting method 671609109

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.181ms · About: xarray-datasette