Exemplo n.º 1
0
 def __init__(self, num_features, top_k_size):
     self.D = num_features
     self.learning_rate = 5e-1
     self.cms = CustomCountMinSketch(2, (1 << 15) - 1)
     # self.cms = CustomCountMinSketch(2, (1<<15) - 1)
     self.top_k = TopK(top_k_size)
     self.loss_val = 0
Exemplo n.º 2
0
 def __init__(self,
              sparsity,
              cms_type,
              hash_func_counts,
              batch_size,
              count_sketch_size,
              top_k,
              dataset_dict,
              top_k_dict={}):
     random.seed(42)
     self.learning_rate = 0.5
     self.cms = self.cms_dicts[cms_type](hash_func_counts,
                                         count_sketch_size)
     self.top_k = TopK(top_k)
     self.top_k_dict = top_k_dict
     self.load_dataset(dataset_dict)
     self.batch_size = batch_size
     self.sparsity = sparsity
     self.recovered_weight = np.zeros(self.features, )
     self.non_zero_indexes = np.nonzero(self.weight)
     print("non zero indexes of weights {}".format(self.non_zero_indexes))
     self.non_zero_weights = []
     for index in self.non_zero_indexes:
         self.non_zero_weights.append(self.weight[index])
     print("non zero weights {}".format(self.non_zero_weights))
     self.loss_val = 0
     self.correctly_classified = 0
 def __init__(self, num_features):
     self.D = num_features
     self.learning_rate = 5e-1
     self.cms = CountSketch(3, (1 << 18) - 1)
     # self.cms = CountSketch(3, int(np.log(self.D) ** 2 / 3))
     self.top_k = TopK((1 << 14) - 1)
     self.loss_val = 0
 def __init__(self, num_features, top_k_size, learning_rate):
     self.D = num_features
     self.w = np.array([0] * self.D)
     self.b = 0
     self.learning_rate = learning_rate
     self.cms = CustomCountMinSketch(2, (1 << 15) - 1)
     self.top_k = TopK(top_k_size)
     self.loss_val = 0
Exemplo n.º 5
0
 def __init__(self,
              cms_type,
              hash_func_counts,
              count_sketch_size,
              top_k,
              top_k_dict={}):
     self.learning_rate = 0.5
     self.cms = self.cms_dicts[cms_type](hash_func_counts,
                                         count_sketch_size)
     self.top_k = TopK(top_k)
     self.top_k_dict = top_k_dict
Exemplo n.º 6
0
 def __init__(self, num_features):
     self.D = num_features
     self.learning_rate = 0.5
     # self.cms = CustomCountSketch(3, int(np.log(self.D) ** 2 / 3))
     self.cms = CustomCountSketch(3, (1 << 18) - 1)
     self.top_k = TopK(1 << 14 - 1)
Exemplo n.º 7
0
 def __init__(self, examples, features, sparsity, dataset_files_path):
     super(LogisticRegressionWithHeap,
           self).__init__(examples, features, sparsity, dataset_files_path)
     self.top_k = TopK(sparsity)
Exemplo n.º 8
0
 def __init__(self, top_k_size):
     self.learning_rate = 0.2
     self.cms = CountSketch(3, 1000)
     # self.cms = CountSketch(3, int(np.log(self.D) ** 2 / 3))
     self.top_k = TopK(top_k_size)
     self.loss_val = 0
Exemplo n.º 9
0
 def __init__(self, count_sketch_size, top_k, feature_size):
     self.learning_rate = 0.5
     self.cms = CustomCountMinSketch(2, count_sketch_size)
     self.top_k = TopK(top_k)
     self.recovered_weight_vector = [0] * feature_size
Exemplo n.º 10
0
 def __init__(self, dimensions, train_file, test_file, size_topK):
     super(LogisticRegressionWithHeap,
           self).__init__(dimensions, train_file, test_file)
     self.top_k = TopK(size_topK)
     self.top_k_dict = {}
Exemplo n.º 11
0
 def __init__(self, num_features):
     self.learning_rate = 5e-1
     self.cms = CustomCountSketch(3, (1 << 18) - 1)
     self.top_k = TopK(num_features)
     self.loss_val = 0