This paper investigates the improvement of the Capital Asset Pricing Model (CAPM) by incorporating machine learning techniques. The objective is to address the model's conventional constraints in accurately predicting stock returns. The conventional Capital Asset Pricing Model (CAPM), which heavily depends on the beta coefficient to explain returns, frequently proves inadequate in emerging markets and neglects to consider market irregularities such as size and value effects. Our methodology enhances the estimation of beta by refining the Capital Asset Pricing Model (CAPM) to exclude the intercept term and incorporating a dynamic rolling regression method. This approach captures the fluctuations of beta more effectively across different periods, resulting in a more precise estimation. This study utilises ten years of weekly closing price data from companies listed on the NSE Nifty 50 index. It employs rolling regression and two-stage regression analysis to improve the prediction of excess returns above the risk-free rate. The revised CAPM model, which omits the intercept, exhibits a superior level of accuracy, as evidenced by higher adjusted R-squared values and improved F-statistics. In addition, the paper analyses the Fama-French models within the Chinese stock market and explores the potential of advanced machine learning models, such as Long Short-Term Memory Recurrent Neural Networks (LSTM-RNN), to improve forecasting methods in unpredictable markets. Integrating LSTM-RNN models presents a promising approach to capturing intricate patterns in financial time series data, demonstrating substantial enhancement in forecasting accuracy compared to conventional methods such as OLS.