Revert "threshold change n_keep to cost"

This reverts commit fdfbd4720f9a8eabcf81216024db5cdd5dbc1f47.
revert