Patent ID: 8423130

Claim:
A method comprising: receiving, by a processor, a fundic impedance signal of a subject sensed during an initial calibration period using at least one implantable fundic sensor of an eating detection device; receiving, by the processor, an indication of actual ingestion events of the subject during the initial calibration period; performing, by the processor, an analysis of the fundic impedance signal and the actual ingestion events, using a cost function to find each of a plurality of cost function values for each of respective candidate thresholds by: identifying, using an eating detection algorithm, detected ingestion events during the initial calibration period by comparing the fundic impedance signal to the candidate threshold over the initial calibration period, comparing the detected ingestion events to the actual ingestion events to find a number of the detected ingestion events that represent true positives, a number of the detected ingestion events that represent false positives, and a number of the actual ingestion events that represent false negatives, and calculating the cost function value responsively to a measure of sensitivity of the eating detection algorithm and a measure of positive predictive value of the eating detection algorithm, wherein the sensitivity equals the quotient of (a) the number of the true positives divided by (b) a sum of the number of the true positives and the number of the false negatives, and wherein the positive predictive value equals the quotient of (a) the number of the true positives divided by (b) a sum of the number of the true positives and the number of the false positives; setting, by the processor, a threshold by selecting one of the candidate thresholds as the threshold responsive to the cost function values, the crossing of which threshold by the fundic impedance signal is indicative of ingestion; and storing, by the processor, the threshold in a memory of the eating detection device.