Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 fsharp 中有一个 Deedle 框架,有 45 列,每列都包含浮点数。我想通过对原始框架中的每个条目应用转换来创建一个新框架。转换的简单函数如下:
let minusLogOfOneLess x = -log (1.0-x)
是否有捷径可寻?
看起来我们在向 Deedle 帧添加运算符时错过了一元减号运算符!除了一元减号之外,其余的实际上已经起作用了。
因此,您可以更改-log(...)为-1.0 * log(...):
-log(...)
-1.0 * log(...)
let minusLogOfOneLess (x:Frame<_, _>) = -1.0 * (log (1.0 - x)) frame [ "A" => series [1=>0.5; 2=>0.4]] |> minusLogOfOneLess