In this article, we propose and demonstrate a generalized machine learning (ML) approach to analyse the various optical properties of the Fiber Bragg grating (FBGs), namely effective refractive index, bandwidth, re ectivity and wavelength. For this purpose, three commonly used variants of FBG, namely conventional, π phase-shifted and chirped ones are investigated and the re ected spectra of the aforementioned FBGs are predicted using ab initio arti cial neural networks (ANNs). We implemented a simple and fast-training feed-forward ANN and established the e cacy of our model by predicting the output spectrum with minute details for unknown device parameters along with non-linear and complex behaviour of the spectrum. Thus, our proposed ANN model is capable of predicting various key optical properties and reproducing the exact spectrum accurately and quickly, providing a cost-effective solution for e cient and precise modelling.