From 3d85918e26c81ae3753dd6ec8ca819e46920a0f7 Mon Sep 17 00:00:00 2001 From: Kai Staats Date: Thu, 7 Jul 2016 23:06:03 -0600 Subject: [PATCH 1/5] Delete karoo_features_sort.py --- tools/karoo_features_sort.py | 47 ------------------------------------ 1 file changed, 47 deletions(-) delete mode 100644 tools/karoo_features_sort.py diff --git a/tools/karoo_features_sort.py b/tools/karoo_features_sort.py deleted file mode 100644 index c103e2a..0000000 --- a/tools/karoo_features_sort.py +++ /dev/null @@ -1,47 +0,0 @@ -# Karoo Feature Set Prep -# Prepare a balanced dataset -# by Kai Staats, MSc UCT / AIMS and Arun Kumar, PhD - -import sys -import numpy as np - -if len(sys.argv) == 1: print '\n\t\033[31mERROR! You have not assigned an input file. Try again ...\033[0;0m'; sys.exit() -elif len(sys.argv) > 2: print '\n\t\033[31mERROR! You have assigned too many command line arguments. Try again ...\033[0;0m'; sys.exit() - -filename = sys.argv[1] # 'data/pixel_classifier/kat7-20150924-SUBSET.csv' -print '\n\t\033[36m You have opted to load the dataset:', filename, '\033[0;0m' - -samples = 5000 - -# do NOT use readline as that is very, very slow -# ideally use 'pandas', a numpy replacement which loads data 5x faster (future version) -# for now, we'll just load the damn data as we have ample RAM - -data = np.loadtxt(filename, skiprows = 1, delimiter = ',', dtype = float) #; data_x = data_x[:,0:-1] -# header = need to read the first line to retain the variables - -print '\ndata loaded' -print ' data.shape:', data.shape - -# find the indices where the final column = 0 or 1 and record the row num accordingly -data_0_list = np.where(data[:,-1] == 0) -data_1_list = np.where(data[:,-1] == 1) - -data_0 = np.random.choice(data_0_list[0], samples, replace = False) -data_1 = np.random.choice(data_1_list[0], samples, replace = False) -print '\nrandom, unique rows generated' -print ' data_0.shape:', data_0.shape -print ' data_1.shape:', data_1.shape - -print '\nready to merge data_0 and data_1 with real values' - -data_0_new = data[data_0] -data_1_new = data[data_1] -data_new = np.vstack((data_0_new, data_1_new)) -print ' data_new.shape', data_new.shape - -# np.savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', footer='', comments='# ') - -# need to append the header -np.savetxt('data_new.csv', data_new, delimiter = ',') -print '\n data saved as data_new.csv' From 26996cc491e050ce1cb7f8d0398d8202fdfdd83f Mon Sep 17 00:00:00 2001 From: Kai Staats Date: Thu, 7 Jul 2016 23:09:19 -0600 Subject: [PATCH 2/5] Delete functions_arith.csv --- files/templates/functions_arith.csv | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 files/templates/functions_arith.csv diff --git a/files/templates/functions_arith.csv b/files/templates/functions_arith.csv deleted file mode 100644 index 6eb99eb..0000000 --- a/files/templates/functions_arith.csv +++ /dev/null @@ -1,5 +0,0 @@ -# arithmetic operands -*,2 -+,2 --,2 -/,2 From 503e47c15abaca945bed710a989cbd3763aa783c Mon Sep 17 00:00:00 2001 From: Kai Staats Date: Thu, 7 Jul 2016 23:09:27 -0600 Subject: [PATCH 3/5] Delete functions_boolean.csv --- files/templates/functions_boolean.csv | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 files/templates/functions_boolean.csv diff --git a/files/templates/functions_boolean.csv b/files/templates/functions_boolean.csv deleted file mode 100644 index f3e88dd..0000000 --- a/files/templates/functions_boolean.csv +++ /dev/null @@ -1,5 +0,0 @@ -# boolean operands -and,2 -or,2 -if,3 -not,1 From 62a2f9f2b3d91ac218588f15d851b6011ab977cd Mon Sep 17 00:00:00 2001 From: Kai Staats Date: Thu, 7 Jul 2016 23:09:36 -0600 Subject: [PATCH 4/5] Delete functions_trig.csv --- files/templates/functions_trig.csv | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 files/templates/functions_trig.csv diff --git a/files/templates/functions_trig.csv b/files/templates/functions_trig.csv deleted file mode 100644 index 2efc85f..0000000 --- a/files/templates/functions_trig.csv +++ /dev/null @@ -1,21 +0,0 @@ -# trig operands, -+,2 --,2 -*,2 -/,2 -+,2 --,2 -*,2 -/,2 -+,2 --,2 -*,2 -/,2 -+,2 --,2 -*,2 -/,2 -+ cos,2 -- cos,2 -* cos,2 -/ cos,2 From e540d4d515c51d5e93fbee5abbee52d78c56d956 Mon Sep 17 00:00:00 2001 From: Kai Staats Date: Thu, 7 Jul 2016 23:10:17 -0600 Subject: [PATCH 5/5] Delete operands_list.txt --- files/templates/operands_list.txt | 55 ------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 files/templates/operands_list.txt diff --git a/files/templates/operands_list.txt b/files/templates/operands_list.txt deleted file mode 100644 index d3d8a99..0000000 --- a/files/templates/operands_list.txt +++ /dev/null @@ -1,55 +0,0 @@ -NATIVE PYTHON OPERATORS -www.tutorialspoint.com/python/python_basic_operators.htm - -** Exponentiation (raise to the power) -~ + - Complement, unary plus and minus (method names for the last two are +@ and -@) -* / % // Multiply, divide, modulo and floor division -+ - Addition and subtraction - ->> << Right and left bitwise shift - -& Bitwise 'AND'td> -^ | Bitwise exclusive `OR' and regular `OR' - -<= < > >= Comparison operators -<> == != Equality operators - -is is not Identity operators -in not in Membership operators -not or and Logical operators - -= %= /= //= -= += *= **= Assignment operators - - -GP OPERAND GROUPS -(copy / paste into functions.cvs, giving weight through quantity of copies) - -+,2 --,2 -*,2 -/,2 -**,2 (not recommended) - -and,2 or &,2 ??? -or,2 or |,2 ??? -not,1 or !,2 ??? # need to get 'not' to not fall at the end - -+ sin,2 -- sin,2 -* sin,2 -/ sin,2 - -+ cos,2 -- cos,2 -* cos,2 -/ cos,2 - -+ exp,2 -- exp,2 -* exp,2 -/ exp,2 - -+ sqrt,2 -+ sqrt,2 -- sqrt,2 -/ sqrt,2