Comments (11)
decision values are always the same, I need to know every predict data probability result .
from libsvm.
Hi,
I also need probabilities in one class SVM for my project. Previous request request was made 2 years ago but the feature wasn't implemented.
Please consider, Thanks
from libsvm.
@Al-Murphy If the probabilities values are very close to 0 or 1, it could mean that the variance of error of your classification is very low. With reference to the image in your StackOverflow post, this might be the case since your actual data is easily separable. Maybe try it on data that has some higher error variance?
I would like to note though, the project I was using this for changed and is not needed so I have not been using this on various amounts of data.
@mattsliv, sorry to dig this thread up but did you implement that approach you have written above? I tried to take a similar approach in R but it would appear the cross-validated logistic regression model applied to the results of the one-class svm separates the data perfectly so I get probabilities extremely close to 0 or 1. I have a stackoverflow post showing a nice visual of my issue.
from libsvm.
One-class svm prob outputs were introduced in version 3.3 in August 2022. Sorry for the delay.
from libsvm.
We don't have that yet.. You can use decision values to get
prob outputs but it's unclear yet if the result is good..
Jianghua.yjh writes:
I need to probability of one-class svm, thanks.
please consider.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the
thread.*
from libsvm.
Hi,
with one-class you can use 'svm_predict_values' function and get 'x' decision value. It's not probability, but maybe it could be useful.
See
Line 2577 in 3648ef3
from libsvm.
Any new methods?
from libsvm.
You can use Platt Scalling to create a probability distribution from the outputs of your one-class SVM.
Essentially, it fits a logistic regression model with cross-validation on your one-class SVM predictions to get the probability values you would normally get with the predict_proba(X)
function.
Let oc_svm
be your one-class SVM and X
be the data you fitted oc_svm
on. To get the probability estimates you are looking for, you can do something like this.
# Imports
from sklearn.linear_model import LogisticRegressionCV as LRCV
from sklearn.model_selection import train_test_split
def platt_scale(oc_svm, X, train_size, cv_size):
# Get SVM predictions
y_pred = oc_svm_.predict(X)
# Split the data and SVM labels
X_train, _, y_train, _ = train_test_split(X, y_pred, train_size=train_size)
# Train using logistic regression with cross-validation
lr = LRCV(cv=cv_size)
lr.fit(X_train, y_train)
return lr.predict_proba(X)
from libsvm.
@mattsliv, sorry to dig this thread up but did you implement that approach you have written above? I tried to take a similar approach in R but it would appear the cross-validated logistic regression model applied to the results of the one-class svm separates the data perfectly so I get probabilities extremely close to 0 or 1. I have a stackoverflow post showing a nice visual of my issue.
from libsvm.
Sad to see this useful feature is still not implemented 7 years after the initial request.
from libsvm.
Fantastic! Thanks!
from libsvm.
Related Issues (20)
- Linux wheel support in github workflow HOT 6
- PyPi package confusion HOT 1
- Include license information in Python package HOT 1
- with linux is ok, but Windows or Mac print this, why? I'm sure shrinking = 1 HOT 1
- How can I get decision or w and b,i am a linear kernel ,with C++ Code HOT 1
- How to use the saved trained svm model file manually HOT 1
- how can i improve train speed? HOT 1
- why my memory always HOT 1
- Some dataset problem HOT 2
- static library HOT 1
- gridregression.py
- LIBSVM library not found HOT 1
- gridregression.py 出现 RuntimeError: get no mse HOT 2
- Exception Thrown: read access violation HOT 1
- 使用svm-train.exe做回归(regression),参数c与g如何优化 HOT 1
- How to modify SVR loss function? HOT 1
- Accuracies lower than 50% if the random seed is unlucky HOT 8
- one class svm HOT 1
- Questions about the results of libSVM HOT 6
- Questions about probability estimation of one-class svm HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsvm.