threshold
sets values of a vector/matrix below
min
to min
; values above max
are set
to max
.
threshold
is mainly used to project sparsified
weight vectors (sparsify_weights
) back onto
the probability simplex (thus min = 0
and then
normalize
).
threshold(x, min = -Inf, max = Inf)
a numeric matrix(like object)
minimum value
maximum value
# NOT RUN {
print(threshold(c(1, 4, 2, -1, 10), min = 0))
# }
Run the code above in your browser using DataLab