Data-driven Prognosis and Diagnosis of Event Occurrences with Applications in Manufacturing and Healthcare Systems