سؤال

There is a time series of say $100$ data points. I wish to assign symbols of $0, 1, 2$ for each unique data point. The issue is I have tried but got stuck since no matter I specify the symbols, the program just outputs probability of $1$'s and $0$'s. The following are the questions:

  1. How to find probability or correct my code so that it outputs probablities when number of symbols size > 2?
  2. How to calculate entropy annd mutual information for this case. I don't know although I have read Matlab's entropy calculation Mutual Information & Entropy but alas cannot follow how to apply in this case.
هل كانت مفيدة؟

المحلول

Entropy is, in your case

probs = [p_0 p_1 p_2];
logProb = log(probs);
entropy = -1 * dot(probs, logProb);

You'll have to let us know what two random variables you want to calculate the mutual information of, but with your library it looks like you just need to call mutualinfo(vec1,vec2).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى cs.stackexchange
scroll top