def learn_structure(self, samples):
X_train, X_train_label, X_test, X_test_label = \
self._generate_train_test_sets(samples, 0.75)
logger.info('Training with ' + str(len(X_train)) +
'samples; testing with ' + str(len(X_test)) + ' samples.')
rf_detector = self._get_best_detector(X_train, X_train_label)
Y_test = rf_detector.predict(X_test)
num_anomalies = Y_test[Y_test == ANOMALY].size
logger.info('Found ' + str(num_anomalies) +
' anomalies in testing set')
logger.info('Confusion Matrix: \n{}'.
format(classification_report(
X_test_label,
Y_test,
target_names=['no', 'yes'])))
return rf_detector
random_forest_classifier.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录