Machine Learning, Markov Chains, Statistics, NLP, Fun.
will be non-zero. Because of that, I used scipy’s dok_matrix ( dok stands for Dictionary of Keys), a sparse matrix implementation, since we know this dataset is going to be extremely sparse. After initializing our matrix, sampling it is pretty intuitive. Here’s the code for that: There are two