def corr(args):
    if args.alg == 0:
        c = PearsonCorrelation(args.h5database)
        corr_matrix = c.find_correlations()
        if args.out is not None:
            with open(args.out, 'wb') as f:
                pickle.dump(corr_matrix, f)
    elif args.alg == 1:
        c = FourierApproximation(args.h5database)
        corr_matrix = c.find_correlations(args.k, args.T, args.B, args.e)
        if args.out is not None:
            with open(args.out, 'wb') as f:
                pickle.dump(corr_matrix, f)
    elif args.alg == 2:
        c = BooleanCorrelation(args.h5database, args.validate)
        boolean_corr_matrix = c.boolean_approximation(args.T)
        if args.out is not None:
            with open(args.out, 'wb') as f:
                pickle.dump(boolean_corr_matrix, f)
Exemplo n.º 2
0
 def __init__(self, t_dataset_path: str, validation=False):
     """
     :param t_dataset_path: original dataset path
     """
     self.norm_ds_path = t_dataset_path
     self.norm_ds = DatasetH5(t_dataset_path)
     self.UB = np.full(shape=(len(self.norm_ds), len(self.norm_ds)),
                       fill_value=sys.maxsize,
                       dtype="float32",
                       order="C")
     self.LB = np.zeros(shape=(len(self.norm_ds), len(self.norm_ds)),
                        dtype="float32",
                        order="C")
     self.CB = np.zeros(shape=(len(self.norm_ds), len(self.norm_ds)),
                        dtype="b1",
                        order="C")
     self.cache = [None] * len(self.norm_ds)
     self.logger = logging.getLogger("Correlation2")
     if validation:
         self.c = PearsonCorrelation(self.norm_ds_path)
     self.validation = validation