The Litecoin Inference Model design and Results
Legal Disclaimer:
The Content is for informational purposes only. You should not construe such information or other material as legal, tax, investment, financial, or other advice. Nothing contained on our Site constitutes a solicitation, recommendation, endorsement, or offer by myself or any third-party service provider to buy or sell any securities or other financial instruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.
So in the last blog, we talked about the data collected and how we stored it. Let's pick up where we left on and start building a model.
The neural network I built is a dense Neural Network, a model's architecture that takes information from the previous layers and then passes it to the next layer. This dense connectivity starts in the input layer and continues to the hidden and output layers. Connecting all the nodes to each other at each layer.
Let's get into the details. After many experiments and adding and dropping features at the cost of most likely overfitting by a small margin. I found the more data I gave it, the better the performance metrics. At first, I gave it 2500 rows to train on, increased it, and got better performance metrics, finally settling on 4000 rows for the training set. I use about 1000 rows for testing and the last 115 for validation.
During my validation/tuning phase, I used more stock features to retrain the model to boost the results by adding the High, Close, Adjust close, volume, sentiment, and TA features to build this model. So the following is the list of the feature columns included in the model.
Features:
senti_neg, senti_pos, senti_neu, trans_high, trans_close, trans_Adjclose, trans_volume, trans_mrnstar, trans_hammer, trans_percingln, trans_engulf, trans_threewhite
Total of 12 features selected
Topology:
Input: I have 12 inputs to the dense neural network for the input level, applying the rectified linear unit activation function.
Hidden layer: I have 24 layers of densely connected nodes using the Applies the Gaussian error linear unit (GELU) activation function.
Output Layer: 1 densely connected node using rectified linear unit activation function again.
The optimizer is Keras Adam, with a learning rate 0.001 and a Mean Absolute Error loss function. Measuring the model performance with the same Mean Absolute Error as the performance metric.
I ran the data through the network 560 times, or 560 epochs, with the following topology and parameters.
Driving down my MAE (Mean Absolute Error) metric to 9.1427 for the final epochs but, in the previous generations, low as 8.8251.
Results:
Because The model predicts the current stock market, sentiment, and TA. Its only utility is to predict a possible movement in the next hour.
So without the sentiment data using this model in the future isn't possible unless you're willing to spend like 5000k a month on Twitter API now.
The model I built was over 99% accurate using my validation data, which was a decent model. It was off high or low by around 50 cents, with the cost of Litecoin hovering at about 91 dollars a coin in mid-June 2023.
Some example results from the validation set:
model.predict(test[5100])
92.32937114
Actual Litecoin price
91.76335906982422
more
model.predict(test[5110])
92.02357232
Actual Litecoin price
91.46319580078124
Conclusion:
This was a fun side project. I put about eighty hours total, forty into setting up and forty into data science experiments into it over the last year; it helped me understand TensorFlow, CNN, and NN better, coming from a more traditional ML method background. I got to brush up on my data science Python coding skills and enjoyed setting up the k3s kubernets cluster to run Grafana and Jnotebook and the Python jobs. I will continue to use the hardware for other projects in the future, so stay tuned as I look into such fun topics as setting up Longhorn, playing more with ArgoCD, and trying out Sidero Metal Kubernetes.

Comments
Post a Comment