lundi 5 août 2019

Are there some functions or libraries in Python for generating matrices with special conditions?

I'm writing dataset generator on Python and I got following problem: I need a set of zero-one matrices with no empty cols/rows. Also the ratio between zeros and ones should be constant.

I've tried to shuffle zero-one list with fixed ratio of zeros and ones with following reshaping, but for matrices with hungreds of rows/cols it 's too long. Also I took into account that I can't achive some inputs like 3*10 matrix with 9 one-elements and that some inputs can have only solution like 10*10 matrix with 10 one-elements.

Thanks for reading!




Aucun commentaire:

Enregistrer un commentaire