View Javadoc

1   /*
2    * AppArtConfig.java
3    * Part of the yawn project
4    * Created on 06-oct-2004 by marti.
5    *
6    */
7   package yawn.nn.appart;
8   
9   import yawn.config.ConfigurationException;
10  import yawn.config.NeuralNetworkConfig;
11  import yawn.config.ValidationException;
12  import yawn.nn.NeuralNetwork;
13  import yawn.util.Pattern;
14  
15  /***
16   * 
17   * <p>
18   * $Id: AppArtConfig.java,v 1.8 2005/05/09 11:04:55 supermarti Exp $
19   * </p>
20   * 
21   * @author Luis Mart&iacute; (luis dot marti at uc3m dot es)
22   * @version $Revision: 1.8 $
23   */
24  public class AppArtConfig extends NeuralNetworkConfig {
25  
26  	/***
27  	 * 
28  	 * @uml.property name="desiredMeanSquaredError"
29  	 */
30  	protected double desiredMeanSquaredError;
31  
32  	/***
33  	 * 
34  	 * @uml.property name="initialDeviations"
35  	 * @uml.associationEnd multiplicity="(0 1)"
36  	 */
37  	protected Pattern initialDeviations;
38  
39  	/***
40  	 * 
41  	 * @uml.property name="learningRate"
42  	 */
43  	protected double learningRate;
44  
45  	/***
46  	 * 
47  	 * @uml.property name="matchTrackingOneShot"
48  	 */
49  	protected boolean matchTrackingOneShot;
50  
51  	/***
52  	 * 
53  	 * @uml.property name="maxEpochs"
54  	 */
55  	protected long maxEpochs;
56  
57  	/***
58  	 * 
59  	 * @uml.property name="predictionError"
60  	 */
61  	protected double predictionError;
62  
63  	/***
64  	 * 
65  	 * @uml.property name="predictionLayerLearningRate"
66  	 */
67  	protected double predictionLayerLearningRate;
68  
69  	/***
70  	 * 
71  	 * @uml.property name="testMatchVigilance"
72  	 */
73  	protected double testMatchVigilance;
74  
75  	/***
76  	 * 
77  	 * @uml.property name="trainMatchVigilance"
78  	 */
79  	protected double trainMatchVigilance;
80  
81  	/***
82  	 * 
83  	 * @uml.property name="useAbsoluteError"
84  	 */
85  	protected boolean useAbsoluteError;
86  
87  	/***
88  	 *  
89  	 */
90  	public AppArtConfig() {
91  		super();
92  	}
93  
94  	/***
95  	 * @see yawn.config.NeuralNetworkConfig#configuredNetworkFactory()
96  	 */
97  	public NeuralNetwork configuredNetworkFactory() {
98  		AppArt net = new AppArt();
99  
100 		try {
101 			net.setup(this);
102 		} catch (ConfigurationException e) {
103 			return null;
104 		}
105 
106 		return net;
107 	}
108 
109 	/***
110 	 * @see yawn.config.NeuralNetworkConfig#createSampleInstance()
111 	 */
112 	public NeuralNetworkConfig createSampleInstance() {
113 		AppArtConfig res = new AppArtConfig();
114 
115 		res.desiredMeanSquaredError = 0.4;
116 
117 		double[] devs = { 0.1, 0.1 };
118 		res.initialDeviations = new Pattern(devs);
119 
120 		res.learningRate = 0.1;
121 
122 		res.matchTrackingOneShot = true;
123 
124 		res.maxEpochs = 100;
125 
126 		res.predictionError = 0.05;
127 
128 		res.predictionLayerLearningRate = 0.1;
129 
130 		res.testMatchVigilance = 0.5;
131 
132 		res.trainMatchVigilance = 0.1;
133 
134 		res.useAbsoluteError = true;
135 
136 		return res;
137 	}
138 
139 	/***
140 	 * @see yawn.config.NeuralNetworkConfig#getBindedNetworkClass()
141 	 */
142 	public Class getBindedNetworkClass() {
143 		return AppArt.class;
144 	}
145 
146 	/***
147 	 * @return Returns the desiredMeanSquaredError.
148 	 */
149 	public double getDesiredMeanSquaredError() {
150 		return desiredMeanSquaredError;
151 	}
152 
153 	/***
154 	 * @return Returns the initialDeviations.
155 	 * 
156 	 * @uml.property name="initialDeviations"
157 	 */
158 	public Pattern getInitialDeviations() {
159 		return initialDeviations;
160 	}
161 
162 	public int getInputSize() {
163 		return environment.inputSize();
164 	}
165 
166 	/***
167 	 * @return Returns the learningRate.
168 	 * 
169 	 * @uml.property name="learningRate"
170 	 */
171 	public double getLearningRate() {
172 		return learningRate;
173 	}
174 
175 	/***
176 	 * @return Returns the maxEpochs.
177 	 * 
178 	 * @uml.property name="maxEpochs"
179 	 */
180 	public long getMaxEpochs() {
181 		return maxEpochs;
182 	}
183 
184 	public int getOutputSize() {
185 		return environment.outputSize();
186 	}
187 
188 	/***
189 	 * @return Returns the predictionError.
190 	 * 
191 	 * @uml.property name="predictionError"
192 	 */
193 	public double getPredictionError() {
194 		return predictionError;
195 	}
196 
197 	/***
198 	 * @return Returns the predictionLayerLearningRate.
199 	 * 
200 	 * @uml.property name="predictionLayerLearningRate"
201 	 */
202 	public double getPredictionLayerLearningRate() {
203 		return predictionLayerLearningRate;
204 	}
205 
206 	/***
207 	 * @return Returns the testMatchVigilance.
208 	 * 
209 	 * @uml.property name="testMatchVigilance"
210 	 */
211 	public double getTestMatchVigilance() {
212 		return testMatchVigilance;
213 	}
214 
215 	/***
216 	 * @return Returns the trainMatchVigilance.
217 	 * 
218 	 * @uml.property name="trainMatchVigilance"
219 	 */
220 	public double getTrainMatchVigilance() {
221 		return trainMatchVigilance;
222 	}
223 
224 	/***
225 	 * @see yawn.config.NeuralNetworkConfig#internalValidate()
226 	 * @todo Implement internal validate
227 	 */
228 	protected void internalValidate() throws ValidationException {
229 		// TODO
230 	}
231 
232 	/***
233 	 * @return Returns the matchTrackingOneShot.
234 	 * 
235 	 * @uml.property name="matchTrackingOneShot"
236 	 */
237 	public boolean isMatchTrackingOneShot() {
238 		return matchTrackingOneShot;
239 	}
240 
241 	/***
242 	 * @return Returns the useAbsoluteError.
243 	 * 
244 	 * @uml.property name="useAbsoluteError"
245 	 */
246 	public boolean isUseAbsoluteError() {
247 		return useAbsoluteError;
248 	}
249 
250 	/***
251 	 * @param desiredMeanSquaredError
252 	 *                      The desiredMeanSquaredError to set.
253 	 */
254 	public void setDesiredMeanSquaredError(double desiredMeanSquaredError) {
255 		this.desiredMeanSquaredError = desiredMeanSquaredError;
256 	}
257 
258 	/***
259 	 * @param initialDeviations
260 	 *                      The initialDeviations to set.
261 	 * 
262 	 * @uml.property name="initialDeviations"
263 	 */
264 	public void setInitialDeviations(Pattern initialDeviations) {
265 		this.initialDeviations = initialDeviations;
266 	}
267 
268 	/***
269 	 * @param learningRate
270 	 *                      The learningRate to set.
271 	 * 
272 	 * @uml.property name="learningRate"
273 	 */
274 	public void setLearningRate(double learningRate) {
275 		this.learningRate = learningRate;
276 	}
277 
278 	/***
279 	 * @param matchTrackingOneShot
280 	 *                      The matchTrackingOneShot to set.
281 	 * 
282 	 * @uml.property name="matchTrackingOneShot"
283 	 */
284 	public void setMatchTrackingOneShot(boolean matchTrackingOneShot) {
285 		this.matchTrackingOneShot = matchTrackingOneShot;
286 	}
287 
288 	/***
289 	 * @param maxEpochs
290 	 *                      The maxEpochs to set.
291 	 * 
292 	 * @uml.property name="maxEpochs"
293 	 */
294 	public void setMaxEpochs(long maxEpochs) {
295 		this.maxEpochs = maxEpochs;
296 	}
297 
298 	/***
299 	 * @param predictionError
300 	 *                      The predictionError to set.
301 	 * 
302 	 * @uml.property name="predictionError"
303 	 */
304 	public void setPredictionError(double predictionError) {
305 		this.predictionError = predictionError;
306 	}
307 
308 	/***
309 	 * @param predictionLayerLearningRate
310 	 *                      The predictionLayerLearningRate to set.
311 	 * 
312 	 * @uml.property name="predictionLayerLearningRate"
313 	 */
314 	public void setPredictionLayerLearningRate(
315 			double predictionLayerLearningRate) {
316 		this.predictionLayerLearningRate = predictionLayerLearningRate;
317 	}
318 
319 	/***
320 	 * @param testMatchVigilance
321 	 *                      The testMatchVigilance to set.
322 	 * 
323 	 * @uml.property name="testMatchVigilance"
324 	 */
325 	public void setTestMatchVigilance(double testMatchVigilance) {
326 		this.testMatchVigilance = testMatchVigilance;
327 	}
328 
329 	/***
330 	 * @param trainMatchVigilance
331 	 *                      The trainMatchVigilance to set.
332 	 * 
333 	 * @uml.property name="trainMatchVigilance"
334 	 */
335 	public void setTrainMatchVigilance(double trainMatchVigilance) {
336 		this.trainMatchVigilance = trainMatchVigilance;
337 	}
338 
339 	/***
340 	 * @param useAbsoluteError
341 	 *                      The useAbsoluteError to set.
342 	 * 
343 	 * @uml.property name="useAbsoluteError"
344 	 */
345 	public void setUseAbsoluteError(boolean useAbsoluteError) {
346 		this.useAbsoluteError = useAbsoluteError;
347 	}
348 
349 }