Hey Guys!

thanks a lot for explaining me the details. Could you please explain
following:

i) So basically more would be the distance, it would be deeper in the
hyperplane, more confident would be the prediction? If the predicted label
is 1, it means the decision function will provide the distance of this
sample in the hyperplane?

ii) Can I rank the predictions on the basis of distance (strong predictions
are having more distance as compared to the weak ones?

iii) Also I was using predict_proba function to plot ROC for SVM (svc
method) as shown below, but as probabilities of the classes are not always
consistent with the predictions always. So would it give true ROC curve?

*y_score = rbf_svc.predict_proba(X_test)*

prec = precision_score(y_test, y_pred, average='micro')

rec = recall_score(y_test, y_pred, average='micro')

fscore = fbeta_score(y_test, y_pred, average='micro', beta=0.5)

* areaRoc = roc_auc_score(y_test, y_score[:,1])*

#Generate ROC curve for each cross-validation

fpr, tpr, thresholds = roc_curve(y_test, y_score[:,1], pos_label = 1)  #Pos
level for positive class

precision, recall, threshold = precision_recall_curve(y_test, y_score[:,1])

 random_mean_auc_10 = auc(fpr, tpr)

thanks!

Shalu



On Thu, Feb 26, 2015 at 5:39 PM, Artem <barmaley....@gmail.com> wrote:

> 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
>
>
------------------------------------------------------------------------------
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