In this article, we propose an iterative algorithm based on lazy learning. The proposed scheme considers two consecutive algorithms for optimal resource allocation in heterogeneous cloud radio access networks (H-CRAN). In the conventional approach, resources allocation is usually presented as a mathematical optimization problem and solved online using a real-time scenario. Due to the non-convex nature of resource allocation problems, finding optimal solutions in real-time is a difficult challenge and has high computational complexity. To overcome these challenges in this paper, the problem is first formulated as a mixed-integer nonlinear programming (MINLP) to optimize the system capacity and assign the underlay users to the subchannels, which is NP-hard. To obtain the solution, in the first algorithm, the proposed problem is first reformulated as a convex problem using a matching theory and coalition formation method. Then, in the second algorithm, the lazy learning method is employed to find the optimal solution to the resources allocation problem. The lazy algorithm uses the output results of the first algorithm as training data, which are known as historical data. Similarities between current scenario data and historical scenario data, as well as the solution of resources allocation in historical scenarios, can be exploited to improve the resource allocation of the current scenario. Simulation results confirm that compared with the conventional approach, the suggested technique can significantly improve the system performance in terms of the total users assigned, overall throughput, the pace of resource allocation, and user fairness.