Hi Nicolas,

I tried your Code and my script also crashed.

However, I think you might have forgotten to scale your input before 
using the SVR.

Try this instead:

from sklearn.svm import SVR
from sklearn.preprocessing import StandardScaler
import numpy as np

X=np.array([[    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ],
         [    40.8      ],
         [ 21327.5900838],
         [ 28781.2890295],
         [ 29978.2941176],
         [ 30732.562406 ]])
y=np.array([ 0.1,  0.1,  0.1,  0.1,  0.1,  0.2,  0.2,  0.2,  0.2, 0.2,
0.3,
          0.3,  0.3,  0.3,  0.3,  0.4,  0.4,  0.4,  0.4,  0.4,  0.5, 0.5,
          0.5,  0.5,  0.5,  0.6,  0.6,  0.6,  0.6,  0.6,  0.7,  0.7, 0.7,
          0.7,  0.7,  0.8,  0.8,  0.8,  0.8,  0.8,  0.9,  0.9,  0.9, 0.9,
          0.9])
weights=np.array([ 1.        ,  0.75      ,  1.        , 0.88867188,
0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
          1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391],
dtype=np.float16)


X =StandardScaler().fit_transform(X)

svr_poly = SVR(kernel='poly', C=1e3, degree=2, verbose=True)


fit = svr_poly.fit(X, y, weights)


This is working for me.
Don't forget to fit your StandardScaler to your training set and using 
the training mean and scale on your test/validation set.


Greets,
Piotr




On 21.04.2016 13:32, Nicolas Cedilnik wrote:
> Hi all,
>
> I'm trying to use scikit-learn to do SV regression and this small data
> set causes it to crash every time. I can't even stop the process with
> CTRL+C and have to kill the process some other way. I've tested it on
> python 3.5 and 2.7.
>
> Am I doing something wrong or should I report a bug?
>
> Here's some copy-pastable code to reproduce the issue:
>
> from sklearn.svm import SVR
> import numpy as np
>
> X=np.array([[    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ],
>          [    40.8      ],
>          [ 21327.5900838],
>          [ 28781.2890295],
>          [ 29978.2941176],
>          [ 30732.562406 ]])
> y=np.array([ 0.1,  0.1,  0.1,  0.1,  0.1,  0.2,  0.2,  0.2,  0.2, 0.2,
> 0.3,
>           0.3,  0.3,  0.3,  0.3,  0.4,  0.4,  0.4,  0.4,  0.4,  0.5, 0.5,
>           0.5,  0.5,  0.5,  0.6,  0.6,  0.6,  0.6,  0.6,  0.7,  0.7, 0.7,
>           0.7,  0.7,  0.8,  0.8,  0.8,  0.8,  0.8,  0.9,  0.9,  0.9, 0.9,
>           0.9])
> weights=np.array([ 1.        ,  0.75      ,  1.        , 0.88867188,
> 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391,
>           1.        ,  0.75      ,  1.        ,  0.88867188, 0.66650391],
> dtype=np.float16)
>
> svr_poly = SVR(kernel='poly', C=1e3, degree=2)
> fit = svr_poly.fit(X, y, weights)
>
> -- Nicolas Cedilnik
>
> PS: this is not the 'real' data I need the regression on.
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to