修改了特征分析图表的显示和热力图说明
This commit is contained in:
parent
04e43760ae
commit
1c91ba42ab
@ -67,12 +67,18 @@
|
||||
<h3>特征重要性</h3>
|
||||
<div class="chart-container">
|
||||
<div ref="importanceChartRef" style="width: 100%; height: 600px"></div>
|
||||
<div class="chart-note">
|
||||
<p>说明:F-特征分数是基于F统计量的特征重要性度量,用于评估各个特征与预测目标之间的相关程度。F分数越高,表示该特征与预测目标之间的相关性越强,但不一定是线性关系。F分数没有固定的上限,其值取决于数据的特征分布和样本量。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 相关性分析 -->
|
||||
<h3>相关性分析</h3>
|
||||
<div class="chart-container">
|
||||
<div ref="correlationChartRef" style="width: 100%; height: 800px"></div>
|
||||
<div class="chart-note">
|
||||
<p>说明:热力图展示了各特征之间的相关系数,范围从-1到1。正值(蓝色)表示正相关,负值(红色)表示负相关,0(白色)表示无相关性。相关系数的绝对值越接近1,表示相关性越强;越接近0,表示相关性越弱。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 火箭炮特有的图表 -->
|
||||
@ -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;
|
||||
}
|
||||
</style>
|
||||
@ -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
|
||||
})
|
||||
|
||||
# 按重要性排序
|
||||
|
||||
Loading…
Reference in New Issue
Block a user