<div dir="ltr">







<p class=""><span class="">import</span><span class=""> numpy </span><span class="">as</span><span class=""> np</span></p><p class=""><span class="">import</span><span class=""> nose</span><span class="">.</span><span class="">tools </span><span class="">as</span><span class=""> nt</span></p>
<p class=""><span class="">from</span><span class=""> sklearn</span><span class="">.</span><span class="">isotonic </span><span class="">import</span><span class=""> isotonic_regression</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">def</span><span class=""> test_isotonic_ymin_ymax</span><span class="">():</span></p>
<p class=""><span class="">    X </span><span class="">=</span><span class=""> np</span><span class="">.</span><span class="">array</span><span class="">([</span><span class="">1.26</span><span class="">,</span><span class=""> </span><span class="">1.31</span><span class="">,-</span><span class="">0.57</span><span class="">,</span><span class=""> </span><span class="">0.30</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">0.70</span><span class="">,</span></p>
<p class=""><span class="">                  </span><span class="">-</span><span class="">0.17</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">1.59</span><span class="">,</span><span class=""> </span><span class="">1.05</span><span class="">,</span><span class=""> </span><span class="">1.39</span><span class="">,</span><span class=""> </span><span class="">1.90</span><span class="">,</span></p>
<p class=""><span class="">                  </span><span class="">0.20</span><span class="">,</span><span class=""> </span><span class="">0.03</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">0.08</span><span class="">,</span><span class=""> </span><span class="">0.44</span><span class="">,</span><span class=""> </span><span class="">0.01</span><span class="">,</span></p>
<p class=""><span class="">                  </span><span class="">-</span><span class="">0.37</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">0.89</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">0.37</span><span class="">,</span><span class=""> </span><span class="">-</span><span class="">1.32</span><span class="">,</span><span class=""> </span><span class="">0.18</span><span class="">])</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">    X_iso </span><span class="">=</span><span class=""> isotonic_regression</span><span class="">(</span><span class="">X</span><span class="">,</span><span class=""> y_min</span><span class="">=</span><span class="">0.</span><span class="">,</span><span class=""> y_max</span><span class="">=</span><span class="">0.1</span><span class="">)</span></p>
<p class=""><span class="">    nt</span><span class="">.</span><span class="">assert_true</span><span class="">(</span><span class="">np</span><span class="">.</span><span class="">all</span><span class="">((</span><span class="">X_iso </span><span class=""><=</span><span class=""> </span><span class="">0.1</span><span class="">)</span><span class=""> </span><span class="">*</span><span class=""> </span><span class="">(</span><span class="">X_iso </span><span class="">>=</span><span class=""> </span><span class="">0.</span><span class="">)))</span></p>
<p class=""><span class=""></span><br></p>
<p class=""><span class="">test_isotonic_ymin_ymax</span><span class="">()</span></p></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 22, 2016 at 12:27 AM,  <span dir="ltr"><<a href="mailto:scikit-learn-request@python.org" target="_blank">scikit-learn-request@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send scikit-learn mailing list submissions to<br>
        <a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:scikit-learn-request@python.org">scikit-learn-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:scikit-learn-owner@python.org">scikit-learn-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of scikit-learn digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. isotonic regression weird behavior? (Jonathan Taylor)<br>
   2. Re: isotonic regression weird behavior? (Jonathan Taylor)<br>
   3. Re: isotonic regression weird behavior? (Jonathan Taylor)<br>
   4. Re: isotonic regression weird behavior? (Gael Varoquaux)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 21 Jun 2016 19:18:12 -0700<br>
From: Jonathan Taylor <<a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>><br>
To: <a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
Subject: [scikit-learn] isotonic regression weird behavior?<br>
Message-ID:<br>
        <<a href="mailto:CANmCCuSkekfbjH0d450_Cm5V3JYVXsSgEyGtj3pNmA6Ek8CssQ@mail.gmail.com">CANmCCuSkekfbjH0d450_Cm5V3JYVXsSgEyGtj3pNmA6Ek8CssQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Was trying to fit isotonic regression with non-trivial y_min and y_max:<br>
<br>
In [*17*]: X<br>
<br>
Out[*17*]:<br>
<br>
array([ 1.26336413,  1.31853693, -0.57200917,  0.3072928 , -0.70686507,<br>
<br>
       -0.17614937, -1.59943059,  1.05908504,  1.3958263 ,  1.90580318,<br>
<br>
        0.20992272,  0.02836316, -0.08092235,  0.44438247,  0.01791253,<br>
<br>
       -0.3771914 , -0.89577538, -0.37726249, -1.32687569,  0.18013201])<br>
<br>
<br>
In [*18*]: iso.isotonic_regression(X, y_min=0, y_max=0.1)<br>
<br>
Out[*18*]:<br>
<br>
array([-0.00826919, -0.00826919, -0.00826919, -0.00826919, -0.00826919,<br>
<br>
       -0.00826919, -0.00826919,  0.10449344,  0.10449344,  0.10449344,<br>
<br>
        0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344,<br>
<br>
        0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344])<br>
<br>
<br>
The solution does not satisfy the bounds that each entry should be in<br>
[0,0.1]<br>
<br>
<br>
<br>
--<br>
Jonathan Taylor<br>
Dept. of Statistics<br>
Sequoia Hall, 137<br>
390 Serra Mall<br>
Stanford, CA 94305<br>
Tel:   650.723.9230<br>
Fax:   650.725.8977<br>
Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/scikit-learn/attachments/20160621/178cef23/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/pipermail/scikit-learn/attachments/20160621/178cef23/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 21 Jun 2016 19:19:42 -0700<br>
From: Jonathan Taylor <<a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>><br>
To: <a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
Subject: Re: [scikit-learn] isotonic regression weird behavior?<br>
Message-ID:<br>
        <CANmCCuSJH45Z=ZUj+gVzsBAS0CG5iaUXTinfVVnEy4+DLA=<a href="mailto:42g@mail.gmail.com">42g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Should have included:<br>
<br>
In [*22*]: iso<br>
<br>
Out[*22*]: <module 'sklearn.isotonic' from<br>
'/Users/jonathantaylor/anaconda/envs/py27/lib/python2.7/site-packages/sklearn/isotonic.pyc'><br>
<br>
On Tue, Jun 21, 2016 at 7:18 PM, Jonathan Taylor <<br>
<a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>> wrote:<br>
<br>
> Was trying to fit isotonic regression with non-trivial y_min and y_max:<br>
><br>
> In [*17*]: X<br>
><br>
> Out[*17*]:<br>
><br>
> array([ 1.26336413,  1.31853693, -0.57200917,  0.3072928 , -0.70686507,<br>
><br>
>        -0.17614937, -1.59943059,  1.05908504,  1.3958263 ,  1.90580318,<br>
><br>
>         0.20992272,  0.02836316, -0.08092235,  0.44438247,  0.01791253,<br>
><br>
>        -0.3771914 , -0.89577538, -0.37726249, -1.32687569,  0.18013201])<br>
><br>
><br>
> In [*18*]: iso.isotonic_regression(X, y_min=0, y_max=0.1)<br>
><br>
> Out[*18*]:<br>
><br>
> array([-0.00826919, -0.00826919, -0.00826919, -0.00826919, -0.00826919,<br>
><br>
>        -0.00826919, -0.00826919,  0.10449344,  0.10449344,  0.10449344,<br>
><br>
>         0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344,<br>
><br>
>         0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344])<br>
><br>
><br>
> The solution does not satisfy the bounds that each entry should be in<br>
> [0,0.1]<br>
><br>
><br>
><br>
> --<br>
> Jonathan Taylor<br>
> Dept. of Statistics<br>
> Sequoia Hall, 137<br>
> 390 Serra Mall<br>
> Stanford, CA 94305<br>
> Tel:   650.723.9230<br>
> Fax:   650.725.8977<br>
> Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
><br>
<br>
<br>
<br>
--<br>
Jonathan Taylor<br>
Dept. of Statistics<br>
Sequoia Hall, 137<br>
390 Serra Mall<br>
Stanford, CA 94305<br>
Tel:   <a href="tel:650.723.9230" value="+16507239230">650.723.9230</a><br>
Fax:   <a href="tel:650.725.8977" value="+16507258977">650.725.8977</a><br>
Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/scikit-learn/attachments/20160621/2e999af0/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/pipermail/scikit-learn/attachments/20160621/2e999af0/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Tue, 21 Jun 2016 19:21:59 -0700<br>
From: Jonathan Taylor <<a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>><br>
To: <a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
Subject: Re: [scikit-learn] isotonic regression weird behavior?<br>
Message-ID:<br>
        <<a href="mailto:CANmCCuQY33TX884_7owwyz1nAC8tpgQhJoZCYTUxSsSpXbSRHA@mail.gmail.com">CANmCCuQY33TX884_7owwyz1nAC8tpgQhJoZCYTUxSsSpXbSRHA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Sorry, docstring is also a bit funny.<br>
<br>
Is the problem it is trying to solve have an __equality__ constraint for<br>
y_min, y_max or __inequality__ constraint for y_min / y_max?<br>
<br>
Either way the produced solution does not satisfy such a constraint...<br>
<br>
On Tue, Jun 21, 2016 at 7:19 PM, Jonathan Taylor <<br>
<a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>> wrote:<br>
<br>
> Should have included:<br>
><br>
> In [*22*]: iso<br>
><br>
> Out[*22*]: <module 'sklearn.isotonic' from<br>
> '/Users/jonathantaylor/anaconda/envs/py27/lib/python2.7/site-packages/sklearn/isotonic.pyc'><br>
><br>
> On Tue, Jun 21, 2016 at 7:18 PM, Jonathan Taylor <<br>
> <a href="mailto:jonathan.taylor@stanford.edu">jonathan.taylor@stanford.edu</a>> wrote:<br>
><br>
>> Was trying to fit isotonic regression with non-trivial y_min and y_max:<br>
>><br>
>> In [*17*]: X<br>
>><br>
>> Out[*17*]:<br>
>><br>
>> array([ 1.26336413,  1.31853693, -0.57200917,  0.3072928 , -0.70686507,<br>
>><br>
>>        -0.17614937, -1.59943059,  1.05908504,  1.3958263 ,  1.90580318,<br>
>><br>
>>         0.20992272,  0.02836316, -0.08092235,  0.44438247,  0.01791253,<br>
>><br>
>>        -0.3771914 , -0.89577538, -0.37726249, -1.32687569,  0.18013201])<br>
>><br>
>><br>
>> In [*18*]: iso.isotonic_regression(X, y_min=0, y_max=0.1)<br>
>><br>
>> Out[*18*]:<br>
>><br>
>> array([-0.00826919, -0.00826919, -0.00826919, -0.00826919, -0.00826919,<br>
>><br>
>>        -0.00826919, -0.00826919,  0.10449344,  0.10449344,  0.10449344,<br>
>><br>
>>         0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344,<br>
>><br>
>>         0.10449344,  0.10449344,  0.10449344,  0.10449344,  0.10449344])<br>
>><br>
>><br>
>> The solution does not satisfy the bounds that each entry should be in<br>
>> [0,0.1]<br>
>><br>
>><br>
>><br>
>> --<br>
>> Jonathan Taylor<br>
>> Dept. of Statistics<br>
>> Sequoia Hall, 137<br>
>> 390 Serra Mall<br>
>> Stanford, CA 94305<br>
>> Tel:   650.723.9230<br>
>> Fax:   650.725.8977<br>
>> Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Jonathan Taylor<br>
> Dept. of Statistics<br>
> Sequoia Hall, 137<br>
> 390 Serra Mall<br>
> Stanford, CA 94305<br>
> Tel:   <a href="tel:650.723.9230" value="+16507239230">650.723.9230</a><br>
> Fax:   <a href="tel:650.725.8977" value="+16507258977">650.725.8977</a><br>
> Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
><br>
<br>
<br>
<br>
--<br>
Jonathan Taylor<br>
Dept. of Statistics<br>
Sequoia Hall, 137<br>
390 Serra Mall<br>
Stanford, CA 94305<br>
Tel:   <a href="tel:650.723.9230" value="+16507239230">650.723.9230</a><br>
Fax:   <a href="tel:650.725.8977" value="+16507258977">650.725.8977</a><br>
Web: <a href="http://www-stat.stanford.edu/~jtaylo" rel="noreferrer" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/scikit-learn/attachments/20160621/f7c40e1c/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/pipermail/scikit-learn/attachments/20160621/f7c40e1c/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 22 Jun 2016 09:27:06 +0200<br>
From: Gael Varoquaux <<a href="mailto:gael.varoquaux@normalesup.org">gael.varoquaux@normalesup.org</a>><br>
To: Scikit-learn user and developer mailing list<br>
        <<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a>><br>
Subject: Re: [scikit-learn] isotonic regression weird behavior?<br>
Message-ID: <<a href="mailto:20160622072706.GF1018883@phare.normalesup.org">20160622072706.GF1018883@phare.normalesup.org</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Looks like a bug indeed. Could you please put a small code snippet to<br>
enable us to reproduce.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
<br>
<br>
------------------------------<br>
<br>
End of scikit-learn Digest, Vol 3, Issue 37<br>
*******************************************<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Jonathan Taylor                          <br>Dept. of Statistics                      <br>Sequoia Hall, 137                          <br>390 Serra Mall<br>Stanford, CA 94305<br>Tel:   650.723.9230<br>Fax:   650.725.8977<br>Web: <a href="http://www-stat.stanford.edu/~jtaylo" target="_blank">http://www-stat.stanford.edu/~jtaylo</a></div>
</div>