Comments (4)
if you use Weights\ WeightLabels and model , you should reload model. like this is OK:
SaveModel and LoadModel
parameter.WeightLabels = lableFeaturesBuilder.CreateWeightLables("行政湖景双床房").ToArray();
parameter.Weights = new double[] { 1.90, 1.90, 1.90, 1.99, 1.99 };
var model2 = LibSVMsharp.SVM.Train(problem, parameter);
model2.SaveModel("roomMatching.model");
var model = LibSVMsharp.SVM.LoadModel("roomMatching.model");
foreach (var room in rooms1)
{
predictedY = LibSVMsharp.SVM.Predict(model, nodes);
you can see my sample:
https://github.com/zengfr/SVM-Neuro-Matching/blob/master/roomMatching/roomMatching/Program.cs
from libsvmsharp.
Even wrapping them inside try catch causes error :(
The error does not happen if i don't use parameter.WeightLabels
from libsvmsharp.
First, sorry for my late answer.
Could you explain how you use weights for each class?
By using the properties Weights and WeightLabels in SVMParameter?
Please check the lines between 414 and 424 in this link, just to be sure.
from libsvmsharp.
To reproduce this issue just add weights to LibSVMsharp.Examples.Classification:
// Select the parameter set
SVMParameter parameter = new SVMParameter();
parameter.Type = SVMType.C_SVC;
parameter.Kernel = SVMKernelType.RBF;
parameter.C = 1;
parameter.Gamma = 1;
parameter.WeightLabels = new[] { 1, 2, 3 };
parameter.Weights = new[] { 1.0, 2.0, 3.0 };
I think there is an extra call of SVMModel.Free
in SVMModel.Allocate
Commenting this call resolves problem:
// Allocate model.parameter
IntPtr ptr_param = SVMParameter.Allocate(x.Parameter);
y.param = (svm_parameter)Marshal.PtrToStructure(ptr_param, typeof(svm_parameter));
// SVMParameter.Free(ptr_param);
from libsvmsharp.
Related Issues (18)
- SetPrintStringFunction is not working HOT 2
- Marshal.FreeHGlobal(x.rho) got unknown error HOT 5
- is a The endless loop in class SVMModelExtensions HOT 1
- Fail to save the model file HOT 4
- SVM.PredictProbability crashes
- Simple Classification still can't work after installation.
- IS there a x64 version? HOT 4
- The accuracy of c# wrapper version is lower than scikit learn. HOT 1
- Can not modulate the parameters HOT 1
- libsvmsharp-64bit HOT 1
- Runtime Error on this sample file HOT 1
- Copy paste error in SVMProblemExtensions?
- NullReferenceException When call "svm_node node = (svm_node)Marshal.PtrToStructure(i_ptr_nodes, typeof(svm_node));" HOT 3
- Unable to train with SVMType NU_SVR, EPSILON_SVR or ONE_CLASS HOT 2
- how to use x64 libsvm and some other questions HOT 8
- Attempted to read or write protected memory. This is often an indication that other memory is corrupt. HOT 4
- how to load SVMModel from file? HOT 1
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 libsvmsharp.