Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ONE CLASS #24

Closed
matus-pikuliak opened this issue Nov 7, 2015 · 5 comments
Closed

ONE CLASS #24

matus-pikuliak opened this issue Nov 7, 2015 · 5 comments
Labels

Comments

@matus-pikuliak
Copy link

Hey,
I am trying to use your gem to make one-class svm work. I was just trying to make it work with the modified example code:

problem = Libsvm::Problem.new

parameter = Libsvm::SvmParameter.new
parameter.cache_size = 1 # in megabytes
parameter.eps = 0.001
parameter.nu = 0.5
parameter.svm_type = Libsvm::SvmType::ONE_CLASS

examples = [ [1,1,1], [0,0,0] ].map {|ary| Libsvm::Node.features(ary) }
labels = [1,1]
problem.set_examples(labels, examples)

model = Libsvm::Model.train(problem, parameter)

puts model.predict(Libsvm::Node.features(1, 1, 1))
puts model.predict(Libsvm::Node.features(0, 0, 0))
puts model.predict(Libsvm::Node.features(100, 100, 100))

However the output is -1 -1 -1 insted of 1 1 -1 as I would expect. What am I doing wrong?

@febeling
Copy link
Owner

febeling commented Nov 8, 2015

If you're just getting started with SVM usage your best bet is probably exploring by using larger data sets and graphing them continuously while changing the parameters.

Or if you think it's a bug it would be helpful to have an example using LIBSVM via command line tools or another binding in order to compare where results diverge.

@pbssubhash
Copy link

@matus-pikuliak Did it work?

I see the same error and can't a reliable way out! Did you get a chance to find the solution? If yes, could you please share..

@febeling : Isn't there official support for One Class classification for this Ruby wrapper?

Thanks.

@febeling
Copy link
Owner

@pbssubhash Nothing in this library prevents you from using one-class configuration.

@pbssubhash
Copy link

@febeling
So, how do I go about configuring it for One class?
Is it the same way used in the example?

Thanks.

@febeling
Copy link
Owner

febeling commented Feb 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants