{"action":"created","issue":{"url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/154","labels_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/154/comments","events_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/154/events","html_url":"https://github.com/QuantEcon/QuantEcon.py/pull/154","id":78376308,"number":154,"title":"Random MarkovChain","user":{"login":"oyamad","id":7353083,"avatar_url":"https://avatars.githubusercontent.com/u/7353083?v=3","gravatar_id":"","url":"https://api.github.com/users/oyamad","html_url":"https://github.com/oyamad","followers_url":"https://api.github.com/users/oyamad/followers","following_url":"https://api.github.com/users/oyamad/following{/other_user}","gists_url":"https://api.github.com/users/oyamad/gists{/gist_id}","starred_url":"https://api.github.com/users/oyamad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oyamad/subscriptions","organizations_url":"https://api.github.com/users/oyamad/orgs","repos_url":"https://api.github.com/users/oyamad/repos","events_url":"https://api.github.com/users/oyamad/events{/privacy}","received_events_url":"https://api.github.com/users/oyamad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-20T05:15:38Z","updated_at":"2015-08-04T13:23:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/pulls/154","html_url":"https://github.com/QuantEcon/QuantEcon.py/pull/154","diff_url":"https://github.com/QuantEcon/QuantEcon.py/pull/154.diff","patch_url":"https://github.com/QuantEcon/QuantEcon.py/pull/154.patch"},"body":"~~(This is not yet ready to merge.)~~\r\n\r\nI wrote some functions that generate random `MarkovChain` or stochastic matrix. I hope this module will be useful at least for developers and probably for users as well.\r\n\r\n0. `random_probvec` generates random probability vectors (whose entries are nonnegative and sum to one). (Note that just generating random numbers from [0, 1] and divide them by the sum would generate probability values that are skewed toward 0.5.)\r\n\r\n0. If one wants an n x n stochastic matrix with a small number of states with positive probabilities for each row, where the number k of such states must be common across states here, then k integers have to be chosen randomly from 0, 1, ..., n-1, which is done by `random_choice_without_replacement`.\r\n\r\n0. `random_markov_chain` will support sparse matrix format once `MarkovChain` does.\r\n\r\n0. `random_choice_without_replacement(n, k, num_trials=None)` is equivalent to `np.random.choice(n, k, replace=False)` and is much (100x?) faster with Numba.\r\n\r\n0. `random_choice_without_replacement` may be included in `utilities.py`. Its name seems too long. Anybody have any idea?\r\n\r\n0. API regarding `random_state` will be modified once we fix a common interface (I opened a new issue #153 to discuss this).\r\n"},"comment":{"url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/comments/127609258","html_url":"https://github.com/QuantEcon/QuantEcon.py/pull/154#issuecomment-127609258","issue_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/154","id":127609258,"user":{"login":"jstac","id":3887684,"avatar_url":"https://avatars.githubusercontent.com/u/3887684?v=3","gravatar_id":"","url":"https://api.github.com/users/jstac","html_url":"https://github.com/jstac","followers_url":"https://api.github.com/users/jstac/followers","following_url":"https://api.github.com/users/jstac/following{/other_user}","gists_url":"https://api.github.com/users/jstac/gists{/gist_id}","starred_url":"https://api.github.com/users/jstac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstac/subscriptions","organizations_url":"https://api.github.com/users/jstac/orgs","repos_url":"https://api.github.com/users/jstac/repos","events_url":"https://api.github.com/users/jstac/events{/privacy}","received_events_url":"https://api.github.com/users/jstac/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T13:23:29Z","updated_at":"2015-08-04T13:23:29Z","body":"I support having a `markov` subpackage.  \r\n\r\nI feel that names like `qe.markov.random.probvec` etc are too verbose.  I propose that we put this function in somewhere like `util` and perhaps make it visible in the top level `qe` namespace.  I'm not sure about `random_stochastic_matrix`.  Either subpackage would be fine."}}