填满前进杯/ CUDF

问题描述

应该可以使用cupy / cudf进行填充吗?这个想法是执行schimitt触发函数,例如:

# pandas version
df = some_random_vector
on_off = (df>.3)*1 + (df<.3)*-1
on_off[on_off==0) = np.nan
on_off = on_off.fillna(method='ffill').fillna(0)

我正在尝试这个,但是杯状的却没有积累ufunc:

def schmitt_trigger(x,th_lo,th_hi,initial = False):
    on_off = ((x >= th_hi)*1 + (x <= th_lo)*-1).astype(cp.int8)
    mask = (on_off==0)
    idx = cp.where(~mask,cp.arange(start=0,stop=mask.shape[0],step=1),0)
    cp.maximum.accumulate(idx,axis=1,out=idx)
    out = on_off[cp.arange(idx.shape[0])[:,None],idx]
    return out

有什么主意吗? 谢谢!

解决方法

不幸的是,RAPIDS当前在cudf中没有该功能,并且可能也没有0.16。 github中有功能要求。 https://github.com/rapidsai/cudf/issues/1361

希望您能按要求加入,以便开发人员可以了解其高度需求。

对于施密特触发器,如果​​有任何进展,我将对其进行研究,并编辑您的代码。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...