Survival kaplanmeiercurve gethashcode - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Survival is 0.1.0 — read its documentation.

HomeSurvivalSurvival estimators

KaplanMeierCurve.GetHashCode

A hash consistent with the equality, in constant time.

public int GetHashCode()

Returns — a hash over the confidence level and the number of steps.

Example — equal curves hash alike.

using Lodestar.Survival;

SurvivalStep[] steps = [new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)];
KaplanMeierCurve left = new(steps, [1.0, 0.75], [0.4, 0.3], [0.9, 0.8], 0.95);
KaplanMeierCurve right = new(
    [new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)], [1.0, 0.75], [0.4, 0.3], [0.9, 0.8], 0.95);

bool alike = left.GetHashCode() == right.GetHashCode();  // => True

Remarks — the four arrays share one index, so the step count stands for all of them. A fitted curve can hold thousands of steps, which is the walk this avoids; unequal curves may collide.

Applies to — net10.0, netstandard2.0.

See alsoKaplanMeierCurve.Equals, KaplanMeierCurve.