Skip to content

Conversation

@samueldjack
Copy link

Hi Anatoliy,
Thanks for your work on porting LibSvm to C#.

For one I've my projects I needed to load a libsvm model that had been trained using other tools, so I implemented the the svm_load_model function which was previously commented out.

I haven't done a whole lot of testing on my code - I just know that it works to load in my model.

So you're welcome to pull this code back into your own project if you think it would be useful.

Thanks,

Sam

@antlypls
Copy link
Owner

Hey Sam!
Thanks for your contribution! I'm glad to hear that this project is helpful to someone else.

I merged your commit to separate branch called load_model.
I reformatted and refactored your code a little bit. So i'm going to merge and close your pull request, when i test it with my changes.
Can you provide your model files, i'll use it for tests?

Btw, long term idea is to create test suits based on libsvm data sets.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know it was in original code. but i don't think that it's a good idea to close stream here. stream must be closed by invoking code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not how I would have written it myself. Because I wasn't sure of your code-porting philosophy, I tried to keep the code as close as possible to the original java. Idiomatic C# would obviously have removed the explicit Close(), and wrapped the whole block in a using(..) statement.

If I get a chance, I'll make the change - or feel free to do it yourself if you like.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samueldjack Right. Main idea is to keep math code close to java version, to be able easily update it, when next version of original libsvm will be released.
But for future releases of LibSvmSharp I plan, that main library will contain only learning methods and some basic wrappers. And all helpers, like reading/writing model files, move to separate assembly, and implement it in C# way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants