In this work, we present a novel nonlocal nonlinear coarse grid approximation using a machine learning algorithm. We consider unsaturated and two-phase flow problems in heterogeneous and fractured porous media, where mathematical models are formulated as general multicontinuum models. We construct a fine grid approximation using the finite volume method and embedded discrete fracture model. Macroscopic models for these complex nonlinear systems require nonlocal multicontinua approaches, which are developed in earlier works [8]. These rigorous techniques require complex local computations, which involve solving local problems in oversampled regions subject to constraints. The solutions of these local problems can be replaced by solving original problem on a coarse (oversampled) region for many input parameters (boundary and source terms) and computing effective properties derived by nonlinear nonlocal multicontinua approaches. The effective properties depend on many variables (oversampled region and the number of continua), thus their calculations require some type of machine learning techniques. In this paper, our contribution is two fold. First, we present macroscopic models and discuss how to effectively compute macroscopic parameters using deep learning algorithms. The proposed method can be regarded as local machine learning and complements our earlier approaches on global machine learning [39,38]. We consider a coarse grid approximation using two upscaling techniques with single phase upscaled transmissibilities and nonlocal nonlinear upscaled transmissibilities using a machine learning algorithm. We present results for two model problems in heterogeneous and fractured porous media and show that the presented method is highly accurate and provides fast coarse grid calculations.