I am trying to generate multiple (#: 100) random column stochastic matrices using a for loop and save them.
Below code is to generate an individual random column stochastic matrix.
import numpy as np
import random
a = 2
sto = np.I(2)
sto = sto + np.random.uniform(low=0.3, high=.2, size=(a, a))
sto = sto/sto.sum(axis=0, keepdims=1)
print(sto)
When I try to implement the operation to generate 100 matrices with a for loop I fail - all matrices generated turn out to be the same.
How can I use the for loop to generate such matrices and save them all for later work?
Aucun commentaire:
Enregistrer un commentaire