y = np.array([1,2,3]) D = image_data[0][:,1] print (D.ndim) print (D) beta = sp.least_squares(D, y) print (beta) ''' ############################## D = sp.build_dictionary(image_data) y = np.random.randint(1, 71, size = 10) #print (D) #print (y) beta, indices = sp.choose_atoms(D, y) print (beta) print (indices) ##############################Built list of files to iterate through#################################################### ''' ##Big laptop #os.chdir("C:\\Users\\Jack2\\Google Drive\\URMP\\jc2\\MNIST_Load") ##Little laptop os.chdir("C:\\Users\\Jack\\Google Drive\\URMP\\jc2\\MNIST_Load") files = os.listdir() file_list = [] for i in files:
file_path = file_list[0] dictionary_data = mnist.load_images(file_path,50) y = mnist.load_images(file_list[0], 1, 100)[0].flatten() D = sp.build_dictionary(dictionary_data) #print ("D.shape: ", D.shape) approx = None ##Generate sparse code current_beta = None next_beta = None indices = None condition = True while condition: current_beta, indices = sp.choose_atoms(D, y, indices) next_beta, indices = sp.choose_atoms(D, y, indices) print (current_beta.shape, next_beta.shape) #print ("current_beta: ", current_beta, type(current_beta)) #print ("next_beta: ", next_beta, type(next_beta)) #print (type(current_beta == next_beta)) #print (current_beta == next_beta) #print ((current_beta == next_beta).all()) if isinstance(current_beta == next_beta, bool): condition = not(current_beta == next_beta) else: condition = not((current_beta == next_beta).all()) #print (condition) # print (condition, condition.all(), condition.any())