Machine Learning Questions: Integrations

Initial questions for ML:

1.The Prediction in the tutorial is on stock market price,so can we follow this for forex as well . If not then how can we go for forex prediction?



2.For forex prediction there is OHLC(Open,High,Low ,Close and volume) data only.But there are many factors which affect the forex price like trader’s sentiments,war’s,Inflation,elections etc



3.can we merge the sentiment analysis and forex dataset for better accuracy?



4.can we add the indicators data as parameters. If yes, then how do we get those data into our dataset?



5.There are lots of prediction models like(linear regression,polynomial regression,LSTM,GRU etc.).so which one is good for the forex price prediction?



6. What approach should investors use to predict forex movements?



7.At the time there are many bigger candles than usual which are exceptions in the market. So can we look as an outlier or look at a similar candle like other candles?



8.For Forex predictions which fundamental analysis is needed ?

9.For Forex predictions which Technical analysis is needed ?



10. How are we going to relate Technical analysis and fundamental analysis?



11.After training the model ,how we select the best hyper-parameters.



12.How are we going to Test the strength and stability of trends when predicting forex?



13.How to control the Overfitting and Underfitting situation of the model.



 14.In the LSTM or GRU model how we handle the gradient vanishing and gradient boosting problems.



15.How we achieve the global minima of the model.and how we know the point is the global minima of the model.



16.Is there any need for the strategy for the parameters as well with the indicator data.

Hello Zach, 

Questions 1, 2 and 3 were answered in your previous community post here. Please check 



4. can we add the indicators data as parameters? If yes, then how do we get those data into our dataset?



Ans: Yes, we can use indicators as parameters. You can either code the indicators or use libraries like ta-lib to calculate them in python. Please check this link for ta-lib installation in python and here is the documentation of the talib library. 



5. There are lots of prediction models like(linear regression,polynomial regression,LSTM,GRU etc.).so which one is good for the forex price prediction?



Ans: There is no specific model that works only for forex price prediction. Since the forex prices are not linear and also the relation between forex prices and the factors that influence them are nonlinear and complex, you can start with  LSTM models. 



6. What approach should investors use to predict forex movements?



Ans: For investing in forex, the analysis involves understanding macroeconomic factors such as trade balance, GDP, inflation, employment levels, manufacturing indices etc. In addition to these,  fiscal, and monetary policies and political scenarios of the contracts involved are studied before investing in a forex contract. 



7. At the time there are many bigger candles than usual which are exceptions in the market. So can we look as an outlier or look at a similar candle like other candles?



Ans: If you see 'many bigger candles than usual' as you mentioned, they are not outliers anymore. The range (size) of the candle depends on the volatility of the phase the contract is in and an increase in volatility can lead to bigger candles relative to other candles of the same contract. 



8. For Forex predictions which fundamental analysis is needed ?



Ans: Can refer to answer for question 6



9. For Forex predictions which Technical analysis is needed ?



Ans: Technical analysis can't directly help you in predicting the prices but give you a clear picture of what's happening in the contract right now and give you a possible direction to trade. 

However, if you are asking about using technical analysis for forex predictions using any ML model then you can use technical indicators, and price patters as inputs to your model.



10. How are we going to relate Technical analysis and fundamental analysis?



Ans: In general, the fundamental analysis gives you a bigger picture of what's happening and what might happen whereas technical analysis will tell you when to take action. 



For example, using fundamental analysis if you figure out that the economy is great and you want to invest in that economy using stocks/forex/commodities, you wait for confirmation of the same with the evidence of bullish movement in the respective contracts. This bullish movement can be studied and confirmed using technical analysis. 



In the more practical sense, if you are investing for the long-term, technical analysis can't help you much since it fails to give you information on the formation of long-term trends until they are formed. But you can get a hint of these long-term trends by studying fundamental factors.



Similarly, if you are trading in the short-term, fundamental analysis can't help you much since the fundamental analysis data is released over months, quarters and years. So, analysis using technical analysis can help you, in this case, to study the short-term sentiment and price behaviour to make a trade.



11.After training the model ,how we select the best hyper-parameters.



Ans: This is done by performing hyper-parameter tuning. Generally, there are three ways to perform hyper-parameter tuning, which are Grid search,  Randomised Search, and Gradient-based optimisation. Please check this blog to know more about it.



12.How are we going to Test the strength and stability of trends when predicting forex?



Ans: It completely depends on what trend you are looking for and how you defined a trend. A stronger trend gives you more returns in less time whereas a stable trend lasts for a longer time. So, the strength of the trend can be tested by studying the rate of change in price and the stability of the trend can be tested by identifying how long the trend lasted. 



13.How to control the Overfitting and Underfitting situation of the model.



Ans: It depends on the model you are using and the use case. However, in general, you can counter overfitting/underfitting by performing cross-validation, increasing the size of training data, feature engineering and optimising the hyperparameters of the model. For more/specific details and strategies to counter underfitting/overfitting, please give more details of the model and the use case.



14.In the LSTM or GRU model how we handle the gradient vanishing and gradient boosting problems.



Ans: The gradient vanishing /boosting is a problem with Recurrent Neural Networks (RNNs) but not with LSTM. While implementing RNN,  these issues are handled by us by optimising the weights of layers and also selecting the appropriate activation function for the problem. However, LSTM handles this problem by itself without our intervention. If you want to know how LSTM handles this, you can post a separate question on this in the community and it will be answered. 



15.How we achieve the global minima of the model.and how we know the point is the global minima of the model.



Ans: Do you mean global minima of the cost function of the model? 

The most common method to find global minima in ML scenarios is the gradient descent algorithm. It is an iterative first-order optimisation algorithm used to find a local minimum/maximum of a given function. 



However, it might not always give you global minima of the function but gives you an optimum local minima. But its works well for most of the optimisation cases of ML models. 

This is because the gradient descent works well only for convex functions. For non-convex functions and non-differentiable functions, the gradient descent fails.



Please go through