Skip to content

Commit

Permalink
removing __name__ debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
schmouck committed Apr 30, 2021
1 parent edc3fc0 commit 2dff73a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 104 deletions.
33 changes: 1 addition & 32 deletions group_testing/generate_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,35 +207,4 @@ def gen_measurement_matrix(seed=0, N=1000, m=100, group_size=4, max_tests_per_in
# sio.savemat(opts['data_filename'], data)

# return the adjacency matrix of the graph
return A


if __name__ == '__main__':
"""
Main method for testing
"""

# print igraph version
print("Loaded igraph version {}".format(igraph.__version__))

# options for plotting, verbose output, saving, seed
opts = {}
opts['m'] = 100
opts['N'] = 500
opts['group_size'] = 6
opts['max_tests_per_individual'] = 15
opts['graph_gen_method'] = 'no_multiple' # options are "no_multiple" or "simple"
opts['verbose'] = True # False
opts['plotting'] = False # False
opts['saving'] = True
opts['run_ID'] = 'GT_matrix_generation_component'
#opts['data_filename'] = opts['run_ID'] + '_generate_groups_output.mat'
opts['seed'] = 0

# generate the measurement matrix with igraph
A = gen_measurement_matrix(**opts)

# print shape of matrix
if opts['verbose']:
print("Generated adjacency matrix of size:")
print(A.shape)
return A
23 changes: 0 additions & 23 deletions group_testing/generate_individual_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,3 @@ def gen_status_vector(seed=0, N=1000, s=10, verbose=False):
sys.exit()

return u

if __name__ == '__main__':
"""
Main method for testing
"""

# options for plotting, verbose output, saving, seed
opts = {}
opts['N'] = 500
opts['s'] = 20
opts['verbose'] = True #False
# opts['plotting'] = True #False
# opts['saving'] = True
# opts['run_ID'] = 'GT_status_vector_generation_component'
# opts['data_filename'] = opts['run_ID'] + '_generate_groups_output.mat'
opts['seed'] = 0

u = gen_status_vector(**opts)

# print shape of matrix
if opts['verbose']:
print("Generated status vector of size:")
print(u.shape)
49 changes: 0 additions & 49 deletions group_testing/group_testing_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,52 +245,3 @@ def decodingScore(self, w_true):

def write(self):
pass


if __name__ == '__main__':
"""
Main method for testing decoder
"""
# options for plotting, verbose output, saving, seed
opts = {}
opts['m'] = 150
opts['N'] = 300
opts['verbose'] = True # False
opts['plotting'] = True # False
opts['saving'] = True
opts['run_ID'] = 'GT_test_result_vector_generation_component'
opts['data_filename'] = opts['run_ID'] + '_generate_groups_output.mat'
opts['test_noise_methods'] = []
opts['seed'] = 0

A = np.random.randint(2, size=(opts['m'], opts['N']))
u = np.random.randint(2, size=opts['N'])
b = gen_test_vector(A, u, opts)
# print(A)
# print(b)
# print(u)

# Test
# A = np.array([[1,0,0],[1,0,1],[0,1,0]])
# b = np.array([1,0,1])
current_directory = os.getcwd()
file_path = os.path.join(current_directory, r'problem.mps')

param = {}
# param['file_path'] = file_path
param['lambda_w'] = 1
param['lambda_p'] = 100
param['lambda_n'] = 100
# param['verbose'] = False
param['defective_num_lower_bound'] = None
param['sensitivity_threshold'] = None
param['specificity_threshold'] = None
param['is_it_noiseless'] = True
param['lp_relaxation'] = True
param['solver_name'] = 'COIN_CMD'
param['solver_options'] = {'timeLimit': 60, 'logPath': 'log.txt'}

c = GroupTestingDecoder(**param)
c.fit(A, b)
print(c.decodingScore(b))

0 comments on commit 2dff73a

Please sign in to comment.