Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: LibSVM and GridSearch packages

  1. #1

    Default LibSVM and GridSearch packages

    I am trying to use the LibSVM and GridSearch packages. I am using weka-dev-3.7.13.jar and the gridsearch and libsvm jars from http://mvnrepository.com/artifact/nz...idSearch/1.0.7

    Here is a code snippet (this is in Scala):

    Code:
        val svm = new LibSVM()
        svm.setSVMType(new SelectedTag(LibSVM.SVMTYPE_ONE_CLASS_SVM, LibSVM.TAGS_SVMTYPE))
        svm.setSVMType(new SelectedTag(LibSVM.KERNELTYPE_RBF, LibSVM.TAGS_KERNELTYPE))
        val search = new GridSearch()
        val accuracyIndex = 6
        val evaluation = new SelectedTag(accuracyIndex, GridSearch.TAGS_EVALUATION)
        search.setEvaluation(evaluation)
        search.setXProperty("classifier.nu")
        search.setXMin(0.01)
        search.setXMax(1.0)
        search.setXStep(0.01)
        search.setXBase(10.0)
        search.setXExpression("I")
    
    
        search.setYProperty("classifier.kernel.gamma")
        search.setYMin(-5.0)
        search.setYMax(2.0)
        search.setYStep(1.0)
        search.setYBase(10.0)
        search.setYExpression("pow(BASE,I)")
        
        search.setClassifier(svm)
        search.buildClassifier(trainingSet)
        
        val detector = search.getBestClassifier()
    However, this results in the following exception:

    Code:
    java.beans.IntrospectionException: Method not found: isClassifier    at java.beans.PropertyDescriptor.<init>(Unknown Source)
        at java.beans.PropertyDescriptor.<init>(Unknown Source)
        at weka.core.PropertyPath.find(PropertyPath.java:386)
        at weka.core.PropertyPath.getPropertyDescriptor(PropertyPath.java:432)
        at weka.core.PropertyPath.getPropertyDescriptor(PropertyPath.java:448)
        at weka.classifiers.meta.GridSearch$SetupGenerator.setValue(GridSearch.java:1836)
        at weka.classifiers.meta.GridSearch$SetupGenerator.setup(GridSearch.java:1878)
        at weka.classifiers.meta.GridSearch$EvaluationTask.run(GridSearch.java:1970)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Exception in thread "main" java.lang.NullPointerException
        at weka.classifiers.meta.GridSearch$SetupGenerator.setValue(GridSearch.java:1837)
        at weka.classifiers.meta.GridSearch$SetupGenerator.setup(GridSearch.java:1878)
        at weka.classifiers.meta.GridSearch$EvaluationTask.run(GridSearch.java:1970)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    I had to download some additional dependencies for GridSearch, and it looks like I am still missing something. Where am I going wrong?
    Last edited by peace_within_reach; 10-26-2015 at 03:25 PM.

  2. #2

    Default

    I was able to get past this error message by switching out some .jar files. I don't know why the ones I downloaded weren't compatible with each other, but I remembered that I had used the gridsearch in the past, found that old project and just copied those .jars.

    However, the new problem is that gridsearch doesn't work with a unary class dataset, and one-class SVM won't work with a binary dataset. Is there a way to turn these checks off? I don't think it is important for what I'm trying to do.

  3. #3
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    If you are using Weka 3.7.12 or 3.7.13 then you can call setDoNotCheckCapabilities() on GridSearch.

    Cheers,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.