a set of C++ library classes
for neural networks development



class d_Rand_gr_equal_constraints

Random decompsition algorithm with greater or equal constraints.

Inheritance:


Public Methods

[more] d_Rand_gr_equal_constraints ()
Dummy constructor
[more] d_Rand_gr_equal_constraints (unsigned nclass, unsigned ndico, unsigned min_dicho_dist = 1, unsigned min_codeword_dist = 2, unsigned ntimes = 10)
Constructor
[more] d_Rand_gr_equal_constraints (char* file)
Constructor
[more]virtual ~d_Rand_gr_equal_constraints ()
Destructor
[more]d_Rand_gr_equal_constraints* decrementHD (int n_pos = 1, int ntimes = 1, bool pos = false)
Algorithm to decrement the minimum Hammin distance between codewords
It tries to decremet the minimum Hamming distance between codewords substituting randomly a row with a fixed numer of +1 or -1 to the decomposition matrix.
[more]d_Rand_gr_equal_constraints* incrementHD (int n_pos = 1, int ntimes = 1, bool pos = false)
Algorithm to increment the minimum Hammin distance between codewords
It tries to increment the minimum Hamming distance between codewords substituting randomly a row with a fixed numer of +1 or -1 to the decomposition matrix.
[more] d_Rand_gr_equal_constraints (const d_Rand_gr_equal_constraints& d)
Copy constructor
[more]d_Rand_gr_equal_constraints& operator= (const d_Rand_gr_equal_constraints& d)
Overload assignement operator

Protected Fields

[more]unsigned times
Iterations of the random generation
[more]long seed
initial seed for the random generator

Protected Methods

[more]virtual unsigned Do_Rand_matrix (unsigned min_dicho_dist = 1, unsigned min_codeword_dist = 2, unsigned ntimes = 1)
Build a decomposition matrix D using random codes and returns the minimum Hamming distance between columns.
[more]void Make_Rand_matrix (unsigned min_dicho_dist = 1)
Build a single decomposition matrix D using random codes.
[more]vect& generate_row (vect& x, bool pos = false, int n_pos = 1)
Generates a random row of the matrix with a fixed number of +1 and -1


Inherited from d_OPC:

Public Methods

omatrix& Read_matrix(void)
omatrix Copy_matrix(void)
ovoid save_matrix(ofstream& f)
ounsigned Hamming_distance(const vect& v1, const vect& v2)
ounsigned MinHamming(unsigned nclass = 3)
ofloat Avg_Hamming_distance(void)
ounsigned Min_Dichotomy_distance(void)
ofloat Avg_Dichotomy_distance(void)
obool Banal_dichotomy(void)
ounsigned Read_n_class(void)
ounsigned Read_n_dico(void)
ovoid print_matrix(void)

Public Members

oenum matrix_val

Protected Fields

ounsigned n_class
ounsigned n_dico
omatrix D

Protected Methods

ovoid Init_D(matrix_val val)


Documentation

Decomposition random algorithm with greater or equal constraints
It generates random constrained codes using random generation and selecting the codes with the maximum of the minimum pairwise Hamming distance between the codewords above a desired threshold, or, if the maximun number of iterations is reached, the best codes generated. Only correct and not trivial decomposition matrices are generated (that is only decompostion matrices with no equal rows or columns without complementary rows). Generation algorithms allow constraints also on the minimum Hamming distance between rows (diversity of dichotomizers' task).
ounsigned times
Iterations of the random generation

olong seed
initial seed for the random generator

ovirtual unsigned Do_Rand_matrix(unsigned min_dicho_dist = 1, unsigned min_codeword_dist = 2, unsigned ntimes = 1)
Build a decomposition matrix D using random codes and returns the minimum Hamming distance between columns. It tries ntimes times to generate randomly the codewords, considering valid a guess only if the minimum Hamming distance between rows (dichotomies) is above min_dist, retaining the bst matrix (i.e. the matrix with maximum pairwise minimum distance among columns (codewords).
Parameters:
min_dicho_dist - minimum Hamming distance between each pair od rows
min_codeword_dist - maximum of the minimum Hamming distance between each pair of columns (codewords)
ntimes - number of random guessing of the decomposition matrix
Returns:
minimum hamming distance between columnd of the selected deomposition matrix

ovoid Make_Rand_matrix(unsigned min_dicho_dist = 1)
Build a single decomposition matrix D using random codes. It generates a random matrix with minimum Hamming distance between rows equal to min_dist. It generates only non trivial decompositiom matrices.
Parameters:
min_dicho_dist - minimum Haming distance between each pair od rows

ovect& generate_row(vect& x, bool pos = false, int n_pos = 1)
Generates a random row of the matrix with a fixed number of +1 and -1
Parameters:
x - vector to be generated
pos - if false a row of -1 is generated except for random n_pos positions, otherwise the opposite.
n_pos - number of random +1 (if pos is false) or -1 (if pos is true)
Returns:
vector to be generated

o d_Rand_gr_equal_constraints()
Dummy constructor

o d_Rand_gr_equal_constraints(unsigned nclass, unsigned ndico, unsigned min_dicho_dist = 1, unsigned min_codeword_dist = 2, unsigned ntimes = 10)
Constructor
Parameters:
- nclass number of classes (columns of the random decomposition matrix)
- ndico number of dichotomies (rows of the random decomposition matrix)
min_dicho_dist - minimum Hamming distance between each pair of rows
min_codeword_dist - minimum Hamming distance between each pair of columns (codewords)
ntimes - number of random guessing of the decomposition matrix

o d_Rand_gr_equal_constraints(char* file)
Constructor
Parameters:
file - file where the decomposition matrix is stored

ovirtual ~d_Rand_gr_equal_constraints()
Destructor

od_Rand_gr_equal_constraints* decrementHD(int n_pos = 1, int ntimes = 1, bool pos = false)
Algorithm to decrement the minimum Hammin distance between codewords
It tries to decremet the minimum Hamming distance between codewords substituting randomly a row with a fixed numer of +1 or -1 to the decomposition matrix. Note that if the attempt is not successfull the method returns a NULL pointer.
Parameters:
n_pos - number of random +1 (if pos is false) or -1 (if pos is true)
ntimes - number of random guessing: it is equal to ntimes*rows*columns
pos - if false a row of -1 is generated except for random n_pos positions, otherwise the opposite.
Returns:
the random decomposition matrix if the attemp is successfull, NULL otherwise.

od_Rand_gr_equal_constraints* incrementHD(int n_pos = 1, int ntimes = 1, bool pos = false)
Algorithm to increment the minimum Hammin distance between codewords
It tries to increment the minimum Hamming distance between codewords substituting randomly a row with a fixed numer of +1 or -1 to the decomposition matrix. Note that if the attempt is not successfull the method returns a NULL pointer.
Parameters:
n_pos - number of random +1 (if pos is false) or -1 (if pos is true)
ntimes - number of random guessing: it is equal to ntimes*rows*columns
pos - if false a row of -1 is generated except for random n_pos positions, otherwise the opposite.
Returns:
the random decomposition matrix if the attemp is successfull, NULL otherwise.

o d_Rand_gr_equal_constraints(const d_Rand_gr_equal_constraints& d)
Copy constructor

od_Rand_gr_equal_constraints& operator=(const d_Rand_gr_equal_constraints& d)
Overload assignement operator


Direct child classes:
d_Rand_equal_constraints
d_Rand_constraints_multiple
d_Rand

Alphabetic index HTML hierarchy of classes or Java


Last Updated February 2001
For comments and suggestions mail to Giorgio Valentini