thresh_1d(criterion,
param1,
wcd,
sort_id=None)
| source code
|
Solve threshold-based 1D binary classifier.
The function solves the following problem:
Given two sets of samples of two classes, a positive one and a negative one,
a threshold-based classifier classifies a value x into a positive or a negative
class: sign(x - heta). The optimal heta is chosen based on different criteria:
- Minimize the classification error: lambda * p(pos)*FRR + p(neg)*FAR
- Minimize the error without prior: lambda * FRR + FAR
- Minimize FAR with constraint FRR <= maxFRR
- Minimize FRR with constraint FAR <= maxFAR
- Parameters:
criterion (integer from 0 to 3) - 0: minimize classification error with prior probabilities
1: minimize classification error without prior probabilities
2: minimize FAR while constraining FRR
3: minimize FRR while constraining FAR
param1 (double) -
- a parameter representing
lambda if criterion < 2
maxFRR if criterion == 2
maxFAR if criterion == 3
wcd (WeightedCDataset(J=2,ishape=()) (in cs.ml.cla package)) - a dataset of sample values of the two classes
sort_id (array) - the result of calling sort_1d(wcd),
if sort_id is None, sort_1d(wcd) is called
- Returns:
- result : array(shape=(2,),dtype='d')
an argout array representing
- result[0]: the threshold
- result[1]: the optimized function value at that threshold
|