Detection, prediction and control of epileptic seizures