POSTERIOR S2 bluff: Bluff-Anteil als Beta-Posterior (Prior = Heuristik, Gewicht STREET_PRIOR, Evidenz gezeigte River-Bets)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+42
-5
@@ -24,7 +24,10 @@
|
||||
//! street level already carries it. Board texture is what the formula misses.
|
||||
|
||||
use crate::card::{deck, Card};
|
||||
use crate::exploit::bluff_share::MAX_BLUFF_SHARE;
|
||||
use crate::exploit::call_floor::CALL_RUNG;
|
||||
use crate::exploit::profile::Profile;
|
||||
use crate::exploit::sample::STREET_PRIOR;
|
||||
use crate::exploit::fold_chance::{fold_base_cbet, fold_chance_on, sized_fold, MAX_FOLD};
|
||||
use crate::exploit::made_ladder::rung;
|
||||
use crate::exploit::range_model::range_spec;
|
||||
@@ -59,6 +62,8 @@ pub struct Mode {
|
||||
/// logit level, `P(fold) = m_board * f / m_ref` (see `class_fold`). Never above the mass below
|
||||
/// the floor unless the read folds more than that mass on average.
|
||||
pub class_rate: bool,
|
||||
/// S2 `bluff`: the bluff share of a villain's bet is a Beta posterior, see `bluff`.
|
||||
pub bluff: bool,
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
@@ -74,7 +79,7 @@ pub fn mode() -> Option<Mode> {
|
||||
}
|
||||
|
||||
fn parse(s: &str) -> Option<Mode> {
|
||||
let mut m = Mode { fold: false, board_weight: 1.0, fold_only_branch: false, class_rate: false };
|
||||
let mut m = Mode { fold: false, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false };
|
||||
for t in s.split(',').map(str::trim) {
|
||||
if t == "fold" {
|
||||
m.fold = true;
|
||||
@@ -82,12 +87,14 @@ fn parse(s: &str) -> Option<Mode> {
|
||||
m.fold_only_branch = true;
|
||||
} else if t == "anteil" {
|
||||
m.class_rate = true;
|
||||
} else if t == "bluff" {
|
||||
m.bluff = true;
|
||||
} else if let Some(w) = t.strip_prefix("fold:").and_then(|w| w.parse::<f64>().ok()).filter(|w| w.is_finite()) {
|
||||
m.fold = true;
|
||||
m.board_weight = w;
|
||||
}
|
||||
}
|
||||
m.fold.then_some(m)
|
||||
(m.fold || m.bluff).then_some(m)
|
||||
}
|
||||
|
||||
/// Force the switch for this thread (`Some(None)` = off), `None` = the environment. Tests.
|
||||
@@ -241,6 +248,29 @@ fn class_fold(f: f64, m_board: f64, m_ref: f64) -> f64 {
|
||||
}
|
||||
}
|
||||
|
||||
/// S2: the bluff share of a villain's bet as a Beta posterior. The prior mean is the share the
|
||||
/// heuristic gives (`exploit::bluff_share` with the population prior), its weight `STREET_PRIOR`
|
||||
/// bets, the same as the solver's read (`exploit::range_read::RangeRead::bluff_share`). The evidence
|
||||
/// is the villain's shown river bets (`Profile::river_bluff_share` over `river_bluff_shown`), so only
|
||||
/// the river moves; flop and turn keep the prior until showdowns are counted per street. Off: `prior`.
|
||||
pub fn bluff(profile: Option<&Profile>, street: Street, prior: f64) -> f64 {
|
||||
if !mode().is_some_and(|m| m.bluff) || street != Street::River {
|
||||
return prior;
|
||||
}
|
||||
let ok = |x: Option<f64>| x.filter(|v| v.is_finite());
|
||||
let Some(p) = profile else { return prior };
|
||||
match (ok(p.river_bluff_share), ok(p.river_bluff_shown)) {
|
||||
(Some(share), Some(n)) if n > 0.0 => beta_mean(prior, STREET_PRIOR, share.clamp(0.0, 1.0), n).min(MAX_BLUFF_SHARE),
|
||||
_ => prior,
|
||||
}
|
||||
}
|
||||
|
||||
/// Posterior mean of a Beta prior with mean `m0` worth `k0` observations after `n` observations
|
||||
/// with mean `x`.
|
||||
fn beta_mean(m0: f64, k0: f64, x: f64, n: f64) -> f64 {
|
||||
(k0 * m0 + n * x) / (k0 + n)
|
||||
}
|
||||
|
||||
/// The read's fold chance as `table_fold` prices it (street read, c-bet read on a c-bet), then S1.
|
||||
pub fn table_fold_of(spot: &Spot, villain: &Villain, ratio: f64, facing_raise: bool) -> f64 {
|
||||
let p = villain.profile.as_ref();
|
||||
@@ -258,9 +288,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn parses_the_stages() {
|
||||
assert_eq!(parse("fold"), Some(Mode { fold: true, board_weight: 1.0, fold_only_branch: false, class_rate: false }));
|
||||
assert_eq!(parse("fold:0.5,bluff"), Some(Mode { fold: true, board_weight: 0.5, fold_only_branch: false, class_rate: false }));
|
||||
assert_eq!(parse("fold:0,nurfold"), Some(Mode { fold: true, board_weight: 0.0, fold_only_branch: true, class_rate: false }));
|
||||
assert_eq!(parse("fold"), Some(Mode { fold: true, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false }));
|
||||
assert_eq!(parse("fold:0.5,bluff"), Some(Mode { fold: true, board_weight: 0.5, fold_only_branch: false, class_rate: false, bluff: true }));
|
||||
assert_eq!(parse("fold:0,nurfold"), Some(Mode { fold: true, board_weight: 0.0, fold_only_branch: true, class_rate: false, bluff: false }));
|
||||
assert_eq!(parse("0"), None);
|
||||
assert_eq!(parse(""), None);
|
||||
}
|
||||
@@ -280,4 +310,11 @@ mod tests {
|
||||
assert!(f < sigmoid(logit(0.2) + logit(0.8) - logit(0.55)));
|
||||
assert_eq!(parse("fold,anteil").map(|m| m.class_rate), Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shown_river_bets_pull_the_bluff_share() {
|
||||
assert!((beta_mean(0.3, 15.0, 0.0, 15.0) - 0.15).abs() < 1e-12);
|
||||
assert!((beta_mean(0.3, 15.0, 0.9, 0.0) - 0.3).abs() < 1e-12);
|
||||
assert_eq!(parse("bluff").map(|m| (m.fold, m.bluff)), Some((false, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@ fn on_street(
|
||||
.then(turn_raise_bluff)
|
||||
.flatten();
|
||||
let bluff = with_pop_prior_on(villain.profile.as_ref(), street, sustained, lvl == 1, bluff);
|
||||
let bluff = crate::engine::glaube::bluff(villain.profile.as_ref(), street, bluff);
|
||||
let base = [BET_RUNG, RAISE_RUNG][lvl][slot];
|
||||
(
|
||||
rung(base, read_notch(villain, ratio) + style_rung(villain)),
|
||||
|
||||
Reference in New Issue
Block a user