This thesis investigates the predictability of Tesla’s stock price through an integrated set of statistical and machine learning models, with the objective of assessing which approach delivers the best performance in terms of accuracy, robustness, explainability, and fairness. The constructed dataset includes daily data from 2020 to 2024, incorporating market, macroeconomic, and sector variables. After an extensive feature selection phase, several models are implemented: linear models (OLS, Best Subset Selection, Lasso, Ridge, PCR, PLS), non-linear tree-based models (Regression Tree, Bagging, Random Forest, Boosting, and BART), and deep learning models (MLP and LSTM). The evaluation framework combines classical error metrics (MSE, RMSE) with the SAFE AI approach (Giudici and Raffinetti, 2025), which allows the predictive quality to be assessed across four dimensions: accuracy (RGA), robustness (RGR), explainability (RGE), and fairness (RGF). Empirical evidence shows that Random Forest emerges as the overall best-performing model on the test set, while Lasso proves to be the most effective linear alternative in terms of balance between complexity and predictive capability. The LSTM model delivers highly encouraging results thanks to the sequential structure of the data, although it is less directly comparable to the other models. The findings confirm the importance of integrating traditional methods with advanced approaches, and highlight the added value of the SAFE AI framework as an interpretative and comparative tool for evaluating financial predictive models. Overall, the thesis contributes to a deeper understanding of stock price forecasting mechanisms in highly dynamic and uncertain environments.

Il presente lavoro analizza la prevedibilità del prezzo azionario di Tesla attraverso un insieme integrato di modelli statistici e di machine learning, con l’obiettivo di valutare quale approccio produca le migliori prestazioni in termini di accuratezza, robustezza, spiegabilità e fairness. Il dataset sviluppato comprende dati giornalieri dal 2020 al 2024, includendo variabili di mercato, macroeconomiche e settoriali. Dopo un’estesa fase di selezione delle feature, vengono implementati modelli lineari (OLS, Best Subset Selection, Lasso, Ridge, PCR, PLS), modelli non lineari ad albero (Regression Tree, Bagging, Random Forest, Boosting e BART) e modelli di deep learning (MLP e LSTM). La valutazione dei risultati integra metriche classiche di errore (MSE, RMSE) con il framework SAFE AI (Giudici e Raffinetti, 2025), che consente di misurare la qualità predittiva in quattro dimensioni: accuratezza (RGA), robustezza (RGR), spiegabilità (RGE) e fairness (RGF). Le evidenze empiriche mostrano che Random Forest rappresenta il modello complessivamente più performante sul test set, mentre Lasso si afferma come la migliore alternativa lineare in termini di equilibrio tra complessità e capacità predittiva. Il modello LSTM registra prestazioni molto incoraggianti grazie alla struttura sequenziale dei dati, sebbene meno confrontabile direttamente con gli altri modelli. I risultati ottenuti confermano l’importanza dell’integrazione tra metodi tradizionali e approcci avanzati, e mostrano il valore aggiunto del framework SAFE AI come complemento interpretativo e comparativo nella valutazione di modelli predittivi finanziari. Il lavoro contribuisce a migliorare la comprensione dei meccanismi di previsione dei prezzi azionari in contesti altamente dinamici e incerti.

Responsabilità nel processo decisionale algoritmico e nella modellazione predittiva: applicazione delle metriche SAFE AI ai modelli di apprendimento automatico per la previsione delle azioni Tesla.

PIERACCI, MASSIMILIANO
2024/2025

Abstract

This thesis investigates the predictability of Tesla’s stock price through an integrated set of statistical and machine learning models, with the objective of assessing which approach delivers the best performance in terms of accuracy, robustness, explainability, and fairness. The constructed dataset includes daily data from 2020 to 2024, incorporating market, macroeconomic, and sector variables. After an extensive feature selection phase, several models are implemented: linear models (OLS, Best Subset Selection, Lasso, Ridge, PCR, PLS), non-linear tree-based models (Regression Tree, Bagging, Random Forest, Boosting, and BART), and deep learning models (MLP and LSTM). The evaluation framework combines classical error metrics (MSE, RMSE) with the SAFE AI approach (Giudici and Raffinetti, 2025), which allows the predictive quality to be assessed across four dimensions: accuracy (RGA), robustness (RGR), explainability (RGE), and fairness (RGF). Empirical evidence shows that Random Forest emerges as the overall best-performing model on the test set, while Lasso proves to be the most effective linear alternative in terms of balance between complexity and predictive capability. The LSTM model delivers highly encouraging results thanks to the sequential structure of the data, although it is less directly comparable to the other models. The findings confirm the importance of integrating traditional methods with advanced approaches, and highlight the added value of the SAFE AI framework as an interpretative and comparative tool for evaluating financial predictive models. Overall, the thesis contributes to a deeper understanding of stock price forecasting mechanisms in highly dynamic and uncertain environments.
2024
Responsibility in algorithmic decision-making and predictive modeling: applying SAFE AI metrics to machine learning models for forecasting Tesla’s stock.
Il presente lavoro analizza la prevedibilità del prezzo azionario di Tesla attraverso un insieme integrato di modelli statistici e di machine learning, con l’obiettivo di valutare quale approccio produca le migliori prestazioni in termini di accuratezza, robustezza, spiegabilità e fairness. Il dataset sviluppato comprende dati giornalieri dal 2020 al 2024, includendo variabili di mercato, macroeconomiche e settoriali. Dopo un’estesa fase di selezione delle feature, vengono implementati modelli lineari (OLS, Best Subset Selection, Lasso, Ridge, PCR, PLS), modelli non lineari ad albero (Regression Tree, Bagging, Random Forest, Boosting e BART) e modelli di deep learning (MLP e LSTM). La valutazione dei risultati integra metriche classiche di errore (MSE, RMSE) con il framework SAFE AI (Giudici e Raffinetti, 2025), che consente di misurare la qualità predittiva in quattro dimensioni: accuratezza (RGA), robustezza (RGR), spiegabilità (RGE) e fairness (RGF). Le evidenze empiriche mostrano che Random Forest rappresenta il modello complessivamente più performante sul test set, mentre Lasso si afferma come la migliore alternativa lineare in termini di equilibrio tra complessità e capacità predittiva. Il modello LSTM registra prestazioni molto incoraggianti grazie alla struttura sequenziale dei dati, sebbene meno confrontabile direttamente con gli altri modelli. I risultati ottenuti confermano l’importanza dell’integrazione tra metodi tradizionali e approcci avanzati, e mostrano il valore aggiunto del framework SAFE AI come complemento interpretativo e comparativo nella valutazione di modelli predittivi finanziari. Il lavoro contribuisce a migliorare la comprensione dei meccanismi di previsione dei prezzi azionari in contesti altamente dinamici e incerti.
File in questo prodotto:
File Dimensione Formato  
Thesis.pdf

accesso aperto

Descrizione: Thesis.
Dimensione 479.29 kB
Formato Adobe PDF
479.29 kB Adobe PDF Visualizza/Apri

È consentito all'utente scaricare e condividere i documenti disponibili a testo pieno in UNITESI UNIPV nel rispetto della licenza Creative Commons del tipo CC BY NC ND.
Per maggiori informazioni e per verifiche sull'eventuale disponibilità del file scrivere a: unitesi@unipv.it.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.14239/34067