Source Code Cross Referenced for RandomizableSingleClassifierEnhancer.java in  » Science » weka » weka » classifiers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » weka » weka.classifiers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    This program is free software; you can redistribute it and/or modify
003:         *    it under the terms of the GNU General Public License as published by
004:         *    the Free Software Foundation; either version 2 of the License, or
005:         *    (at your option) any later version.
006:         *
007:         *    This program is distributed in the hope that it will be useful,
008:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
009:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
010:         *    GNU General Public License for more details.
011:         *
012:         *    You should have received a copy of the GNU General Public License
013:         *    along with this program; if not, write to the Free Software
014:         *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
015:         */
016:
017:        /*
018:         *    RandomizableSingleClassifierEnhancer.java
019:         *    Copyright (C) 2004 University of Waikato, Hamilton, New Zealand
020:         *
021:         */
022:
023:        package weka.classifiers;
024:
025:        import weka.core.Option;
026:        import weka.core.Randomizable;
027:        import weka.core.Utils;
028:
029:        import java.util.Enumeration;
030:        import java.util.Vector;
031:
032:        /**
033:         * Abstract utility class for handling settings common to randomizable
034:         * meta classifiers that build an ensemble from a single base learner.  
035:         *
036:         * @author Eibe Frank (eibe@cs.waikato.ac.nz)
037:         * @version $Revision: 1.4 $
038:         */
039:        public abstract class RandomizableSingleClassifierEnhancer extends
040:                SingleClassifierEnhancer implements  Randomizable {
041:
042:            /** for serialization */
043:            private static final long serialVersionUID = 558286687096157160L;
044:
045:            /** The random number seed. */
046:            protected int m_Seed = 1;
047:
048:            /**
049:             * Returns an enumeration describing the available options.
050:             *
051:             * @return an enumeration of all the available options.
052:             */
053:            public Enumeration listOptions() {
054:
055:                Vector newVector = new Vector(2);
056:
057:                newVector.addElement(new Option("\tRandom number seed.\n"
058:                        + "\t(default 1)", "S", 1, "-S <num>"));
059:
060:                Enumeration enu = super .listOptions();
061:                while (enu.hasMoreElements()) {
062:                    newVector.addElement(enu.nextElement());
063:                }
064:                return newVector.elements();
065:            }
066:
067:            /**
068:             * Parses a given list of options. Valid options are:<p>
069:             *
070:             * -W classname <br>
071:             * Specify the full class name of the base learner.<p>
072:             *
073:             * -I num <br>
074:             * Set the number of iterations (default 10). <p>
075:             *
076:             * -S num <br>
077:             * Set the random number seed (default 1). <p>
078:             *
079:             * Options after -- are passed to the designated classifier.<p>
080:             *
081:             * @param options the list of options as an array of strings
082:             * @exception Exception if an option is not supported
083:             */
084:            public void setOptions(String[] options) throws Exception {
085:
086:                String seed = Utils.getOption('S', options);
087:                if (seed.length() != 0) {
088:                    setSeed(Integer.parseInt(seed));
089:                } else {
090:                    setSeed(1);
091:                }
092:
093:                super .setOptions(options);
094:            }
095:
096:            /**
097:             * Gets the current settings of the classifier.
098:             *
099:             * @return an array of strings suitable for passing to setOptions
100:             */
101:            public String[] getOptions() {
102:
103:                String[] super Options = super .getOptions();
104:                String[] options = new String[super Options.length + 2];
105:
106:                int current = 0;
107:                options[current++] = "-S";
108:                options[current++] = "" + getSeed();
109:
110:                System.arraycopy(super Options, 0, options, current,
111:                        super Options.length);
112:
113:                return options;
114:            }
115:
116:            /**
117:             * Returns the tip text for this property
118:             * @return tip text for this property suitable for
119:             * displaying in the explorer/experimenter gui
120:             */
121:            public String seedTipText() {
122:                return "The random number seed to be used.";
123:            }
124:
125:            /**
126:             * Set the seed for random number generation.
127:             *
128:             * @param seed the seed 
129:             */
130:            public void setSeed(int seed) {
131:
132:                m_Seed = seed;
133:            }
134:
135:            /**
136:             * Gets the seed for the random number generations
137:             *
138:             * @return the seed for the random number generation
139:             */
140:            public int getSeed() {
141:
142:                return m_Seed;
143:            }
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.