def __init__(self, dirname, soname, forced_rebuild=False):
        self.clib_float32 = load_dynamic_library(dirname,
                                                 soname + "_float32",
                                                 forced_rebuild=forced_rebuild)
        self.clib_float64 = load_dynamic_library(dirname,
                                                 soname + "_float64",
                                                 forced_rebuild=forced_rebuild)
        arg_list = [
            POINTER(PyMatrix),  # PyMatrix X
            POINTER(PyMatrix),  # PyMatrix Y
            POINTER(PyMatrix),  # PyMatrix C
            POINTER(PyMatrix),  # PyMatrix Z
            COOAllocator.CFUNCTYPE,  # py_coo_allocator
            c_double,  # threshold
            c_int,  # solver_type
            c_double,  # Cp
            c_double,  # Cn
            c_uint64,  # max_iter
            c_double,  # eps
            c_double,  # bias
            c_int,  # threads
        ]
        fillprototype(self.clib_float32.c_multilabel_train_with_codes, None,
                      arg_list)
        fillprototype(self.clib_float64.c_multilabel_train_with_codes, None,
                      arg_list)

        arg_list = [
            POINTER(PyMatrix),
            POINTER(PyMatrix),
            POINTER(PyMatrix),
            POINTER(PyMatrix),
            PredAllocator.CFUNCTYPE,
            c_int,
        ]
        fillprototype(self.clib_float32.c_multilabel_predict_with_codes, None,
                      arg_list)
        fillprototype(self.clib_float64.c_multilabel_predict_with_codes, None,
                      arg_list)

        arg_list = [
            POINTER(PyMatrix),
            POINTER(PyMatrix),
            c_uint64,
            POINTER(c_uint32),
            POINTER(c_uint32),
            c_void_p,
            c_int,
        ]
        fillprototype(self.clib_float32.c_sparse_inner_products, None,
                      arg_list)
        fillprototype(self.clib_float64.c_sparse_inner_products, None,
                      arg_list)
Exemple #2
0
 def __init__(self, dirname, soname, forced_rebuild=False):
     self.clib_float32 = load_dynamic_library(dirname,
                                              soname + '_float32',
                                              forced_rebuild=forced_rebuild)
     self.clib_float64 = load_dynamic_library(dirname,
                                              soname + '_float64',
                                              forced_rebuild=forced_rebuild)
     arg_list = [
         POINTER(PyMatrix), c_uint32, c_uint32, c_int32, c_uint32, c_int32,
         POINTER(c_uint32)
     ]
     fillprototype(self.clib_float32.get_codes, None, arg_list)
     fillprototype(self.clib_float64.get_codes, None, arg_list)