havBpNet:J
|
All Packages Class Hierarchy This Package Previous Next Index
havBpNet:J Home Page
Class havNN.havData.havTdata
java.lang.Object
|
+----havNN.havData.havTdata
- public class havTdata
- extends Object
The havTdata class implements a data collection class that can be used for
handling input and expected data patterns used in training or consulting a
neural net constructed with havBpNet-J.
Design, Implementation, and Usage Notes
The havTdata class was designed as a mechanism for holding a collection of patterns and for
controlling those operations that are typically performed on the entire collection of patterns
(like reading, scaling, random ordering, etc.). You will notice that many of the methods appear
in several forms: one for operating on entire patterns (both the input-pattern &
expected-pattern parts) or on the individual parts of patterns. For example, there are three
methods for calculation of mean and std-dev parameters:
- CalculateParms() - calculates M&S values for both input-pattern and expected-pattern
parts of all patterns in the collection;
- CalculatePatParms() - calculates M&S values for only the input-pattern parts of all
patterns in the collection;
- CalculateExpParms() - calculates the M&S values for only the expected-pattern part of all
patterns in the collection.
This was done to allow a high degree of flexibility; however, we expect that the first form
will be most often used.
- Version:
- 1.1(java) 1/1/98
-
havTdata(int, int, int, String, int, double)
-
Standard Constructor.
-
CalculateMean()
- Calculate the Means for both INPUT and EXPECTED patterns.
-
CalculateParms()
- Calculate Mean and Standard Deviation values.
-
CalculateStdDev()
- Calculate the standard-deviations for both the input and expected pattern
elements of all patterns in the data set.
-
CopyMean(double[])
- Copy this instance's EXPECTED Pattern Means into a caller supplied array.
-
CopyParms(havTdata)
- Copy the INPUT and EXPECTED Pattern Mean & Std-dev values FROM another instance of havTdata.
-
CopyPMean(double[])
- Copy this instance's INPUT Pattern Means into a caller supplied array.
-
CopyPStdDev(double[])
- Copy this instance's INPUT Pattern Std-dev's into a caller supplied array.
-
CopyStdDev(double[])
- Copy this instance's EXPECTED Pattern Std-dev's into a caller supplied array.
-
GetMean()
- Get a reference to the local list of EXPECTED Pattern Mean values.
-
GetMean(int)
- Get the Mean of the i-th EXPECTED Pattern element.
-
GetPat(int)
-
Get the pnum-th pattern.
-
GetPMean()
- Get a reference to the local list of INPUT Pattern Mean values.
-
GetPMean(int)
- Get the Mean of the i-th INPUT Pattern element.
-
GetPStdDev()
- Get a reference to the local list of INPUT Pattern Std-dev values.
-
GetPStdDev(int)
- Get the Std-dev of the i-th INPUT Pattern element.
-
GetRandPat(int)
-
Get the pnum-th RANDOM pattern.
-
GetStdDev()
- Get a reference to the local list of INPUT Pattern Std-dev values.
-
GetStdDev(int)
- Get the Std-dev of the i-th INPUT Pattern element.
-
Normalize()
- Apply Mean & Std-dev Normalization to both INPUT & EXPECTED patterns.
-
NormalizeExp()
- Apply Mean & Std-dev Normalization to EXPECTED patterns.
-
NormalizePat()
- Apply Mean & Std-dev Normalization to INPUT patterns.
-
PutMean(double[])
- Set EXPECTED Means.
-
PutPMean(double[])
- Set INPUT Means.
-
PutPStdDev(double[])
- Set INPUT Std-dev's.
-
PutStdDev(double[])
- Set EXPECTED Std-dev's.
-
Randomize()
- Generate new random pattern order.
-
RestoreParms(StreamTokenizer)
-
Restore the mean and standard-deviation values.
-
SaveParms(FileOutputStream)
-
Save the mean and standard-deviation values.
-
ShowRandList()
- Print the current random order list to stdout.
-
SkipRestoreParms(StreamTokenizer)
-
Skip saved Mean & Std-dev data in a SAVE file.
havTdata
public havTdata(int num_pat,
int pat_size,
int exp_size,
String fname,
int do_havlog,
double shape) throws IOException
- Standard Constructor.
- Parameters:
- num_pat - number of patterns in the dataset.
- pat_size - number of elements in an INPUT pattern.
- exp_size - number of elements in an EXPECTED pattern.
- fname - name of the file containing the data to be read in.
- do_havlog - havSys.havTRUE means to perform havlog scaling on data.
- shape - shaping factor for havlog scaling.
- Throws: IOException
- thrown if IO error occurs while reading data.
GetPat
public havTpat GetPat(int pnum)
- Get the pnum-th pattern.
- Parameters:
- pnum - index (from 0) of the pattern to be returned.
GetRandPat
public havTpat GetRandPat(int pnum)
- Get the pnum-th RANDOM pattern.
- Parameters:
- pnum - index (from 0) of the pattern in the random order list to be returned.
SaveParms
public void SaveParms(FileOutputStream out) throws IOException
- Save the mean and standard-deviation values.
Mean and Std-dev for both the pattern and expected values are saved in the caller indicated
file.
- Parameters:
- out - the SAVE file. The SAVE file is expected to be open and positioned
prior to using this method.
- Throws: IOException
- thrown if IO error occurs while writing data.
RestoreParms
public void RestoreParms(StreamTokenizer in) throws IOException
- Restore the mean and standard-deviation values.
Mean and Std-dev for both the pattern and expected values are restored from the caller
indicated file.
- Parameters:
- in - the SAVE file. The SAVE file is expected to be open and positioned
prior to using this method.
- Throws: IOException
- thrown if IO error occurs while reading data.
SkipRestoreParms
public void SkipRestoreParms(StreamTokenizer in) throws IOException
- Skip saved Mean & Std-dev data in a SAVE file.
This method will position a SAVE file past the havTdata
mean and standard-deviation values in the indicated save file.
- Parameters:
- in - the SAVE file.
- Throws: IOException
- thrown if IO error occurs while reading data.
CalculateParms
public void CalculateParms()
- Calculate Mean and Standard Deviation values.
This method will calculate the mean and standard-deviation values for
the patterns currently in the patterns member. There will be one mean
and one standard-deviation for each element in both the input pattern
and the expected pattern.
Randomize
public void Randomize()
- Generate new random pattern order.
This method will generate a new random order list for pattern processing.
The list will be stored in the rand_list member.
This function may be called as often and whenever desired.
ShowRandList
public void ShowRandList()
- Print the current random order list to stdout.
CopyParms
public void CopyParms(havTdata in)
- Copy the INPUT and EXPECTED Pattern Mean & Std-dev values FROM another instance of havTdata.
Both input and expected patterns are copied.
- Parameters:
- in - the havTpat instance FROM which patterns are to be copied.
CopyPMean
public void CopyPMean(double m[])
- Copy this instance's INPUT Pattern Means into a caller supplied array.
- Parameters:
- m - the array INTO which data is copied.
GetPMean
public double GetPMean(int i)
- Get the Mean of the i-th INPUT Pattern element.
- Parameters:
- i - the index (from 0) of the element who's mean is to be returned.
GetPMean
public double[] GetPMean()
- Get a reference to the local list of INPUT Pattern Mean values.
CopyPStdDev
public void CopyPStdDev(double s[])
- Copy this instance's INPUT Pattern Std-dev's into a caller supplied array.
- Parameters:
- s - the array INTO which data is copied.
GetPStdDev
public double GetPStdDev(int i)
- Get the Std-dev of the i-th INPUT Pattern element.
- Parameters:
- i - the index (from 0) of the element who's mean is to be returned.
GetPStdDev
public double[] GetPStdDev()
- Get a reference to the local list of INPUT Pattern Std-dev values.
CopyMean
public void CopyMean(double m[])
- Copy this instance's EXPECTED Pattern Means into a caller supplied array.
- Parameters:
- m - the array INTO which data is copied.
GetMean
public double GetMean(int i)
- Get the Mean of the i-th EXPECTED Pattern element.
- Parameters:
- i - the index (from 0) of the element who's mean is to be returned.
GetMean
public double[] GetMean()
- Get a reference to the local list of EXPECTED Pattern Mean values.
CopyStdDev
public void CopyStdDev(double s[])
- Copy this instance's EXPECTED Pattern Std-dev's into a caller supplied array.
- Parameters:
- s - the array INTO which data is copied.
GetStdDev
public double GetStdDev(int i)
- Get the Std-dev of the i-th INPUT Pattern element.
- Parameters:
- i - the index (from 0) of the element who's mean is to be returned.
GetStdDev
public double[] GetStdDev()
- Get a reference to the local list of INPUT Pattern Std-dev values.
CalculateMean
public void CalculateMean()
- Calculate the Means for both INPUT and EXPECTED patterns.
There will be one mean for each element in the input pattern and expected pattern.
Mean is calculated for each element (ele[k]) as the sum of ele[k] for all patterns
in the data set divided by the number of patterns in the data set.
PutPMean
public void PutPMean(double m[])
- Set INPUT Means. Sets all Mean values to a caller supplied list of values.
- Parameters:
- m - caller supplied list of values.
PutMean
public void PutMean(double m[])
- Set EXPECTED Means. Sets all Mean values to a caller
supplied list of values.
- Parameters:
- m - caller supplied list of values.
CalculateStdDev
public void CalculateStdDev()
- Calculate the standard-deviations for both the input and expected pattern
elements of all patterns in the data set.
For each pattern element (ele[k]) the standard deviation is calculated as
the sqrt of the sum of the squared differences between the pattern's ele[k] and
the mean for ele[k].
PutPStdDev
public void PutPStdDev(double s[])
- Set INPUT Std-dev's.
Replace this instance's INPUT pattern standard-deviations
by a caller supplied list of std-dev values.
- Parameters:
- s - the caller supplied list of Std-dev values.
PutStdDev
public void PutStdDev(double s[])
- Set EXPECTED Std-dev's.
Replace this instance's EXPECTED pattern standard-deviations
by a caller supplied list of std-dev values.
- Parameters:
- s - the caller supplied list of Std-dev values.
Normalize
public void Normalize()
- Apply Mean & Std-dev Normalization to both INPUT & EXPECTED patterns.
NormalizePat
public void NormalizePat()
- Apply Mean & Std-dev Normalization to INPUT patterns.
Each element (ele k of pattern i) is modified by subtracting the appropriate Mean and
dividing by the appropriate Standard-deviation as ...
ele[i][k] = (ele[i][k] - mean[k]) / stdev[k]
NormalizeExp
public void NormalizeExp()
- Apply Mean & Std-dev Normalization to EXPECTED patterns.
Each element (ele k of pattern i) is modified by subtracting the appropriate Mean and
dividing by the appropriate Standard-deviation as ...
ele[i][k] = (ele[i][k] - mean[k]) / stdev[k]
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1998 by hav.Software. All Rights Reserved.