{"action":"created","issue":{"url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/131","repository_url":"https://api.github.com/repos/hmmlearn/hmmlearn","labels_url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/131/comments","events_url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/131/events","html_url":"https://github.com/hmmlearn/hmmlearn/issues/131","id":162403530,"number":131,"title":"Memory error : HMM for MFCC feautres","user":{"login":"epratheeban","id":15340153,"avatar_url":"https://avatars.githubusercontent.com/u/15340153?v=3","gravatar_id":"","url":"https://api.github.com/users/epratheeban","html_url":"https://github.com/epratheeban","followers_url":"https://api.github.com/users/epratheeban/followers","following_url":"https://api.github.com/users/epratheeban/following{/other_user}","gists_url":"https://api.github.com/users/epratheeban/gists{/gist_id}","starred_url":"https://api.github.com/users/epratheeban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epratheeban/subscriptions","organizations_url":"https://api.github.com/users/epratheeban/orgs","repos_url":"https://api.github.com/users/epratheeban/repos","events_url":"https://api.github.com/users/epratheeban/events{/privacy}","received_events_url":"https://api.github.com/users/epratheeban/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-06-27T08:57:25Z","updated_at":"2016-07-12T10:52:02Z","closed_at":null,"body":"I am trying to create audio vocabulary from MFCC features by applying HMM. Since I have 10 speakers in the MFCC features. I need 50 states per speaker. So I used N = 500 states and it throws Memory error, but  it works fine with N =100 states.\r\n\r\n`Memory Error` is because of computational in efficiency of a machine or due to in proper initialization?\r\n  \r\nHere is my code\r\n\r\n```\r\nimport numpy as np\r\nfrom hmmlearn import hmm\r\nimport librosa\r\nimport matplotlib.pyplot as plt\r\n\r\ndef getMFCC(episode):\r\n    \r\n    filename = getPathToGroundtruth(episode)\r\n    \r\n    y, sr = librosa.load(filename)  # Y gives \r\n    \r\n    data = librosa.feature.mfcc(y=y, sr=sr)\r\n    \r\n    return data\r\n\r\ndef hmm_init(n,data):  #n = states d = no of feautures\r\n    \r\n    states =[]\r\n    \r\n    model = hmm.GaussianHMM(n_components=N, covariance_type=\"full\")\r\n    \r\n    model.transmat_ = np.ones((N, N)) / N\r\n    \r\n    model.startprob_ = np.ones(N) / N\r\n    \r\n    fit = model.fit(data.T)\r\n    \r\n    z=fit.decode(data.T,algorithm='viterbi')[1]\r\n     \r\n    states.append(z)\r\n    \r\n    return states\r\n\r\ndata_m = getMFCC(1)  # Provides MFCC features of numpy array [20 X 56829]\r\n\r\nN = 500\r\n\r\nD= len(data)\r\n\r\nstates = hmm_init(N,data)\r\n\r\nIn [23]: run Final_hmm.py\r\n---------------------------------------------------------------------------\r\nMemoryError                               Traceback (most recent call last)\r\n/home/elancheliyan/Final_hmm.py in <module>()\r\n     73 D= len(data)\r\n     74 \r\n---> 75 states = hmm_init(N,data)\r\n     76 states.dump(\"states\")\r\n     77 \r\n\r\n/home/elancheliyan/Final_hmm.py in hmm_init(n, data)\r\n     57     model.startprob_ = np.ones(N) / N\r\n     58 \r\n---> 59     fit = model.fit(data.T)\r\n     60 \r\n     61     z=fit.decode(data.T,algorithm='viterbi')[1]\r\n\r\n/cal/homes/elancheliyan/.local/lib/python3.5/site-packages/hmmlearn-0.2.1-py3.5-linux-x86_64.egg/hmmlearn/base.py in fit(self, X, lengths)\r\n    434                 self._accumulate_sufficient_statistics(\r\n    435                     stats, X[i:j], framelogprob, posteriors, fwdlattice,\r\n--> 436                     bwdlattice)\r\n    437 \r\n    438             # XXX must be before convergence check, because otherwise\r\n\r\n/cal/homes/elancheliyan/.local/lib/python3.5/site-packages/hmmlearn-0.2.1-py3.5-linux-x86_64.egg/hmmlearn/hmm.py in _accumulate_sufficient_statistics(self, stats, obs, framelogprob, posteriors, fwdlattice, bwdlattice)\r\n    221                                           posteriors, fwdlattice, bwdlattice):\r\n    222         super(GaussianHMM, self)._accumulate_sufficient_statistics(\r\n--> 223             stats, obs, framelogprob, posteriors, fwdlattice, bwdlattice)\r\n    224 \r\n    225         if 'm' in self.params or 'c' in self.params:\r\n\r\n/cal/homes/elancheliyan/.local/lib/python3.5/site-packages/hmmlearn-0.2.1-py3.5-linux-x86_64.egg/hmmlearn/base.py in _accumulate_sufficient_statistics(self, stats, X, framelogprob, posteriors, fwdlattice, bwdlattice)\r\n    620                 return\r\n    621 \r\n--> 622             lneta = np.zeros((n_samples - 1, n_components, n_components))\r\n    623             _hmmc._compute_lneta(n_samples, n_components, fwdlattice,\r\n    624                                  log_mask_zero(self.transmat_),\r\n\r\nMemoryError:\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/comments/232005631","html_url":"https://github.com/hmmlearn/hmmlearn/issues/131#issuecomment-232005631","issue_url":"https://api.github.com/repos/hmmlearn/hmmlearn/issues/131","id":232005631,"user":{"login":"epratheeban","id":15340153,"avatar_url":"https://avatars.githubusercontent.com/u/15340153?v=3","gravatar_id":"","url":"https://api.github.com/users/epratheeban","html_url":"https://github.com/epratheeban","followers_url":"https://api.github.com/users/epratheeban/followers","following_url":"https://api.github.com/users/epratheeban/following{/other_user}","gists_url":"https://api.github.com/users/epratheeban/gists{/gist_id}","starred_url":"https://api.github.com/users/epratheeban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epratheeban/subscriptions","organizations_url":"https://api.github.com/users/epratheeban/orgs","repos_url":"https://api.github.com/users/epratheeban/repos","events_url":"https://api.github.com/users/epratheeban/events{/privacy}","received_events_url":"https://api.github.com/users/epratheeban/received_events","type":"User","site_admin":false},"created_at":"2016-07-12T10:52:02Z","updated_at":"2016-07-12T10:52:02Z","body":"@superbobry  Please note that , In the given code tryhmm.py. I used `covariance_type=\"diag\"` but previously I tried with `covariance_type=\"full\"`. \r\n"}}
{"actor":{"display_login":"epratheeban"}}