Abstract
Due to their complex and unpredictable nature, stock market movements were always challenging to predict. Factors like economic indicators, market sentiment, and political and global events significantly contribute to stock price unpredictability. There are different methods to analyze risks, returns, and average price movements, based on which investors make assumptions. Identifying patterns and making the right decision on large amounts of data is very difficult, but nowadays, with the advancement of neural networks, we can solve prediction problems by identifying patterns of high-dimensional sequential data. We will analyze and compare five neural network architectures, including Recurrent Neural Networks (RNNs), Long Short-Term Memory networks (LSTMs), Gated Recurrent Units (GRUs), Convolutional Neural Networks (CNNs), and Artificial Neural Networks (ANNs), to try to predict stock prices using historical data taken from Yahoo Finance API, which is widely used and reliable for financial data analysis. We will separate historical data into two parts, 80% of which will be trained and 20% will be tested. For each model, we will use different hyperparameters we selected as the most effective training. Popular Python libraries such as TensorFlow, Keras, and NumPy are used for efficient implementation. Additionally, we used preprocessing for data, such as data cleaning and normalization, to avoid errors and enhance model performance. The models are evaluated based on prediction accuracy using metrics like Mean Absolute Error (MAE), Mean Squared Error (MSE), Root Mean Squared Error (RMSE), and R-squared (R²). Additionally, we use classification metrics such as the confusion matrix and Receiver Operating Characteristic - Area Under the Curve (ROC-AUC) to analyze each model’s performance in predicting price movement directions. We concluded that the GRU model achieves the highest accuracy and reliability in our analysis, with notable performance in classification metrics. Conversely, the simple ANN model shows the worst results, highlighting the variability in predictive capabilities across different neural network architectures.