Wireless wearable functional near-infrared spectroscopy (fNIRS) has attracted growing attention as a candidate for real-life brain monitoring systems. It is important to determine the onsets at which neuronal activation is evoked by cognitive status in real-time analysis. We propose a machine learning approach for the classification of cognitive event onsets (CogEOs) in hemodynamic signals during three cognitive tasks. The approach does not require a threshold to be set or additional measurement for the rest state. A support vector machine is trained by labeled features obtained from the mean amplitude of hemodynamic changes and then predicts the type of onset points. The problems caused by the imbalance between CogEOs and non-event onsets (NonEO) are solved by oversampling the feature samples labeled by cognitive events. By oversampling, the classification accuracy from an average of five classification scores reaches 74%, 77%, and 75% for the simple arithmetic, 1-back, and 2-back tasks. We achieve the best onset classification performance when the NonEOs are randomly distributed and when the subject is performing the 1-back task. Our study extends fNIRS to real-life applications by detecting the time point when brain activation starts among random observations using machine learning without additional triggers or threshold.