Re: FW: Request help to run Principal Components from terminal

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: FW: Request help to run Principal Components from terminal

Mark Hall
You just need to have the weka.jar in your classpath:

java –cp <path to the weka.jar file> weka.Run.AttributeSelection -i input.arff -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > output.arff

Cheers,
Mark.

On 17/02/17, 2:56 AM, "Srinivasan, Suhas" <[hidden email] on behalf of [hidden email]> wrote:

    Hi Dr. Frank,
   
    Thank you for the reply.
    I tried out the below command but I still get an error.
   
    java weka.Run.AttributeSelection -i input.arff -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > output.arff
    Error: Could not find or load main class weka.Run.AttributeSelection
   
    Could you please let me know if there is any other command I can try.
   
    Kind regards,
    Suhas Srinivasan
   
    From: [hidden email] [mailto:[hidden email]] On Behalf Of Eibe Frank
    Sent: Thursday, February 16, 2017 2:57 AM
    To: Weka machine learning workbench list. <[hidden email]>
    Subject: Re: [Wekalist] Request help to run Principal Components from terminal
   
    You may need to use weka.Run so that the MTJ classes are loaded correctly:
      java weka.Run .AttributeSelection -i <input_file> -E ".attributeSelection.PrincipalComponents -R 0.95 -A 5" -S ".Ranker ..."
    Cheers,
    Eibe
   
    On Thu, Feb 16, 2017 at 1:56 PM, Srinivasan, Suhas <[hidden email]> wrote:
    Hi,
   
    I have a large dataset and due to the memory requirements I have to run the Principal Components attribute selection on a linux server.
    But I don't know the proper command to run this from the terminal. Searching online yielded no results. Any help would be greatly appreciated.
    I have tested the below two commands got from the GUI logs. The classpath has been set in the environment and giving it as a command option did not help.
    Java 64 bit 1.8.0_121 and Weka 3.9.1.
   
    java -Xmx100g weka.attributeSelection.PrincipalComponents -i <input_file> -s "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" -R 0.95 -A 5 > <output_file>
    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
            at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
            at java.lang.Class.getMethod0(Class.java:3018)
            at java.lang.Class.getMethod(Class.java:1784)
            at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
            at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
    Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   
   
    java -Xmx100g weka.filters.supervised.attribute.AttributeSelection -i <input_file> -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > <output_file>
    Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:348)
            at weka.core.WekaPackageClassLoaderManager.forName(WekaPackageClassLoaderManager.java:198)
            at weka.core.WekaPackageClassLoaderManager.forName(WekaPackageClassLoaderManager.java:178)
            at weka.core.WekaPackageClassLoaderManager.objectForName(WekaPackageClassLoaderManager.java:162)
            at weka.Run.findSchemeMatch(Run.java:90)
            at weka.core.Utils.forName(Utils.java:1114)
            at weka.attributeSelection.ASEvaluation.forName(ASEvaluation.java:125)
            at weka.filters.supervised.attribute.AttributeSelection.setOptions(AttributeSelection.java:294)
            at weka.filters.Filter.filterFile(Filter.java:1054)
            at weka.filters.Filter.runFilter(Filter.java:1411)
            at weka.filters.supervised.attribute.AttributeSelection.main(AttributeSelection.java:614)
    Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
   
   
   
    Kind regards,
    Suhas Srinivasan
   
    _______________________________________________
    Wekalist mailing list
    Send posts to: [hidden email]
    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
   
    _______________________________________________
    Wekalist mailing list
    Send posts to: [hidden email]
    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
   


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Request help to run Principal Components from terminal

Eibe Frank-2
Administrator
He already has weka.jar in his CLASSPATH. The problem is that there needs to be a space between “weka.Run” and what follows!

Cheers,
Eibe

> On 17/02/2017, at 9:24 AM, Mark Hall <[hidden email]> wrote:
>
> You just need to have the weka.jar in your classpath:
>
> java –cp <path to the weka.jar file> weka.Run.AttributeSelection -i input.arff -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > output.arff
>
> Cheers,
> Mark.
>
> On 17/02/17, 2:56 AM, "Srinivasan, Suhas" <[hidden email] on behalf of [hidden email]> wrote:
>
>    Hi Dr. Frank,
>
>    Thank you for the reply.
>    I tried out the below command but I still get an error.
>
>    java weka.Run.AttributeSelection -i input.arff -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > output.arff
>    Error: Could not find or load main class weka.Run.AttributeSelection
>
>    Could you please let me know if there is any other command I can try.
>
>    Kind regards,
>    Suhas Srinivasan
>
>    From: [hidden email] [mailto:[hidden email]] On Behalf Of Eibe Frank
>    Sent: Thursday, February 16, 2017 2:57 AM
>    To: Weka machine learning workbench list. <[hidden email]>
>    Subject: Re: [Wekalist] Request help to run Principal Components from terminal
>
>    You may need to use weka.Run so that the MTJ classes are loaded correctly:
>      java weka.Run .AttributeSelection -i <input_file> -E ".attributeSelection.PrincipalComponents -R 0.95 -A 5" -S ".Ranker ..."
>    Cheers,
>    Eibe
>
>    On Thu, Feb 16, 2017 at 1:56 PM, Srinivasan, Suhas <[hidden email]> wrote:
>    Hi,
>
>    I have a large dataset and due to the memory requirements I have to run the Principal Components attribute selection on a linux server.
>    But I don't know the proper command to run this from the terminal. Searching online yielded no results. Any help would be greatly appreciated.
>    I have tested the below two commands got from the GUI logs. The classpath has been set in the environment and giving it as a command option did not help.
>    Java 64 bit 1.8.0_121 and Weka 3.9.1.
>
>    java -Xmx100g weka.attributeSelection.PrincipalComponents -i <input_file> -s "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" -R 0.95 -A 5 > <output_file>
>    Error: A JNI error has occurred, please check your installation and try again
>    Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix
>            at java.lang.Class.getDeclaredMethods0(Native Method)
>            at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>            at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
>            at java.lang.Class.getMethod0(Class.java:3018)
>            at java.lang.Class.getMethod(Class.java:1784)
>            at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
>            at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
>    Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
>            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
>
>    java -Xmx100g weka.filters.supervised.attribute.AttributeSelection -i <input_file> -E "weka.attributeSelection.PrincipalComponents -R 0.95 -A 5" -S "weka.attributeSelection.Ranker -T -1.7976931348623157E308 -N -1" > <output_file>
>    Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix
>            at java.lang.Class.forName0(Native Method)
>            at java.lang.Class.forName(Class.java:348)
>            at weka.core.WekaPackageClassLoaderManager.forName(WekaPackageClassLoaderManager.java:198)
>            at weka.core.WekaPackageClassLoaderManager.forName(WekaPackageClassLoaderManager.java:178)
>            at weka.core.WekaPackageClassLoaderManager.objectForName(WekaPackageClassLoaderManager.java:162)
>            at weka.Run.findSchemeMatch(Run.java:90)
>            at weka.core.Utils.forName(Utils.java:1114)
>            at weka.attributeSelection.ASEvaluation.forName(ASEvaluation.java:125)
>            at weka.filters.supervised.attribute.AttributeSelection.setOptions(AttributeSelection.java:294)
>            at weka.filters.Filter.filterFile(Filter.java:1054)
>            at weka.filters.Filter.runFilter(Filter.java:1411)
>            at weka.filters.supervised.attribute.AttributeSelection.main(AttributeSelection.java:614)
>    Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
>            at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>            at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>            at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
>
>
>    Kind regards,
>    Suhas Srinivasan
>
>    _______________________________________________
>    Wekalist mailing list
>    Send posts to: [hidden email]
>    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
>    _______________________________________________
>    Wekalist mailing list
>    Send posts to: [hidden email]
>    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
>
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html