The main objective of this work is to investigate efficient estimation of the optimal design variables that maximize net present value (NPV) for the life-cycle production optimization during a single-well CO2 huff-n-puff (HnP) process in unconventional oil reservoirs. During optimization, the NPV is calculated by a machine learning (ML) proxy model trained to accurately approximate the NPV that would be calculated from a reservoir simulator run. The ML proxy model can be obtained with either least-squares support vector regression (LS-SVR) or Gaussian process regression (GPR). Given forward simulation results with a commercial compositional simulator that simulates miscible CO2 HnP process in a simple hydraulically fractured unconventional reservoir model with a set of design variables, a proxy is built based on the ML method chosen. Then, the optimal design variables are found by maximizing the NPV based on using the proxy as a forward model to calculate NPV in an iterative optimization and training process. The sequential quadratic programming (SQP) method is used to optimize design variables. Design variables considered in this process are CO2 injection rate, production BHP, duration of injection time period, and duration of production time period for each cycle. We apply proxy-based optimization methods to and compare their performance on several synthetic single-well hydraulically fractured horizontal well models based on Bakken oil-shale fluid composition. Our results show that the LS-SVR and GPR based proxy models prove to be accurate and useful in approximating NPV in optimization of the CO2 HnP process. The results also indicate that both the GPR and LS-SVR methods exhibit very similar convergence rates and require similar computational time for optimization. Both ML based methods prove to be quite efficient in production optimization, saving significant computational times (at least 5 times more efficient) than using a stochastic gradient computed from a high fidelity compositional simulator directly in a gradient ascent algorithm. The novelty in this work is the use of optimization techniques to find optimum design variables, and to apply optimization process fast and efficient for the complex CO2 HnP EOR process which requires compositional flow simulation in hydraulically fractured unconventional oil reservoirs.