Fault detection and prediction with application to rotating machinery