diff --git a/frontend/src/views/AnalysisPage.vue b/frontend/src/views/AnalysisPage.vue index 504051c..c501f8b 100644 --- a/frontend/src/views/AnalysisPage.vue +++ b/frontend/src/views/AnalysisPage.vue @@ -67,12 +67,18 @@

特征重要性

+
+

说明:F-特征分数是基于F统计量的特征重要性度量,用于评估各个特征与预测目标之间的相关程度。F分数越高,表示该特征与预测目标之间的相关性越强,但不一定是线性关系。F分数没有固定的上限,其值取决于数据的特征分布和样本量。

+

相关性分析

+
+

说明:热力图展示了各特征之间的相关系数,范围从-1到1。正值(蓝色)表示正相关,负值(红色)表示负相关,0(白色)表示无相关性。相关系数的绝对值越接近1,表示相关性越强;越接近0,表示相关性越弱。

+
@@ -404,19 +410,27 @@ const renderCharts = () => { // 设置基本图表的选项 const importanceOption = { - title: { text: '特征重要性排序' }, + title: { + text: '特征重要性排序', + left: 'center' + }, tooltip: { trigger: 'item', axisPointer: { type: 'shadow' }, formatter: function(params) { - return `${params.name}: ${params.value.toFixed(1)}` + return `${params.name}: ${params.value.toFixed(2)}` } }, xAxis: { type: 'value', - name: '重要性得分' + name: 'F-特征分数', + axisLabel: { + formatter: function(value) { + return value.toFixed(1) + } + } }, yAxis: { type: 'category', @@ -1106,4 +1120,12 @@ function debounce(fn, delay) { } } } + +.chart-note { + margin-top: 10px; + padding: 10px; + color: #666; + font-size: 14px; + line-height: 1.5; +} \ No newline at end of file diff --git a/src/feature_analysis.py b/src/feature_analysis.py index 4a45ea7..3e61aa3 100644 --- a/src/feature_analysis.py +++ b/src/feature_analysis.py @@ -212,11 +212,20 @@ class FeatureAnalysis: # 创建特征重要性列表(使用中文名称) important_features = [] + + # 过滤掉无效的分数 + valid_scores = importance_scores[~np.isnan(importance_scores)] + + # 记录一些统计信息 + logger.info(f"F-score statistics:") + logger.info(f"min={np.min(valid_scores):.2f}, max={np.max(valid_scores):.2f}, " + f"mean={np.mean(valid_scores):.2f}, median={np.median(valid_scores):.2f}") + for idx, (name, score) in enumerate(zip(feature_names, importance_scores)): if not np.isnan(score): important_features.append({ - 'name': self.feature_name_map.get(name, name), # 使用中文名称 - 'importance': float(score) + 'name': self.feature_name_map.get(name, name), + 'importance': float(score) # 保持原始F-score }) # 按重要性排序