Method: Polars::Expr#entropy
- Defined in:
- lib/polars/expr.rb
#entropy(base: nil, normalize: true) ⇒ Expr
Computes the entropy.
Uses the formula -sum(pk * log(pk) where pk are discrete probabilities.
7639 7640 7641 7642 7643 7644 7645 7646 7647 |
# File 'lib/polars/expr.rb', line 7639 def entropy(base: nil, normalize: true) # TODO update (including param docs) if base.nil? warn "The default `base` for `entropy` method will change from `2` to `Math::E` in a future version" base = 2 end wrap_expr(_rbexpr.entropy(base, normalize)) end |