Generating evenly spaced triplets of probabilities in Python

I need to test different discrete probability distributions and it happens that I need triplets but it can probably be generalized to higher number of elements. I would like to cover the space quite evenly. For example, for a step of 2, I would like something of the kind of : [[0,0,1],[0,0.5,0.5],[0,1,0],[0.5,0,0.5],[0.5,0.5,0],[1,0,0]] My current idea… Read More Generating evenly spaced triplets of probabilities in Python

Distance metric with different sized lists (Python)

I am trying to find the jensen shannon distance metric between two distributions. However I am getting a ValueError because the two lists (probability distributions) are not the same size. How can I overcome this? Here is the current code: from scipy.spatial import distance distance.jensenshannon([0.1, 0.1, 0.3, 0.2, 0.30], [0.30, 0.50, 0.20]) >> ValueError: operands… Read More Distance metric with different sized lists (Python)

How to tune random.choice probability – python –

I made a function that randomly selects one from a list of texts. def ttc(*arg): a = random.choice([*arg]) return ”.join(a) print(ttc("Price", "Condition", "Loan")) print(ttc("entertainment", "geese", "Uruguay", "comedy", "butterfly")) But I found it necessary to make certain words have a higher probability of being selected. For example, can we change the probability of being selected sequentially… Read More How to tune random.choice probability – python –