Hi Shalu

decision_function returns (signed) distance to each of separating
hyperplanes. There's one hyperplane for each pair of classes, so in case of
2 classes there'd be one hyperplane. Iris dataset contains 3 classes, so
there are 3 possible pairs, and thus 3 columns in the result of
decision_function.

On Thu, Feb 26, 2015 at 7:28 PM, shalu jhanwar <shalu.jhanwa...@gmail.com>
wrote:

> Hi guys,
>
> I'm facing a problem when I am using decision_function in svm classifier.
> I have *2 classes*, but decision function is returning an array with *one
> column* only. Decision_function is working fine with iris dataset. I'm
> afraid if I am doing something wrong while reading my files/data.
>
> Any suggestions where might be the problem?
>
> thanks!
>
> P.S.: Please find here a chunk of the code:
>
> I'm reading my tab-delimited files as:
>
> data_cols = [2, 3, 4, 5, 6]
>
> X_train = np.loadtxt(data_file, usecols=data_cols, delimiter = "\t")
>
> y_train = np.genfromtxt(data_file,  usecols = label_col, delimiter = "\t")
>
> X_test = np.loadtxt(test_file, usecols=data_cols, delimiter = "\t")
>
> y_test = np.genfromtxt(test_file,  usecols = label_col, delimiter = "\t")
> *Although it converts all the values in scientific format while reading
> the files*
> And I am calling decision functions as:
>
> rbf_svc = svm.SVC(kernel='rbf',probability=True, C=C_val, gamma = g_val)
>
> scores = rbf_svc.fit(X_train, y_train).score(X_test, y_test)
>
> y_pred = rbf_svc.predict(X_test)
>
> #y_score = rbf_svc.predict_proba(X_test)
>
> y_score = rbf_svc.decision_function(X_test)
>
> predict_proba gave array with 2 columns but decision_function returned an
> array with one column only.
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to