de.webdings.jannis.neuralnet

Class PatternConverter


public class PatternConverter
extends java.lang.Object

PatternConverter is used to convert java.lang.Strings to arrays of Patterns and vice versa. The character "0" corresponds to an pattern entry of false, "1" to true .

Version:
0.1 01.08.2005

Author:
Stefan Thesing
Website: http://www.webdings.de

Method Summary

static String
patternToStr(Pattern[] pattern, int patternSize)
static Pattern[]
strToPattern(String s, int patternSize)

Method Details

patternToStr

public static String patternToStr(Pattern[] pattern,
                                  int patternSize)

Parameters:
pattern - an array of Patterns
patternSize - The size of the pattern (usually the number of neurons contained in the input or output layer)

Returns:
a java.lang.String representing the patterns.


strToPattern

public static Pattern[] strToPattern(String s,
                                     int patternSize)
            throws PatternCreateException

Parameters:
s - The java.lang.String containing a representation of the pattern
patternSize - The size of the pattern (usually the number of neurons contained in the input or output layer)

Returns:
an array of Patterns

Throws:
PatternCreateException - if the string contains characters other than 0 and 1


PatternConverter.java - Copyright (c) 2005 by Stefan Thesing

This file is part of Jannis.

Jannis is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Jannis is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Jannis; if not, write to the
Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA



© 2005 by Stefan Thesing;
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.