Learning a threshold from a matrix I have a 2D matrix, and I want to learn a threshold from this matrix. All items in the matrix bigger than the threshold will become 1s, and all smaller than the threshold will become 0s. Then, I have a differentiable loss function to evaluate the resulting 0-1 matrix. What methods are typically used to learn the threshold? Do we put the matrix across a network, or are there any non-neural-network methods?
The hierarchy of methods for thresholds are:


Hand-coded thresholds
Learned thresholds with a decision tree 
Learned thresholds with an ensemble of trees (e.g., Random Forest or XGBoost)
Learned thresholds with neural networks