Invasive brain cancer cells cannot be visualized during surgery and so they are often not removed. These residual cancer cells give rise to recurrences. In vivo Raman spectroscopy can detect these invasive cancer cells in patients with grade 2 to 4 gliomas. The robustness of this Raman signal can be dampened by spectral artifacts generated by lights in the operating room. We found that artificial neural networks (ANNs) can overcome these spectral artifacts using nonparametric and adaptive models to detect complex nonlinear spectral characteristics. Coupling ANN with Raman spectroscopy simplifies the intraoperative use of Raman spectroscopy by limiting changes required to the standard neurosurgical workflow. The ability to detect invasive brain cancer under these conditions may reduce residual cancer remaining after surgery and improve patient survival.