cuML LinearRegression を使用して、x_value に対する y_value のローリング スロープを計算したいと思います。
サンプルデータ (cuDF データフレーム):
| date | x_value | y_value |
| ------ | ------ | ---- |
| 2020-01-01 | 900 | 10 |
| 2020-01-01 | 905 | 15 |
| 2020-01-01 | 910 | 15 |
| 2020-01-01 | 915 | 15 |
| 2020-01-02 | 900 | 30 |
| 2020-01-02 | 905 | 40 |
| 2020-01-02 | 910 | 50 |
| ------ | ------ | ------ |
LinearRegression を使用する単純な関数:
def RollingOLS(x, y):
lr = LinearRegression(fit_intercept = True, normalize = False, algorithm = 'svd')
reg = lr.fit(x, y)
return reg.coef_
私がしたいこと:
data.groupby('date').rolling(2).apply(RollingOLS, x=x_value, y=y_value)
ただし、次のエラーが表示されますNotImplementedError: Handling UDF with null values is not yet supported
。このエラーを克服する方法はありますか? ありがとうございました。