Chcked mutual_info with sklearn

This commit is contained in:
2023-06-23 01:21:24 +02:00
parent 0094d500d4
commit 30cc744033
7 changed files with 982 additions and 386 deletions

View File

@@ -2,50 +2,29 @@
# cython: language_level = 3
from libcpp.vector cimport vector
from libcpp.string cimport string
from libcpp cimport bool
cdef extern from "FeatureTest.h" namespace "featuresTest":
ctypedef float precision_t
cdef cppclass SelectKBest:
SelectKBest(vector[int]&) except +
cdef extern from "FeatureSelect.h" namespace "features":
ctypedef double precision_t
cdef cppclass SelectKBestWeighted:
SelectKBestWeighted(vector[vector[int]]&, vector[int]&, vector[precision_t]&, int, bool) except +
void fit()
string version()
vector[precision_t] getScore()
cdef class CSelectKBest:
cdef SelectKBest *thisptr
def __cinit__(self, X):
self.thisptr = new SelectKBest(X)
cdef class CSelectKBestWeighted:
cdef SelectKBestWeighted *thisptr
def __cinit__(self, X, y, weights, k, natural=False): # log or log2
self.thisptr = new SelectKBestWeighted(X, y, weights, k, natural)
def __dealloc__(self):
del self.thisptr
def fit(self,):
self.thisptr.fit()
return self
def get_score(self):
return self.thisptr.getScore()
def get_version(self):
return self.thisptr.version()
def __reduce__(self):
return (CSelectKBest, ())
# cdef extern from "FeatureSelect.h" namespace "features":
# ctypedef float precision_t
# cdef cppclass SelectKBestWeighted:
# SelectKBestWeighted(vector[int]&) except +
# # SelectKBestWeighted(vector[int]&, vector[int]&, vector[precision_t]&, int) except +
# void fit()
# string version()
# vector[precision_t] getScore()
# cdef class CSelectKBestWeighted:
# cdef SelectKBestWeighted *thisptr
# def __cinit__(self, X, y, weights, k):
# # self.thisptr = new SelectKBestWeighted(X, y, weights, k)
# self.thisptr = new SelectKBestWeighted(X)
# def __dealloc__(self):
# del self.thisptr
# def fit(self,):
# self.thisptr.fit()
# return self
# def get_score(self):
# return self.thisptr.getScore()
# def get_version(self):
# return self.thisptr.version()
# def __reduce__(self):
# return (CSelectKBestWeighted, ())
return (CSelectKBestWeighted, ())