hmm은 다음과 같은 과정
sample -(decoding)-> state -(trans mat)-> next_state -(encoding)-> next_sample
환율과 원자재 데이터로 금값 예측 (1)
다음과 같은 단계로 진행예정
(https://dashboardstream.com/the-6-steps-in-business-forecasting/참고함)
- indentify the problem
- Collect Information
model과 domain에 대한 조사
- Perform a Preliminary Analysis
plotting
- Choose the Forecasting Model
hmm (+regression, exponential smoothing, ARIMA)
본 프로젝트는 모델은 HMM으로 한정되어있지만, 라이브러리는 hmmlearn외에도 사용가능하다.
- data analysis
- verify model performance
test.py에서 [1일 전 diff(sample)]에서 state 추출해서 구한 diff를 current_price (= past_price[idx])에 더해 predict와 target_price
향후 리뷰할 자료들
hmm과 timeseries
http://lasa.epfl.ch/teaching/lectures/ML_MSc_Advanced/Slides/Lec_XI_HMM_extensions.pdf
HMM이 시계열예측에 이용되려면,
예측을 위해 추세를 파악하는 것이 중요하다
[model]
transition matrix에 대한 관찰 필요
각 state 모두 한 번 정해지면 그 state 를 계속 유지하려는 경향이 있다. 즉 증가하던 금값은 계속 증가하고, 감소중인 금값은 계속 감소하게 된다는 것
https://en.wikipedia.org/wiki/Hidden_Markov_model
Learning
The parameter learning task in HMMs is to find, given an output sequence or a set of such sequences, the best set of state transition and emission probabilities. The task is usually to derive the maximum likelihood estimate of the parameters of the HMM given the set of output sequences. No tractable algorithm is known for solving this problem exactly, but a local maximum likelihood can be derived efficiently using the Baum–Welch algorithm or the Baldi–Chauvin algorithm. The Baum–Welch algorithm is a special case of the expectation-maximization algorithm. If the HMMs are used for time series prediction, more sophisticated Bayesian inference methods, like Markov chain Monte Carlo (MCMC) sampling are proven to be favorable over finding a single maximum likelihood model both in terms of accuracy and stability. Since MCMC imposes significant computational burden, in cases where computational scalability is also of interest, one may alternatively resort to variational approximations to Bayesian inference, e.g.[18] Indeed, approximate variational inference offers computational efficiency comparable to expectation-maximization, while yielding an accuracy profile only slightly inferior to exact MCMC-type Bayesian inference.
[domain]
최근 금값 하락중
금은 안정적인 자산
http://naver.me/FbchIQ1T
예측을 위해 먼저 y값과 설명변수들 plotting 해보자 – 다음 포스팅에서
하나로 쭉 미는 금값예측 모형과 비교
Comment is the energy for a writer, thanks!