Created
October 25, 2018 10:06
-
-
Save NMZivkovic/8d07f9efaedaf4d6429c8eb6b2e26594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hmmlearn.hmm import GaussianHMM | |
class StockPredictor(object): | |
def __init__(self, company, n_latency_days=10, n_hidden_states=4): | |
self._init_logger() | |
self.company = company | |
self.n_latency_days = n_latency_days | |
self.hmm = GaussianHMM(n_components=n_hidden_states) | |
self.data = pd.read_csv( | |
'data/company_data/{company}.csv'.format(company=self.company)) | |
def fit(self): | |
self._logger.info('>>> Extracting Features') | |
feature_vector = StockPredictor._extract_features(self.data) | |
self._logger.info('Features extraction Completed <<<') | |
self.hmm.fit(feature_vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment