title: Enforcing that inputs sum to 1 and are contained in the unit interval in scikit-learn
body: <p>I have three inputs: <code>x=(A, B, C)</code>; and an output <code>y</code>. It needs to be the case that <code>A+B+C=1</code> and <code>0&lt;=A&lt;=1</code>, <code>0&lt;=B&lt;=1</code>, <code>0&lt;=C&lt;=1</code>. I want to find the <code>x</code> that maximizes <code>y</code>. My approach is to use a regression routine in scikit-learn to train a model <code>f</code> on my inputs <code>x</code> and outputs <code>y</code>, and then use <code>numpy.argmax</code> on <code>f</code> to find <code>x_best</code>. How can I ensure that <code>x_best=(A,B,C)</code> sum to 1 and are all within the unit interval? Is there some special encoding I can use? </p>