import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
import matplotlib.font_manager as fm
# 设置中文字体(使用字体文件路径方式)
font_path = "C:/Windows/Fonts/simhei.ttf" # 根据你系统实际情况修改路径
font = fm.FontProperties(fname=font_path, size=12)
# 设置全局字体和中文显示
plt.rcParams['font.sans-serif'] = [font.get_name()]
plt.rcParams['axes.unicode_minus'] = False # 正常显示负号
sns.set(font_scale=1.2)
sns.set_style("whitegrid")
class FireEventFeatureExtractor:
def __init__(self, excel_path, output_dir):
"""初始化特征提取器,指定输出目录"""
self.excel_path = excel_path
self.output_dir = output_dir
self.raw_data = None
self.candidate_events = None
self.features = None
if not os.path.exists(self.output_dir):
os.makedirs(self.output_dir)
print(f"已创建输出目录: {self.output_dir}")
else:
print(f"输出目录已存在: {self.output_dir}")
def load_data(self, sheet_name="原始数据"):
print(f"正在加载{sheet_name}数据...")
self.raw_data = pd.read_excel(self.excel_path, sheet_name=sheet_name)
print("正在进行数据清洗...")
valid_mask = (
(self.raw_data['机号 (Machinery number)'] != -1) &
(self.raw_data['地址 (Address)'].notna()) &
(self.raw_data['火警次数 (Number of fire alarms)'] > 0)
)
self.raw_data = self.raw_data[valid_mask].copy()
print(f"清洗后数据量: {len(self.raw_data)} 条记录")
return self
def identify_faulty_devices(self):
print("正在标记故障设备...")
device_stats = self.raw_data.groupby('用户编码 (User coded)').agg({
'是否属于误报 (Whether a misstatement)': lambda x: (x == '是 (True)').all(),
'火警次数 (Number of fire alarms)': 'sum'
}).reset_index()
device_stats['is_faulty'] = (
(device_stats['是否属于误报 (Whether a misstatement)'] == True) &
(device_stats['火警次数 (Number of fire alarms)'] >= 5)
)
self.raw_data = self.raw_data.merge(
device_stats[['用户编码 (User coded)', 'is_faulty']],
on='用户编码 (User coded)',
how='left'
)
self.raw_data['is_faulty'] = self.raw_data['is_faulty'].fillna(False)
return self
def build_candidate_events(self, min_devices=2):
print(f"正在构建候选事件(至少{min_devices}个设备)...")
group_keys = [
'项目名称 (Object name)',
'回路 (Loop)',
'机号 (Machinery number)'
]
self.candidate_events = self.raw_data.groupby(group_keys).agg({
'用户编码 (User coded)': 'nunique',
'火警次数 (Number of fire alarms)': 'sum',
'is_faulty': lambda x: (self.raw_data.loc[x.index, 'is_faulty'] *
self.raw_data.loc[x.index, '火警次数 (Number of fire alarms)']).sum()
}).reset_index()
self.candidate_events.columns = group_keys + ['参与设备数(ndev)', '总报警次数(total)', '故障报警次数']
self.candidate_events = self.candidate_events[
self.candidate_events['参与设备数(ndev)'] >= min_devices
].reset_index(drop=True)
self.candidate_events['故障占比(faulty_ratio)'] = (
self.candidate_events['故障报警次数'] /
self.candidate_events['总报警次数(total)']
).clip(0, 1)
self.candidate_events.insert(0, '候选事件ID', range(1, len(self.candidate_events) + 1))
print(f"成功构建{len(self.candidate_events)}个候选事件")
self.features = self.candidate_events.copy()
return self
def save_features(self):
output_path = os.path.join(self.output_dir, "候选事件特征向量.xlsx")
self.features.to_excel(output_path, index=False)
print(f"特征向量已保存至: {output_path}")
return self
def visualize(self):
print("正在生成可视化图表...")
# 1. 参与设备数分布
plt.figure(figsize=(12, 5))
plt.subplot(1, 2, 1)
sns.histplot(data=self.features, x='参与设备数(ndev)', bins=10, kde=True)
plt.title('参与设备数分布')
plt.xlabel('参与设备数')
plt.ylabel('事件数量')
plt.subplot(1, 2, 2)
sns.boxplot(data=self.features, y='参与设备数(ndev)')
plt.title('参与设备数箱线图')
plt.ylabel('参与设备数')
plt.tight_layout()
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
plt.close()
# 2. 总报警次数分布
plt.figure(figsize=(10, 6))
log_total = np.log1p(self.features['总报警次数(total)'])
sns.histplot(log_total, bins=15, kde=True)
plt.title('总报警次数分布(对数变换)')
plt.xlabel('log(总报警次数 + 1)')
plt.ylabel('事件数量')
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
plt.close()
# 3. 故障占比分布
plt.figure(figsize=(10, 6))
sns.histplot(data=self.features, x='故障占比(faulty_ratio)', bins=10, kde=True)
plt.title('故障占比分布')
plt.xlabel('故障占比')
plt.ylabel('事件数量')
plt.xticks(np.arange(0, 1.1, 0.1))
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
plt.close()
# 4. 特征相关性分析
plt.figure(figsize=(12, 10))
features_for_corr = self.features[['参与设备数(ndev)', '总报警次数(total)', '故障占比(faulty_ratio)']]
features_for_corr.loc[:, '总报警次数(log)'] = np.log1p(features_for_corr['总报警次数(total)'])
g = sns.pairplot(features_for_corr[['参与设备数(ndev)', '总报警次数(log)', '故障占比(faulty_ratio)']])
g.fig.suptitle('特征相关性散点图矩阵', y=1.02)
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
plt.close()
print("可视化图表已保存至结果目录")
return self
def run_pipeline(self):
print("====== 开始火灾事件特征提取流程 ======")
self.load_data() \
.identify_faulty_devices() \
.build_candidate_events() \
.save_features() \
.visualize()
print("====== 特征提取流程完成 ======")
return self
if __name__ == "__main__":
excel_file_path = "预处理结果/火灾报警数据预处理结果_20250821_005317.xlsx"
output_directory = r"C:\Users\cheny\Desktop\PythonProject2"
extractor = FireEventFeatureExtractor(excel_file_path, output_directory)
extractor.run_pipeline()
print("\n前5条候选事件特征向量:")
print(extractor.features[['候选事件ID', '项目名称 (Object name)',
'参与设备数(ndev)', '总报警次数(total)', '故障占比(faulty_ratio)']].head())
原代码如上
报错内容如下
E:\Anaconda\python.exe C:\Users\cheny\Desktop\PythonProject2\步骤二.py
输出目录已存在: C:\Users\cheny\Desktop\PythonProject2
====== 开始火灾事件特征提取流程 ======
正在加载原始数据数据...
正在进行数据清洗...
清洗后数据量: 27713 条记录
正在标记故障设备...
正在构建候选事件(至少2个设备)...
成功构建3840个候选事件
特征向量已保存至: C:\Users\cheny\Desktop\PythonProject2\候选事件特征向量.xlsx
正在生成可视化图表...
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 21442 (\N{CJK UNIFIED IDEOGRAPH-53C2}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 19982 (\N{CJK UNIFIED IDEOGRAPH-4E0E}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 35774 (\N{CJK UNIFIED IDEOGRAPH-8BBE}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 22791 (\N{CJK UNIFIED IDEOGRAPH-5907}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 20107 (\N{CJK UNIFIED IDEOGRAPH-4E8B}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 20214 (\N{CJK UNIFIED IDEOGRAPH-4EF6}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 20998 (\N{CJK UNIFIED IDEOGRAPH-5206}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 24067 (\N{CJK UNIFIED IDEOGRAPH-5E03}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 31665 (\N{CJK UNIFIED IDEOGRAPH-7BB1}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 32447 (\N{CJK UNIFIED IDEOGRAPH-7EBF}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:123: UserWarning: Glyph 22270 (\N{CJK UNIFIED IDEOGRAPH-56FE}) missing from font(s) Arial.
plt.tight_layout()
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 21442 (\N{CJK UNIFIED IDEOGRAPH-53C2}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 19982 (\N{CJK UNIFIED IDEOGRAPH-4E0E}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 35774 (\N{CJK UNIFIED IDEOGRAPH-8BBE}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 22791 (\N{CJK UNIFIED IDEOGRAPH-5907}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 20107 (\N{CJK UNIFIED IDEOGRAPH-4E8B}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 20214 (\N{CJK UNIFIED IDEOGRAPH-4EF6}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 20998 (\N{CJK UNIFIED IDEOGRAPH-5206}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 24067 (\N{CJK UNIFIED IDEOGRAPH-5E03}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 31665 (\N{CJK UNIFIED IDEOGRAPH-7BB1}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 32447 (\N{CJK UNIFIED IDEOGRAPH-7EBF}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:124: UserWarning: Glyph 22270 (\N{CJK UNIFIED IDEOGRAPH-56FE}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "参与设备数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 24635 (\N{CJK UNIFIED IDEOGRAPH-603B}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 25253 (\N{CJK UNIFIED IDEOGRAPH-62A5}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 35686 (\N{CJK UNIFIED IDEOGRAPH-8B66}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 27425 (\N{CJK UNIFIED IDEOGRAPH-6B21}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 20107 (\N{CJK UNIFIED IDEOGRAPH-4E8B}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 20214 (\N{CJK UNIFIED IDEOGRAPH-4EF6}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 20998 (\N{CJK UNIFIED IDEOGRAPH-5206}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 24067 (\N{CJK UNIFIED IDEOGRAPH-5E03}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 65288 (\N{FULLWIDTH LEFT PARENTHESIS}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 23545 (\N{CJK UNIFIED IDEOGRAPH-5BF9}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 25442 (\N{CJK UNIFIED IDEOGRAPH-6362}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:134: UserWarning: Glyph 65289 (\N{FULLWIDTH RIGHT PARENTHESIS}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "总报警次数分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 25925 (\N{CJK UNIFIED IDEOGRAPH-6545}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 38556 (\N{CJK UNIFIED IDEOGRAPH-969C}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 21344 (\N{CJK UNIFIED IDEOGRAPH-5360}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 27604 (\N{CJK UNIFIED IDEOGRAPH-6BD4}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 20107 (\N{CJK UNIFIED IDEOGRAPH-4E8B}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 20214 (\N{CJK UNIFIED IDEOGRAPH-4EF6}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 20998 (\N{CJK UNIFIED IDEOGRAPH-5206}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:144: UserWarning: Glyph 24067 (\N{CJK UNIFIED IDEOGRAPH-5E03}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "故障占比分布.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:150: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
features_for_corr.loc[:, '总报警次数(log)'] = np.log1p(features_for_corr['总报警次数(total)'])
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 21442 (\N{CJK UNIFIED IDEOGRAPH-53C2}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 19982 (\N{CJK UNIFIED IDEOGRAPH-4E0E}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 35774 (\N{CJK UNIFIED IDEOGRAPH-8BBE}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 22791 (\N{CJK UNIFIED IDEOGRAPH-5907}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 24635 (\N{CJK UNIFIED IDEOGRAPH-603B}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 25253 (\N{CJK UNIFIED IDEOGRAPH-62A5}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 35686 (\N{CJK UNIFIED IDEOGRAPH-8B66}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 27425 (\N{CJK UNIFIED IDEOGRAPH-6B21}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 25925 (\N{CJK UNIFIED IDEOGRAPH-6545}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 38556 (\N{CJK UNIFIED IDEOGRAPH-969C}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 21344 (\N{CJK UNIFIED IDEOGRAPH-5360}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
E:\Anaconda\Lib\site-packages\seaborn\axisgrid.py:123: UserWarning: Glyph 27604 (\N{CJK UNIFIED IDEOGRAPH-6BD4}) missing from font(s) Arial.
self._figure.tight_layout(*args, **kwargs)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 21442 (\N{CJK UNIFIED IDEOGRAPH-53C2}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 19982 (\N{CJK UNIFIED IDEOGRAPH-4E0E}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 35774 (\N{CJK UNIFIED IDEOGRAPH-8BBE}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 22791 (\N{CJK UNIFIED IDEOGRAPH-5907}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 25968 (\N{CJK UNIFIED IDEOGRAPH-6570}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 24635 (\N{CJK UNIFIED IDEOGRAPH-603B}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 25253 (\N{CJK UNIFIED IDEOGRAPH-62A5}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 35686 (\N{CJK UNIFIED IDEOGRAPH-8B66}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 27425 (\N{CJK UNIFIED IDEOGRAPH-6B21}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 25925 (\N{CJK UNIFIED IDEOGRAPH-6545}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 38556 (\N{CJK UNIFIED IDEOGRAPH-969C}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 21344 (\N{CJK UNIFIED IDEOGRAPH-5360}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 27604 (\N{CJK UNIFIED IDEOGRAPH-6BD4}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 29305 (\N{CJK UNIFIED IDEOGRAPH-7279}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 24449 (\N{CJK UNIFIED IDEOGRAPH-5F81}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 30456 (\N{CJK UNIFIED IDEOGRAPH-76F8}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 20851 (\N{CJK UNIFIED IDEOGRAPH-5173}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 24615 (\N{CJK UNIFIED IDEOGRAPH-6027}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 25955 (\N{CJK UNIFIED IDEOGRAPH-6563}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 22270 (\N{CJK UNIFIED IDEOGRAPH-56FE}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 30697 (\N{CJK UNIFIED IDEOGRAPH-77E9}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
C:\Users\cheny\Desktop\PythonProject2\步骤二.py:154: UserWarning: Glyph 38453 (\N{CJK UNIFIED IDEOGRAPH-9635}) missing from font(s) Arial.
plt.savefig(os.path.join(self.output_dir, "特征相关性分析.png"), dpi=300)
可视化图表已保存至结果目录
====== 特征提取流程完成 ======
前5条候选事件特征向量:
候选事件ID 项目名称 (Object name) 参与设备数(ndev) 总报警次数(total) 故障占比(faulty_ratio)
0 1 AQSJAHYXQGC 3 15 0.666667
1 2 AQSJAHYXQGC 4 4 1.000000
2 3 AQSJAHYXQGC 3 3 0.666667
3 4 AQSJAHYXQGC 2 2 0.500000
4 5 HXYXQ1-10HLJDXCK 2 177 1.000000
进程已结束,退出代码为 0