Question regarding load the trained model and test on original dataset

View: New views
16 Messages — Rating Filter:   Alert me  

Question regarding load the trained model and test on original dataset

by Bozhao Tan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is the case:
 
For a dataset, I used 10-fold cross-validation to train a Neural Network model, the EER I get is around 15%. The NN model is saved.
 
I wish to generate the predications using the saved model for the original whole dataset. The results is surprisingly high, EER only 1%.
 
I have thought the saved model could only give me a result close to 15%.
 
Could you please give any comments how to get an objective result using the saved model?
 
Thanks!
 
Henry


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

Re: Question regarding load the trained model and test on original dataset

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> For a dataset, I used 10-fold cross-validation to train a Neural Network
> model, the EER I get is around 15%. The NN model is saved.
>
> I wish to generate the predications using the saved model for the original
> whole dataset. The results is surprisingly high, EER only 1%.
>
> I have thought the saved model could only give me a result close to 15%.
>
> Could you please give any comments how to get an objective result using the
> saved model?

10-fold cross-validation (CV) generates 10 different models on
different train/test subsets, which means you can't save this as a
model. When you save a model (even though performing CV), then you
save the model that was generated on the *full* training set. A model
trained and evaluated on the same dataset is always overly optimistic
(i.e., overfitted). The reason why one normally performs 10 runs of
10-fold CV.

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi, I have written a new clustering algorithm in JAVA (.java file). I want this algorithm to be run from WEKA GUI. How can I run this algorithm from WEKA platform? please let me know the procedure in detail.
 
thanks and regards,
 
sunil



MSN Battles We pitch one stalwart against the other and give you the power. Who will you vote for? Share photos while you chat with Windows Live Messenger.
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi, I have written a new clustering algorithm in JAVA (.java file). I want
> this algorithm to be run from WEKA GUI. How can I run this algorithm from
> WEKA platform? please let me know the procedure in detail.

Read FAQ "How do I add a new classifier, filter, kernel, etc.?". Link
to the FAQs available from the Weka homepage.

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

 
> From: fracpete@...

> Date: Wed, 27 May 2009 21:44:14 +1200
> Subject: Re: [Wekalist] how to include new algorithm in WEKA?
> To: wekalist@...
>
> > Hi, I have written a new clustering algorithm in JAVA (.java file). I want
> > this algorithm to be run from WEKA GUI. How can I run this algorithm from
> > WEKA platform? please let me know the procedure in detail.
>
> Read FAQ "How do I add a new classifier, filter, kernel, etc.?". Link
> to the FAQs available from the Weka homepage.
>
> Cheers, Peter

 
 
I,ve gone thorugh that, and I think the matter under the heading of "Multiple Class Hierarchieis" tells how to add a new algorithm in WEKA. But I don't know where to write all those commands whether in Simple CLI, or in console of WEKA, or else somewhere? Guide me as I am new to WEKA, as well as JAVA and I am trying to do this job first time.
thanks in antocipation.
 
Sunil


MSN Quiz Test your skill and wits on this revered battleground of knowledge IMing with Windows Live Messenger just got better.
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I,ve gone thorugh that, and I think the matter under the heading of
> "Multiple Class Hierarchieis" tells how to add a new algorithm in WEKA. But
> I don't know where to write all those commands whether in Simple CLI, or in
> console of WEKA, or else somewhere?

"java" commands are normally referring to the console. As you have to
modify Weka's setup, you can't issue those commands from inside Weka.

> Guide me as I am new to WEKA, as well as
> JAVA and I am trying to do this job first time.

What version of Weka are you using?

Here's the executive summary for 3.6.0:
- place a GenericPropertiesCreator.props file in your home directory
- enable automatic class discovery in the props file ("UseDynamic=true")
- add the package of your clusterer to the list under the property
"weka.clusterers.Clusterer"
- start up Weka again

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

 
> From: fracpete@...

> Date: Sun, 31 May 2009 18:00:53 +1200
> Subject: Re: [Wekalist] how to include new algorithm in WEKA?
> To: wekalist@...
>
> > I,ve gone thorugh that, and I think the matter under the heading of
> > "Multiple Class Hierarchieis" tells how to add a new algorithm in WEKA. But
> > I don't know where to write all those commands whether in Simple CLI, or in
> > console of WEKA, or else somewhere?
>
> "java" commands are normally referring to the console. As you have to
> modify Weka's setup, you can't issue those commands from inside Weka.
>
> > Guide me as I am new to WEKA, as well as
> > JAVA and I am trying to do this job first time.
>
> What version of Weka are you using?
>
> Here's the executive summary for 3.6.0:
> - place a GenericPropertiesCreator.props file in your home directory
> - enable automatic class discovery in the props file ("UseDynamic=true")
> - add the package of your clusterer to the list under the property
> "weka.clusterers.Clusterer"
> - start up Weka again
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/ Ph. +64 (7) 858-5174
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@...
> List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
 
 
 
>>> hi , in the steps mentioned above-
  ---- place a GenericPropertiesCreator.props file in your
home directory
 
(1) how do i place this file in my home directory
 as i was unable to locate the generic properties creator.props file ?????????? (steps please)
(how to locate ??)
(how to place??)
 
(2) i have tried the following command to get
the file -:

java weka.gui.GenericPropertiesCreator \

weka/gui/GenericPropertiesCreator.props \

%userprofile%/GenericObjectEditor.props

 

(no sucess)

 

-- what should i type in %userprofile% .. i am using xp

professional . and weka is in c:\program file\weka-3-5\


 


Get easy photo sharing with Windows Live™ Photos. Drag n’ drop
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>> hi , in the steps mentioned above-
>   ---- place a GenericPropertiesCreator.props file in your
> home directory
>
> (1) how do i place this file in my home directory
>  as i was unable to locate the generic properties
> creator.props file ?????????? (steps please)

Either extract it from the weka.jar or the weka-src.jar (in
sub-directory "weka/gui"). NB: Jar files are just zip files. I.e., use
any archive manager that can handle zip files, e.g., 7-zip.

> (how to locate ??)
> (how to place??)
>
> (2) i have tried the following command to get
> the file -:
>
> java weka.gui.GenericPropertiesCreator \
>
> weka/gui/GenericPropertiesCreator.props \
>
> %userprofile%/GenericObjectEditor.props

As the "GenericObjectEditor" wiki article mentions, it is assumed that
the current path that you are currently on is just above the root
package of, i.e.,  "weka". That implies that the class or source files
are unzipped. Otherwise, the path "weka/gui/" doesn't make a lot of
sense.

This procedure is *not* necessary, as you want to use dynamic class
discovery. Just set the property "UseDynamic" in the
GenericPropertiesCreator.props file that you've placed in your home
directory to true.

> -- what should i type in %userprofile% .. i am using xp

%USERPROFILE% is the environment variable pointing to your home
directory (on Win2000, WinXP and WinVista). Nothing to type in. Once
again, *not* necessary since you want dynamic class discovery.

If you want to know what directory your home directory is, just run
the following command in a command prompt:
  echo %USERPROFILE%

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

 
> Date: Thu, 4 Jun 2009 20:30:58 +1200

> Subject: Re: [Wekalist] how to include new algorithm in WEKA?
> From: fracpete@...
> To: wekalist@...
>
> >>>> hi , in the steps mentioned above-
> >   ---- place a GenericPropertiesCreator.props file in your
> > home directory
> >
> > (1) how do i place this file in my home directory
> >  as i was unable to locate the generic properties
> > creator.props file ?????????? (steps please)
>
> Either extract it from the weka.jar or the weka-src.jar (in
> sub-directory "weka/gui"). NB: Jar files are just zip files. I.e., use
> any archive manager that can handle zip files, e.g., 7-zip.
>
> > (how to locate ??)
> > (how to place??)
> >
> > (2) i have tried the following command to get
> > the file -:
> >
> > java weka.gui.GenericPropertiesCreator \
> >
> > weka/gui/GenericPropertiesCreator.props \
> >
> > %userprofile%/GenericObjectEditor.props
>
> As the "GenericObjectEditor" wiki article mentions, it is assumed that
> the current path that you are currently on is just above the root
> package of, i.e., "weka". That implies that the class or source files
> are unzipped. Otherwise, the path "weka/gui/" doesn't make a lot of
> sense.
>
> This procedure is *not* necessary, as you want to use dynamic class
> discovery. Just set the property "UseDynamic" in the
> GenericPropertiesCreator.props file that you've placed in your home
> directory to true.
>
> > -- what should i type in %userprofile% .. i am using xp
>
> %USERPROFILE% is the environment variable pointing to your home
> directory (on Win2000, WinXP and WinVista). Nothing to type in. Once
> again, *not* necessary since you want dynamic class discovery.
>
> If you want to know what directory your home directory is, just run
> the following command in a command prompt:
> echo %USERPROFILE%
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/ Ph. +64 (7) 858-5174
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@...
> List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
 
 
thanks i got the gpc.props file
 
now i am stuck again--
 
(1) the program which i want to add is ( abc.class)
     now
      how do i make the clusterer package? and
(2) where to paste that clusterer package?
 
Sunil


Get easy photo sharing with Windows LiveT Photos. Drag n' drop
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> thanks i got the gpc.props file
>
> now i am stuck again--
>
> (1) the program which i want to add is ( abc.class)
>      now
>       how do i make the clusterer package? and
> (2) where to paste that clusterer package?

The package of your class ("abc") has to be added to the list of
packages of the weka.clusterers.Clusterer property in the
GenericPropertiesCreator.props file (as I've already posted earlier).

The original property from that file looks like this:

weka.clusterers.Clusterer=\
 weka.clusterers

Assuming that your class "abc" is in the package "sunil.clusterers",
the list should look like this then:

weka.clusterers.Clusterer=\
 weka.clusterers,\
 sunil.clusterers

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I am trying to run my own algorithm (in java) in  weka but i am unable to include it into weka. I took the following steps to include the algorithm, as suggested in the www.weka.wiki.sourceforge.net/genericobjecteditor+developerversion.htm
(the document is attached hereunder in the attachments)
1.Previously, I was using weka version 3.5.8, in which the dynamic discovery of classes at runtime is disabled by default. So i downloaded Version 3.6.1 of Weka in which this feature is available.
2.I unzipped the weka.jar and weka-src.jar into respective folders and navigated to weka/gui and then opened genericpropertiescreator.props and set UseDynamic to false.
3.I have set the classpaths of weka.jar and weka-src.jar in the environment variables.
4.Then i tried to generate GOE(generic object editor file) by using the command {java weka.gui.GenericPropertiesCreator %USERPROFILE%\GenericPropertiesCreator.props %USERPROFILE%\GenericObjectEditor.props},
but this commnad didn't work at java console and gave an exception.
5.My algorithm lies in the path sameer\classifiers\att.java, and i have compiled this algorithm also successfully in java and built a class file 'att', which lies in the same directory.
6.I have appended the variable Weka.classifier.classifiers=\sameer.classifiers in the GPC(generic properties creator.props file).
7.Then, i executed the following commands at java console:-
 java -classpath "weka.jar" weka.gui.GUIChooser
  java -classpath "weka.jar;sameer.jar" weka.gui.GUIChooser
Weka starts after these commands, and then i go to explorer, and open a data file cpu.arff. and then go to classifier and there i see that my algorithm doesnot appear in the classifiers list.

Please help me and tell me where am i doing it wrong.
 
regards,
Sunil
 

> Date: Sat, 6 Jun 2009 09:01:13 +1200
> Subject: Re: [Wekalist] how to include new algorithm in WEKA?
> From: fracpete@...
> To: wekalist@...
>
> > thanks i got the gpc.props file
> >
> > now i am stuck again--
> >
> > (1) the program which i want to add is ( abc.class)
> >      now
> >       how do i make the clusterer package? and
> > (2) where to paste that clusterer package?
>
> The package of your class ("abc") has to be added to the list of
> packages of the weka.clusterers.Clusterer property in the
> GenericPropertiesCreator.props file (as I've already posted earlier).
>
> The original property from that file looks like this:
>
> weka.clusterers.Clusterer=\
> weka.clusterers
>
> Assuming that your class "abc" is in the package "sunil.clusterers",
> the list should look like this then:
>
> weka.clusterers.Clusterer=\
> weka.clusterers,\
> sunil.clusterers
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/ Ph. +64 (7) 858-5174
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@...
> List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


Videos Get the latest video streams on movies, Try it!
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I am trying to run my own algorithm (in java) in  weka but i am unable to
> include it into weka. I took the following steps to include the algorithm,
> as suggested in the
> www.weka.wiki.sourceforge.net/genericobjecteditor+developerversion.htm
> (the document is attached hereunder in the attachments)

Here's the correct link (as there was no attachment):
http://weka.wiki.sourceforge.net/GenericObjectEditor+(developer+version)

Please note, that the GOE articles underwent some rewriting in the
past (I only have a certain amount of spare time and also a life apart
from work and helping out on this mailing list). You might wanna check
it out again.

> 1.Previously, I was using weka version 3.5.8, in which the dynamic discovery
> of classes at runtime is disabled by default. So i downloaded Version 3.6.1
> of Weka in which this feature is available.

3.5.8 still has the dynamic class discovery feature. It's just turned
off in the GenericPropertiesCreator.props file by default. There was
no need to download 3.6.1 (apart from bug-fixes and other additions).

> 2.I unzipped the weka.jar and weka-src.jar into respective folders and
> navigated to weka/gui and then opened genericpropertiescreator.props and set
> UseDynamic to false.
> 3.I have set the classpaths of weka.jar and weka-src.jar in the environment
> variables.

First, weka-src.jar contains the source code and shouldn't be in your
classpath. Second, unzipping the jar files, changing the props file in
the created sub-directories but then not using these directories in
your classpath won't make a difference. Java will never know about
these files.

> 4.Then i tried to generate GOE(generic object editor file) by using the
> command {java weka.gui.GenericPropertiesCreator
> %USERPROFILE%\GenericPropertiesCreator.props
> %USERPROFILE%\GenericObjectEditor.props},
> but this commnad didn't work at java console and gave an exception.

It would always be helpful to post exceptions as they point at what
one is doing wrong.

Using the GenericObjectEditor.props file is the *old* way *without*
dynamic class discovery. By downloading 3.6.1 and turning off class
discovery, you end up with the same system as 3.5.8 offers.

> 5.My algorithm lies in the path sameer\classifiers\att.java, and i have
> compiled this algorithm also successfully in java and built a class file
> 'att', which lies in the same directory.

So the package directive in your source code is the following?
  package sameer.classifiers;

BTW Java convention has it, that class names start with a capital
letter, i.e., your class should be named "Att" and the source code
file "Att.java".

> 6.I have appended the variable
> Weka.classifier.classifiers=\sameer.classifiers in the GPC(generic
> properties creator.props file).

What file are you talking about? The one in the directories that you
created from unzipping the weka.jar? As these files aren't on your
classpath, Java will not know about them. Changing them has no effect.

> 7.Then, i executed the following commands at java console:-
>  java -classpath "weka.jar" weka.gui.GUIChooser
>   java -classpath "weka.jar;sameer.jar" weka.gui.GUIChooser
> Weka starts after these commands, and then i go to explorer, and open a data
> file cpu.arff. and then go to classifier and there i see that my algorithm
> doesnot appear in the classifiers list.

You just said that you've compiled a class file from your source code,
but you're specifying a jar file in your commandline. Also, you've
said that you added weka.jar/weka-src.jar to your classpath but then
you're overriding it with explicitly stating what jar archives to use
(the ones that didn't get changed).

OK, here's what to do:
1. go back to the wiki article mentioned above and check out where
your home directory is located
2. remove the directories that you created from unzipping the
weka-src.jar and weka.jar
3. remove the weka.jar and weka-src.jar from your classpath environment variable
4. extract the GenericPropertiesCreator.props file from the weka.jar
(located in weka/gui) and place it in your home directory, which
you've located in step 1.
5. open this props file in your home directory now with an editor (I
don't consider Word/WordPad/Notepad as editors) and adjust the
classifier's key that it looks like this:

# Lists the Classifiers-Packages I want to choose from
weka.classifiers.Classifier=\
 sameer.classifiers,\
 weka.classifiers,\
 weka.classifiers.bayes,\
 weka.classifiers.functions,\
 weka.classifiers.lazy,\
 weka.classifiers.meta,\
 weka.classifiers.meta.nestedDichotomies,\
 weka.classifiers.mi,\
 weka.classifiers.misc,\
 weka.classifiers.trees,\
 weka.classifiers.rules

6. I'm assuming the following locations (as you didn't provide
sufficient information here):
- weka.jar is located in directory "C:\some\where"
- your own classes are located under the directory "C:\some\other\place".
   I.e., the "sameer" package is just below "C:\some\other\place". As
you don't have a
  jar archive with your classes, you have to provide the path that points to
  your classes. That gives you the following command to run:
    java -classpath C:\some\where\weka.jar;C:\some\other\place
weka.gui.GUIChooser

For basic information dealing with Java's classpath:
  http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by stavros-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello there,

I am using the multilayer perception algorithm for a classification task.
I use the following command:
weka.classifiers.functions.MultilayerPerceptron -L 0.3 -M 0.2 -N 500 -V 0 -S
0 -E 20 -H a

Does anyone know the number of layers, nodes as well as the topology that
this command produces?

Thank you in advance,
Stavros



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

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

New question, new post.

> I am using the multilayer perception algorithm for a classification task.
> I use the following command:
> weka.classifiers.functions.MultilayerPerceptron -L 0.3 -M 0.2 -N 500 -V 0 -S
> 0 -E 20 -H a
>
> Does anyone know the number of layers, nodes as well as the topology that
> this command produces?

Copy/paste from the Javadoc:

-H <comma seperated numbers for nodes on each layer>
  The hidden layers to be created for the network.
  (Value should be a list of comma separated Natural
  numbers or the letters 'a' = (attribs + classes) / 2,
  'i' = attribs, 'o' = classes, 't' = attribs .+ classes)
  for wildcard values, Default = a).

Therefore, one hidden layer with the number of nodes depending on your dataset.

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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

RE: how to include new algorithm in WEKA?

by sunil agrawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
 
I have followed all the steps as suggested by you for inclusion of a new algorithm in weka.
Here's what i did.
1. go back to the wiki article mentioned above and check out where
> your home directory is located
My home directory is C:\documents and settings\SAMEER

> 2. remove the directories that you created from unzipping the
> weka-src.jar and weka.jar
I removed the directories as suggested above.
> 3. remove the weka.jar and weka-src.jar from your classpath environment variable
I removed them from classpath variable.
> 4. extract the GenericPropertiesCreator.props file from the weka.jar
> (located in weka/gui) and place it in your home directory, which
> you've located in step 1.
I extracted the GenericPropertiesCreator.props file from the weka.jar(located in weka/gui)  and placed it in my home directory.
> 5. open this props file in your home directory now with an editor (I
> don't consider Word/WordPad/Notepad as editors) and adjust the
> classifier's key that it looks like this:
> # Lists the Classifiers-Packages I want to choose from

> weka.classifiers.Classifier=\
> sameer.classifiers,\
> weka.classifiers,\
> weka.classifiers.bayes,\
> weka.classifiers.functions,\
> weka.classifiers.lazy,\
> weka.classifiers.meta,\
> weka.classifiers.meta.nestedDichotomies,\
> weka.classifiers.mi,\
> weka.classifiers.misc,\
> weka.classifiers.trees,\
> weka.classifiers.rules
>

I opened this file (GPC) with wordpad (as no other editor had been suggested by you), and made the changes.
> 6. I'm assuming the following locations (as you didn't provide
> sufficient information here):
> - weka.jar is located in directory "C:\some\where"
> - your own classes are located under the directory "C:\some\other\place".
> I.e., the "sameer" package is just below "C:\some\other\place".
weka.jar file is located at E:\SAMEER\weka.jar and My algorithm is at F:\SAMEER\sameer\classifiers\Arttt.java
Also, i have included <package sameer.classifiers;> in my algorithm.

> As you don't have a
> jar archive with your classes, you have to provide the path that points to
> your classes. That gives you the following command to run:
> java -classpath C:\some\where\weka.jar;C:\some\other\place
> weka.gui.GUIChooser
I gave the command at command prompt:-
java -classpath E:\SAMEER\weka.jar;F:\SAMEER weka.gui.GUIChooser
 
But still, i don't see my algorithm in the classifiers list in the explorer.
Please help me and tell me where i am doing it wrong.
 

Moreover, I tried certain other things, which i mention as follows:-
I unzipped weka.jar, and in the folder weka(obtained after unzipping), i edited the GPC file as required and included my algorithm in the classifiers folder(after making changes in my algo to suit the respective package). Then, I zipped the folder into weka.zip using 7zip software. Then i converted this zip file into weka.jar file by renaming it.
This way, i successfully obtained weka.jar file.
Then, i replaced the original weka,jar file with this jar file, and tried to run weka both from start menu, and from console using the command:-
java -classpath E:\SAMEER\weka.jar weka.gui.GUIChooser
But i got an exception in both cases:- "main class not found "

So, kindly suggest me what to do to get it right.
 
regards,
Sunil
 
 

 

> > I am trying to run my own algorithm (in java) in  weka but i am unable to
> > include it into weka. I took the following steps to include the algorithm,
> > as suggested in the
> > www.weka.wiki.sourceforge.net/genericobjecteditor+developerversion.htm
> > (the document is attached hereunder in the attachments)
>
> Here's the correct link (as there was no attachment):
> http://weka.wiki.sourceforge.net/GenericObjectEditor+(developer+version)
>
> Please note, that the GOE articles underwent some rewriting in the
> past (I only have a certain amount of spare time and also a life apart
> from work and helping out on this mailing list). You might wanna check
> it out again.
>
> > 1.Previously, I was using weka version 3.5.8, in which the dynamic discovery
> > of classes at runtime is disabled by default. So i downloaded Version 3.6.1
> > of Weka in which this feature is available.
>
> 3.5.8 still has the dynamic class discovery feature. It's just turned
> off in the GenericPropertiesCreator.props file by default. There was
> no need to download 3.6.1 (apart from bug-fixes and other additions).
>
> > 2.I unzipped the weka.jar and weka-src.jar into respective folders and
> > navigated to weka/gui and then opened genericpropertiescreator.props and set
> > UseDynamic to false.
> > 3.I have set the classpaths of weka.jar and weka-src.jar in the environment
> > variables.
>
> First, weka-src.jar contains the source code and shouldn't be in your
> classpath. Second, unzipping the jar files, changing the props file in
> the created sub-directories but then not using these directories in
> your classpath won't make a difference. Java will never know about
> these files.
>
> > 4.Then i tried to generate GOE(generic object editor file) by using the
> > command {java weka.gui.GenericPropertiesCreator
> > %USERPROFILE%\GenericPropertiesCreator.props
> > %USERPROFILE%\GenericObjectEditor.props},
> > but this commnad didn't work at java console and gave an exception.
>
> It would always be helpful to post exceptions as they point at what
> one is doing wrong.
>
> Using the GenericObjectEditor.props file is the *old* way *without*
> dynamic class discovery. By downloading 3.6.1 and turning off class
> discovery, you end up with the same system as 3.5.8 offers.
>
> > 5.My algorithm lies in the path sameer\classifiers\att.java, and i have
> > compiled this algorithm also successfully in java and built a class file
> > 'att', which lies in the same directory.
>
> So the package directive in your source code is the following?
> package sameer.classifiers;
>
> BTW Java convention has it, that class names start with a capital
> letter, i.e., your class should be named "Att" and the source code
> file "Att.java".
>
> > 6.I have appended the variable
> > Weka.classifier.classifiers=\sameer.classifiers in the GPC(generic
> > properties creator.props file).
>
> What file are you talking about? The one in the directories that you
> created from unzipping the weka.jar? As these files aren't on your
> classpath, Java will not know about them. Changing them has no effect.
>
> > 7.Then, i executed the following commands at java console:-
> >  java -classpath "weka.jar" weka.gui.GUIChooser
> >   java -classpath "weka.jar;sameer.jar" weka.gui.GUIChooser
> > Weka starts after these commands, and then i go to explorer, and open a data
> > file cpu.arff. and then go to classifier and there i see that my algorithm
> > doesnot appear in the classifiers list.
>
> You just said that you've compiled a class file from your source code,
> but you're specifying a jar file in your commandline. Also, you've
> said that you added weka.jar/weka-src.jar to your classpath but then
> you're overriding it with explicitly stating what jar archives to use
> (the ones that didn't get changed).
>
> OK, here's what to do:
> 1. go back to the wiki article mentioned above and check out where
> your home directory is located
> 2. remove the directories that you created from unzipping the
> weka-src.jar and weka.jar
> 3. remove the weka.jar and weka-src.jar from your classpath environment variable
> 4. extract the GenericPropertiesCreator.props file from the weka.jar
> (located in weka/gui) and place it in your home directory, which
> you've located in step 1.
> 5. open this props file in your home directory now with an editor (I
> don't consider Word/WordPad/Notepad as editors) and adjust the
> classifier's key that it looks like this:
>
> # Lists the Classifiers-Packages I want to choose from
> weka.classifiers.Classifier=\
> sameer.classifiers,\
> weka.classifiers,\
> weka.classifiers.bayes,\
> weka.classifiers.functions,\
> weka.classifiers.lazy,\
> weka.classifiers.meta,\
> weka.classifiers.meta.nestedDichotomies,\
> weka.classifiers.mi,\
> weka.classifiers.misc,\
> weka.classifiers.trees,\
> weka.classifiers.rules
>
> 6. I'm assuming the following locations (as you didn't provide
> sufficient information here):
> - weka.jar is located in directory "C:\some\where"
> - your own classes are located under the directory "C:\some\other\place".
> I.e., the "sameer" package is just below "C:\some\other\place". As
> you don't have a
> jar archive with your classes, you have to provide the path that points to
> your classes. That gives you the following command to run:
> java -classpath C:\some\where\weka.jar;C:\some\other\place
> weka.gui.GUIChooser
>
> For basic information dealing with Java's classpath:
> http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/ Ph. +64 (7) 858-5174
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@...
> List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


Videos Get the latest video streams on movies, Try it!
_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: how to include new algorithm in WEKA?

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[...]

> Here's what i did.
> 1. go back to the wiki article mentioned above and check out where
>> your home directory is located
> My home directory is C:\documents and settings\SAMEER

OK.

>> 2. remove the directories that you created from unzipping the
>> weka-src.jar and weka.jar
> I removed the directories as suggested above.

OK.

>> 3. remove the weka.jar and weka-src.jar from your classpath environment
>> variable
> I removed them from classpath variable.

OK.

>> 4. extract the GenericPropertiesCreator.props file from the weka.jar
>> (located in weka/gui) and place it in your home directory, which
>> you've located in step 1.
> I extracted the GenericPropertiesCreator.props file from the
> weka.jar(located in weka/gui)  and placed it in my home directory.

OK.

>> 5. open this props file in your home directory now with an editor (I
>> don't consider Word/WordPad/Notepad as editors) and adjust the
>> classifier's key that it looks like this:
>> # Lists the Classifiers-Packages I want to choose from
>> weka.classifiers.Classifier=\
>> sameer.classifiers,\
>> weka.classifiers,\
>> weka.classifiers.bayes,\
>> weka.classifiers.functions,\
>> weka.classifiers.lazy,\
>> weka.classifiers.meta,\
>> weka.classifiers.meta.nestedDichotomies,\
>> weka.classifiers.mi,\
>> weka.classifiers.misc,\
>> weka.classifiers.trees,\
>> weka.classifiers.rules
>>
>
> I opened this file (GPC) with wordpad (as no other editor had been suggested
> by you), and made the changes.

Notepad++ (http://notepad-plus.sourceforge.net/), UltraEdit
(http://www.ultraedit.com/), TextPad (http://www.textpad.com/), gvim
(http://www.vim.org/), etc... There's a multitude of *real* editors
out there.

NotePad, WordPad, Word quite often save the file in a different format
(e.g., RTF) and/or change the file extension.

The stupidest Windows ever did was hiding the file extensions.
Somewhere in the Windows Explorer options, you untick a checkbox
saying "hide extension for known file types", or something similar.
Displaying the file extensions is highly recommended!

Weka is looking for a file (case-sensitively!) named file. Make sure
that it still has the correct format (plain text file), extension
(.props) and case (capital G, P and C).

>> 6. I'm assuming the following locations (as you didn't provide
>> sufficient information here):
>> - weka.jar is located in directory "C:\some\where"
>> - your own classes are located under the directory "C:\some\other\place".
>> I.e., the "sameer" package is just below "C:\some\other\place".
> weka.jar file is located at E:\SAMEER\weka.jar and My algorithm is at
> F:\SAMEER\sameer\classifiers\Arttt.java
> Also, i have included <package sameer.classifiers;> in my algorithm.
>
>> As you don't have a
>> jar archive with your classes, you have to provide the path that points to
>> your classes. That gives you the following command to run:
>> java -classpath C:\some\where\weka.jar;C:\some\other\place
>> weka.gui.GUIChooser
> I gave the command at command prompt:-
> java -classpath E:\SAMEER\weka.jar;F:\SAMEER weka.gui.GUIChooser
>
> But still, i don't see my algorithm in the classifiers list in the explorer.
> Please help me and tell me where i am doing it wrong.

Just a stupid question: your *new* classifier "Arttt" is derived from
weka.classifiers.Classifier (or one of the other abstract superclasses
for classifiers in the same package), right? Otherwise, this whole
exercise is bound to fail. If your class is not a Classifier-derived
class, Weka will always ignore it, of course.

Feel free to send me your code off-list and I can have a look at it tomorrow.

> Moreover, I tried certain other things, which i mention as follows:-
> I unzipped weka.jar, and in the folder weka(obtained after unzipping), i
> edited the GPC file as required and included my algorithm in the classifiers
> folder(after making changes in my algo to suit the respective package).
> Then, I zipped the folder into weka.zip using 7zip software. Then i
> converted this zip file into weka.jar file by renaming it.
> This way, i successfully obtained weka.jar file.
> Then, i replaced the original weka,jar file with this jar file, and tried to
> run weka both from start menu, and from console using the command:-
> java -classpath E:\SAMEER\weka.jar weka.gui.GUIChooser
> But i got an exception in both cases:- "main class not found "

That looks like the weka.jar got screwed up, since Java cannot find
the GUIChooser class anymore.

Like I said, just send me the source code off-list and I'll take a look at it.

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

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