Stochastic nonlinear Schrödinger equation is a mathematical model, used in the study of complex systems especially nonlinear optics and quantum mechanics. It explains the evolution of a quantum field with stochastic and nonlinear terms. A stochastic or random process is a mathematical representation that outlines the progression of a system in a way that incorporates probability. This is in contrast to a deterministic process, where the future states are strictly defined by initial conditions. In mathematical model, stochastic term is usually represent by variable or a function that involves random variable or a noise. In this paper, we study the generalized nonlinear Schrödinger equation by adding stochastic term for the first time to retrieve different types of optical solitons. To the best of our knowledge, no one work on this model with stochastic term. Our aim is to find optical solitons like bright and dark solitons, also solitary wave solutions for this model like bell type, hyperbolic functions, Jacobi Elliptic Function, Weierstrass Elliptic Function, periodic and rational solutions. These solutions will be obtained using the sub-ode method, subject to certain constraint conditions. Finally, we will use Jupyter as a machine learning tool and also mathematica to plot some obtained solutions in various dimensions like 3D, 2D and contour plots by using some libraries of PYTHON like numpy, scipy.integrate and matplotlib.pyplot. For the first time, we use this approach for this model and our results are new and novel [1].