A method is provided that includes providing 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. An indication is
received of actual ingestion events of the subject during the initial
calibration period. Using a cost function, an analysis is performed of
the fundic impedance signal and the actual ingestion events. Responsively
to the analysis, a threshold is set, the crossing of which by the fundic
impedance signal is indicative of ingestion. The threshold is stored in a
memory of the eating detection device. Other embodiments are also
described.