dantheman
dantheman

Reputation: 131

Flux.jl restrict variables between 0 and 1

I would like each item in my output feature vector to be between 0 and 1 (The truth vector is a bunch of independent binary values). Eventually, with training it approaches this but I assume there is a way to restrict the variable to a range, thus allowing it to converge more quickly.

This is NOT softmax. softmax turns a vector into a distrubution which sums to one but I want each item in the vector to be restricted to the range 0 - 1.

Upvotes: 1

Views: 135

Answers (1)

Chris Rackauckas
Chris Rackauckas

Reputation: 19142

Constraints like this can be added by utilizing an activation function on the last layer. Add a sigmoid on the output to make it in [0,1]. Add exp on the last layer to make it [0,infty). Etc.

Upvotes: 2

Related Questions