pmf method
Probability mass function (PMF) tells probability of specific event.
Example
In this example, we use Frequencies.
import 'package:calc/calc.dart';
void main() {
// Two cats and two other animals
final frequencies = Frequencies<String>.from([
'dog',
'cat',
'rabbit',
'cat',
]);
final catPmf = frequencies.pmf('cat'); // --> 0.5
print('Likelihood of cats based on the seen data: $catPmf');
}
Implementation
@override
double pmf(T value) {
return _masses[value] ?? 0.0;
}