Matrix of integers to boolean matrix

149 Views Asked by At

My Question is about converting a matrix of numbers, say each row is an item and each column is a feature of the item. The features are currently integers but I want to convert the feature quantification to boolean (i.e., 0 or 1).

One way I thought to solve this is to get the position of the top 5% per each row (it could be any value really) and if a feature has a value greater than it, the 1, else 0.

But I was wondering if there are other suggestions, perhaps mathematically, to convert rows of features in a matrix to boolean.

-thx