diff --git a/tools/karoo_iris_plot.py b/tools/karoo_iris_plot.py index 5847850..b22ba49 100644 --- a/tools/karoo_iris_plot.py +++ b/tools/karoo_iris_plot.py @@ -1,6 +1,6 @@ # Karoo Iris Plot # by Kai Staats, MSc UCT / AIMS and Arun Kumar, PhD -# version 0.9.2.0 +# version 0.9.2.1 import sys import numpy as np diff --git a/tools/karoo_multiclassifier.py b/tools/karoo_multiclassifier.py index 92502a4..ae470ce 100644 --- a/tools/karoo_multiclassifier.py +++ b/tools/karoo_multiclassifier.py @@ -1,6 +1,6 @@ # Karoo Multiclass Classifer Test # by Kai Staats, MSc UCT / AIMS -# version 0.9.2.0 +# version 0.9.2.1 ''' This is a toy script, designed to allow you to play with multiclass classification using the same underlying function @@ -20,7 +20,7 @@ while True: n = range(1,100) while True: try: - class_labels = raw_input('\t Enter the number of class labels (default 4): ') + class_labels = raw_input('\t Enter the number of class labels / solutions (default 4): ') if class_labels not in str(n) and class_labels not in '': raise ValueError() if class_labels == '0': class_labels = 1; break class_labels = class_labels or 4; class_labels = int(class_labels); break @@ -32,36 +32,36 @@ min_val = 0 - skew - 1 # add a data point to the left if class_labels & 1: max_val = 0 + skew + 3 # add a data point to the right if odd number of class labels else: max_val = 0 + skew + 2 # add a data point to the right if even number of class labels -print '\n\t class_labels =', range(class_labels) -print '\t solutions = [', min_val, '...', max_val,']' +print '\n\t solutions =', range(class_labels) +print '\t results = [', min_val, '...', max_val,']' print '\t skew =', skew, '\n' if class_type == 'i': - for solution in arange(min_val, max_val, 0.5): - for label in range(class_labels): + for result in arange(min_val, max_val, 0.5): + for solution in range(class_labels): - if label == 0 and solution <= 0 - skew: # check for the first class - fitness = 1; print '\t\033[36m\033[1m class', label, '\033[0;0m\033[36mas\033[1m', solution, '\033[0;0m\033[36m<=', 0 - skew, '\033[0;0m' + if solution == 0 and result <= 0 - skew: # check for the first class + fitness = 1; print '\t\033[36m\033[1m class', solution, '\033[0;0m\033[36mas\033[1m', result, '\033[0;0m\033[36m<=', 0 - skew, '\033[0;0m' - elif label == class_labels - 1 and solution > label - 1 - skew: # check for the last class - fitness = 1; print '\t\033[36m\033[1m class', label, '\033[0;0m\033[36mas\033[1m', solution, '\033[0;0m\033[36m>', label - 1 - skew, '\033[0;0m' + elif solution == class_labels - 1 and result > solution - 1 - skew: # check for the last class + fitness = 1; print '\t\033[36m\033[1m class', solution, '\033[0;0m\033[36mas\033[1m', result, '\033[0;0m\033[36m>', solution - 1 - skew, '\033[0;0m' - elif label - 1 - skew < solution <= label - skew: # check for class bins between first and last - fitness = 1; print '\t\033[36m\033[1m class', label, '\033[0;0m\033[36mas', label - 1 - skew, '<\033[1m', solution, '\033[0;0m\033[36m<=', label - skew, '\033[0;0m' + elif solution - 1 - skew < result <= solution - skew: # check for class bins between first and last + fitness = 1; print '\t\033[36m\033[1m class', solution, '\033[0;0m\033[36mas', solution - 1 - skew, '<\033[1m', result, '\033[0;0m\033[36m<=', solution - skew, '\033[0;0m' - else: fitness = 0 #; print '\t\033[36m no match for', solution, 'in class', label, '\033[0;0m' # no class match + else: fitness = 0 #; print '\t\033[36m no match for', result, 'in class', solution, '\033[0;0m' # no class match # print '' if class_type == 'f': - for solution in arange(min_val, max_val, .5): - for label in range(class_labels): + for result in arange(min_val, max_val, .5): + for solution in range(class_labels): - if label - 1 - skew < solution <= label - skew: # check for discrete, finite class bins - fitness = 1; print '\t\033[36m\033[1m class', label, '\033[0;0m\033[36mas', label - 1 - skew, '<\033[1m', solution, '\033[0;0m\033[36m<=', label - skew, '\033[0;0m' + if solution - 1 - skew < result <= solution - skew: # check for discrete, finite class bins + fitness = 1; print '\t\033[36m\033[1m class', solution, '\033[0;0m\033[36mas', solution - 1 - skew, '<\033[1m', result, '\033[0;0m\033[36m<=', solution - skew, '\033[0;0m' - else: fitness = 0 #; print '\t\033[36m no match for', solution, 'in class', label, '\033[0;0m' # no class match + else: fitness = 0 #; print '\t\033[36m no match for', result, 'in class', solution, '\033[0;0m' # no class match # print '' diff --git a/tools/karoo_normalise.py b/tools/karoo_normalise.py index f21c11f..4ce473f 100644 --- a/tools/karoo_normalise.py +++ b/tools/karoo_normalise.py @@ -1,6 +1,6 @@ # Karoo Data Normalisation # by Kai Staats, MSc UCT -# version 0.9.2.0 +# version 0.9.2.1 import sys import numpy as np diff --git a/tools/karoo_sort.py b/tools/karoo_sort.py index 145f32d..a1b3826 100644 --- a/tools/karoo_sort.py +++ b/tools/karoo_sort.py @@ -1,6 +1,6 @@ # Karoo Dataset Builder # by Kai Staats, MSc UCT / AIMS and Arun Kumar, PhD -# version 0.9.2.0 +# version 0.9.2.1 import sys import numpy as np