コード例 #1
0
 def compute_scores(self, dataframe: pd.DataFrame, classes: np.array):
     if "n_neighbors" in self.settings:
         k = int(self.settings["n_neighbors"])
     bin_dataframe = dataframe._binarize_categorical_values()
     self.clf = KDNMetric()
     self.values = self.clf.countKDN(bin_dataframe, classes, k)
     print("KDN done sucessfully!")
     return self
コード例 #2
0
class KDN(AbstractDetector):
    name = "KDN"
    data_type = "REAL"

    def compute_scores(self, dataframe: pd.DataFrame, classes: np.array):
        if "n_neighbors" in self.settings:
            k = int(self.settings["n_neighbors"])
        else:
            k = 10
        bin_dataframe = dataframe._binarize_categorical_values()
        self.clf = KDNMetric()
        self.values = self.clf.countKDN(bin_dataframe, classes, k)
        # print("KDN done sucessfully!")
        return self