1. 引言
1.1 背景
现代人久坐不动是健康的一大隐患。世界卫生组织(WHO)指出,久坐是导致多种慢性疾病的重要因素,包括心血管疾病、糖尿病、肥胖等。随着智能手机和可穿戴设备的普及,我们可以通过传感器数据监测用户的行为模式,识别静止和运动状态,并根据静止时间提供个性化的健康建议。
传统的健康监测主要依赖用户主动记录,缺乏自动化和实时性。随着机器学习技术的发展,我们可以从传感器数据中自动识别用户行为,构建智能化的健康监测系统。
1.2 应用场景
- 健康监测应用:帮助用户了解自己的行为模式,提供健康建议
- 久坐提醒系统:自动识别长时间静止状态,提醒用户起身活动
- 运动量统计:统计用户的运动时间,评估运动量是否充足
- 生活习惯分析:分析用户的生活习惯,提供改善建议
- 无监督学习教学案例:作为教学示例,学习K-Means聚类算法
- AI项目周期实践示例:完整展示AI项目从需求到部署的全流程
1.3 目标与价值
本项目通过构建一个完整的健康行为监测系统,展示了如何:
- 使用K-Means聚类算法进行无监督学习,识别用户行为模式
- 将6类行为(站立、坐下、躺卧、行走、下楼梯、上楼梯)转换为2类(静止/运动)
- 分析用户的静止时间模式,识别长时间静止状态
- 根据静止时间提供个性化的健康建议
- 创建交互式的健康监测界面
2. 项目概述
2.1 项目目标
通过传感器数据识别用户行为(静止/运动),并根据静止时间提供健康建议。
2.2 任务类型
- 任务类型:无监督学习(聚类)、健康监测应用
- 目标:将用户行为分为静止类和运动类,分析静止时间模式,提供健康建议
2.3 技术栈
- 数据处理:Pandas、NumPy
- 无监督学习:K-Means聚类
- 数据可视化:Matplotlib、Seaborn
- 模型评估:Scikit-learn(轮廓系数、同质性、完整性、V-measure、ARI、AMI等)
- 交互界面:IPython Widgets、HTML
2.4 数据集
- 数据集名称:Simplified Human Activity Recognition
- 来源:Kaggle
- 链接 :https://www.kaggle.com/mboaglio/simplifiedhuarus
- 数据量:3,609条记录
- 特征数:563个(传感器特征)
- 行为类别 :6类
- 静止类:站立(STANDING)、坐下(SITTING)、躺卧(LAYING)
- 运动类:行走(WALKING)、下楼梯(WALKING_DOWNSTAIRS)、上楼梯(WALKING_UPSTAIRS)
数据格式:
- CSV格式
- 包含传感器数据(加速度计、陀螺仪等)
- 每行代表一个时间段的传感器读数
3. AI项目周期6个阶段详解
阶段1:需求界定
3.1.1 问题定义
现代人久坐不动是健康的一大隐患。通过智能手机的传感器数据,我们可以监测用户的行为模式,识别静止和运动状态,并根据静止时间提供健康建议。
项目目标:
- 使用聚类算法将人类行为分为静止和运动两类
- 分析用户的静止时间模式
- 根据静止时间提供个性化的健康建议
应用场景:
- 健康监测应用
- 久坐提醒系统
- 运动量统计
- 生活习惯分析
3.1.2 关键技术:K-Means聚类
K-Means算法:
- 无监督学习算法
- 将数据分为k个簇
- 本项目中k=2(静止类和运动类)
模型特点:
- 简单高效
- 适合数值型数据
- 需要预先指定聚类数
阶段2:数据获取
3.2.1 环境准备
在开始项目之前,需要安装必要的库:
required_libraries = {
"numpy": None,
"pandas": None,
"matplotlib": None,
"seaborn": None,
"sklearn": None
}
from utilities.utils import check_and_install
check_and_install(required_libraries)
3.2.2 数据加载
import os
import pandas as pd
import numpy as np
# 路径配置
project_dir = os.getcwd()
data_path = os.path.join(project_dir, "sample", "data")
train_file_name = "Dataset_Action_Detect_Train.csv"
train_csv_file = os.path.join(data_path, train_file_name)
# 加载数据
Data = pd.read_csv(train_csv_file)
print('数据集大小: ' + str(Data.shape))
输出示例:
数据集大小: (3609, 563)
知识点:
- 使用
pandas.read_csv()加载CSV数据 - 数据集包含3,609条记录,563个特征
3.2.3 数据预处理
# 提取标签
Labels = Data['activity']
Data = Data.drop(['rn', 'activity'], axis=1)
Labels_keys = Labels.unique().tolist()
Labels = np.array(Labels)
print('行为标签: ' + str(Labels_keys))
输出示例:
行为标签: ['STANDING', 'SITTING', 'LAYING', 'WALKING', 'WALKING_DOWNSTAIRS', 'WALKING_UPSTAIRS']
知识点:
- 提取行为标签(activity列)
- 移除不需要的列(rn、activity)
- 将标签转换为numpy数组
阶段3:数据分析
3.3.1 数据探索
from collections import Counter
import matplotlib.pyplot as plt
# 1. 行为分布统计
label_counts = Counter(Labels)
print("\n1. 行为分布统计")
for label, count in label_counts.items():
print(f" - {label}: {count} 条 ({count/len(Labels)*100:.1f}%)")
# 2. 可视化行为分布
fig, ax = plt.subplots(figsize=(12, 5))
labels_list = list(label_counts.keys())
counts_list = list(label_counts.values())
colors = ['green' if label in ['STANDING', 'SITTING', 'LAYING'] else 'blue'
for label in labels_list]
ax.bar(labels_list, counts_list, color=colors)
ax.set_title('行为分布统计', fontsize=14, fontweight='bold')
ax.set_ylabel('样本数量')
ax.set_xlabel('行为类别')
ax.tick_params(axis='x', rotation=45)
for i, v in enumerate(counts_list):
ax.text(i, v, str(v), ha='center', va='bottom')
plt.tight_layout()
plt.show()
# 3. 静止vs运动统计
static_count = sum([count for label, count in label_counts.items()
if label in ['STANDING', 'SITTING', 'LAYING']])
moving_count = sum([count for label, count in label_counts.items()
if label in ['WALKING', 'WALKING_DOWNSTAIRS', 'WALKING_UPSTAIRS']])
print(f"\n2. 静止vs运动统计")
print(f" - 静止类: {static_count} 条 ({static_count/len(Labels)*100:.1f}%)")
print(f" - 运动类: {moving_count} 条 ({moving_count/len(Labels)*100:.1f}%)")
输出示例:
1. 行为分布统计
- STANDING: 668 条 (18.5%)
- SITTING: 623 条 (17.3%)
- LAYING: 681 条 (18.9%)
- WALKING: 603 条 (16.7%)
- WALKING_DOWNSTAIRS: 493 条 (13.7%)
- WALKING_UPSTAIRS: 541 条 (15.0%)
2. 静止vs运动统计
- 静止类: 1972 条 (54.6%)
- 运动类: 1637 条 (45.4%)
知识点:
- 使用
Counter统计行为分布 - 可视化行为分布,使用不同颜色区分静止类和运动类
- 数据分布相对均衡,静止类占54.6%,运动类占45.4%
3.3.2 数据预处理
from sklearn.preprocessing import StandardScaler
# 数据标准化
scaler = StandardScaler()
Data = scaler.fit_transform(Data)
print("数据标准化完成")
知识点:
- 标准化(Standardization):将特征缩放到均值为0、标准差为1的分布
- 标准化对K-Means聚类很重要,因为K-Means基于距离计算
- 不同尺度的特征会影响聚类结果
3.3.3 选择最优聚类数(K值)
使用肘部法则(Elbow Method)选择最优的聚类数。
from sklearn.cluster import KMeans
# 检查最优k值
ks = range(1, 10)
inertias = []
# k stands for number of clusters
for k in ks:
model = KMeans(n_clusters=k, random_state=123, n_init=30)
model.fit(Data)
inertias.append(model.inertia_)
plt.figure(figsize=(8,5))
plt.plot(ks, inertias, '-o')
plt.xlabel('簇(分组数), k')
plt.ylabel('簇内平方和(Inertia)')
plt.xticks(ks)
plt.show()
知识点:
- 肘部法则(Elbow Method):通过绘制不同k值的簇内平方和(Inertia),选择"肘部"点作为最优k值
- 当k从1增加到2时,Inertia急剧下降;当k>2时,Inertia变化缓慢
- 因此,最优k值为2(静止类和运动类)
阶段4:模型构建
3.4.1 创建K-Means聚类模型
from sklearn.cluster import KMeans
from sklearn.metrics import (homogeneity_score, completeness_score,
v_measure_score, adjusted_rand_score,
adjusted_mutual_info_score, silhouette_score)
def k_means(n_clust, data_frame, true_labels):
"""
Function k_means applies k-means clustering algorithm on dataset and prints
the crosstab of cluster and actual labels and clustering performance parameters.
Input:
n_clust - number of clusters (k value)
data_frame - dataset we want to cluster
true_labels - original labels
Output:
1 - crosstab of cluster and actual labels
2 - performance table
"""
k_means = KMeans(n_clusters=n_clust, random_state=123, n_init=30)
k_means.fit(data_frame)
c_labels = k_means.labels_
df = pd.DataFrame({'clust_label': c_labels, 'orig_label': true_labels.tolist()})
ct = pd.crosstab(df['clust_label'], df['orig_label'])
y_clust = k_means.predict(data_frame)
display(ct)
print('% 9s' % 'inertia homo compl v-meas ARI AMI silhouette')
print('%i %.3f %.3f %.3f %.3f %.3f %.3f'
%(k_means.inertia_,
homogeneity_score(true_labels, y_clust),
completeness_score(true_labels, y_clust),
v_measure_score(true_labels, y_clust),
adjusted_rand_score(true_labels, y_clust),
adjusted_mutual_info_score(true_labels, y_clust),
silhouette_score(data_frame, y_clust, metric='euclidean')))
# 训练模型(6类行为)
k_means(n_clust=2, data_frame=Data, true_labels=Labels)
输出示例:
inertia homo compl v-meas ARI AMI silhouette
1156484 0.378 0.981 0.546 0.329 0.546 0.390
知识点:
- Homogeneity(同质性):每个簇只包含单一类别的样本
- Completeness(完整性):所有同类样本都在同一簇中
- V-measure:同质性和完整性的调和平均
- ARI(调整兰德指数):衡量聚类结果与真实标签的一致性
- AMI(调整互信息):衡量聚类结果与真实标签的信息量
- Silhouette(轮廓系数):衡量簇内紧密度和簇间分离度
3.4.2 转换为二分类(静止/运动)
将6类行为转换为2类:静止类(0)和运动类(1)。
# 将标签转换为二分类:0-静止,1-运动
Labels_binary = Labels.copy()
for i in range(len(Labels_binary)):
if (Labels_binary[i] == 'STANDING' or Labels_binary[i] == 'SITTING' or Labels_binary[i] == 'LAYING'):
Labels_binary[i] = 0
else:
Labels_binary[i] = 1
Labels_binary = np.array(Labels_binary.astype(int))
# 训练模型(二分类)
k_means(n_clust=2, data_frame=Data, true_labels=Labels_binary)
输出示例:
inertia homo compl v-meas ARI AMI silhouette
1156484 0.977 0.978 0.978 0.991 0.978 0.390
知识点:
- 将6类行为转换为2类(静止/运动)后,聚类效果显著提升
- V-measure从0.546提升到0.978,接近1.0,表示聚类质量很高
- ARI从0.329提升到0.991,接近1.0,表示与真实标签高度一致
阶段5:效果评估
3.5.1 模型性能分析
from sklearn.metrics import confusion_matrix
import seaborn as sns
# 重新训练模型以获取预测结果
kmeans_model = KMeans(n_clusters=2, random_state=123, n_init=30)
kmeans_model.fit(Data)
predictions = kmeans_model.predict(Data)
print("=" * 60)
print("效果评估阶段 - 模型性能总结")
print("=" * 60)
# 混淆矩阵
cm = confusion_matrix(Labels_binary, predictions)
# 可视化混淆矩阵
plt.figure(figsize=(8, 6))
sns.heatmap(cm, annot=True, fmt='d', cmap='Blues',
xticklabels=['静止', '运动'],
yticklabels=['静止', '运动'])
plt.title('混淆矩阵 (Confusion Matrix)', fontsize=14, fontweight='bold')
plt.ylabel('真实类别', fontsize=12)
plt.xlabel('预测类别', fontsize=12)
plt.tight_layout()
plt.show()
# 计算准确率
accuracy = (cm[0][0] + cm[1][1]) / cm.sum() * 100
print(f"\n模型准确率: {accuracy:.2f}%")
print(f"\n详细指标(从之前的输出):")
print(f" - V-measure: 0.978 (接近1.0,表示聚类质量很高)")
print(f" - ARI: 0.991 (接近1.0,表示与真实标签高度一致)")
print(f" - Silhouette: 0.390 (表示簇间分离度良好)")
输出示例:
效果评估阶段 - 模型性能总结
============================================================
模型准确率: 99.78%
详细指标(从之前的输出):
- V-measure: 0.978 (接近1.0,表示聚类质量很高)
- ARI: 0.991 (接近1.0,表示与真实标签高度一致)
- Silhouette: 0.390 (表示簇间分离度良好)
知识点:
- 混淆矩阵:可视化分类错误情况
- 准确率:模型正确分类的样本占总样本的比例
- V-measure:同质性和完整性的调和平均,接近1.0表示聚类质量很高
- ARI:调整兰德指数,接近1.0表示与真实标签高度一致
阶段6:部署应用
3.6.1 行为模式分析
分析用户的静止和运动时间模式,为健康建议提供依据。
# 假设数据按时间顺序排列,每个样本代表一个时间段
# 计算连续静止时间段
def analyze_behavior_patterns(predictions, labels_binary):
"""分析行为模式,识别连续静止时间段"""
# 统计静止和运动的总时间
static_count = sum(predictions == 0)
moving_count = sum(predictions == 1)
total_samples = len(predictions)
# 假设每个样本代表1分钟
sample_duration = 1 # 分钟
static_minutes = static_count * sample_duration
moving_minutes = moving_count * sample_duration
total_minutes = total_samples * sample_duration
# 计算连续静止时间段
continuous_static_periods = []
current_static_duration = 0
for i, pred in enumerate(predictions):
if pred == 0: # 静止
current_static_duration += sample_duration
else: # 运动
if current_static_duration > 0:
continuous_static_periods.append(current_static_duration)
current_static_duration = 0
# 处理最后一个时间段
if current_static_duration > 0:
continuous_static_periods.append(current_static_duration)
return {
'static_minutes': static_minutes,
'moving_minutes': moving_minutes,
'total_minutes': total_minutes,
'static_percentage': static_minutes / total_minutes * 100,
'moving_percentage': moving_minutes / total_minutes * 100,
'continuous_static_periods': continuous_static_periods,
'max_static_duration': max(continuous_static_periods) if continuous_static_periods else 0,
'avg_static_duration': np.mean(continuous_static_periods) if continuous_static_periods else 0
}
# 分析行为模式
behavior_stats = analyze_behavior_patterns(predictions, Labels_binary)
print("=" * 60)
print("行为模式分析")
print("=" * 60)
print(f"\n总监测时间: {behavior_stats['total_minutes']:.0f} 分钟 ({behavior_stats['total_minutes']/60:.1f} 小时)")
print(f"静止时间: {behavior_stats['static_minutes']:.0f} 分钟 ({behavior_stats['static_minutes']/60:.1f} 小时)")
print(f"运动时间: {behavior_stats['moving_minutes']:.0f} 分钟 ({behavior_stats['moving_minutes']/60:.1f} 小时)")
print(f"\n静止时间占比: {behavior_stats['static_percentage']:.1f}%")
print(f"运动时间占比: {behavior_stats['moving_percentage']:.1f}%")
print(f"\n最长连续静止时间: {behavior_stats['max_static_duration']:.0f} 分钟")
print(f"平均连续静止时间: {behavior_stats['avg_static_duration']:.1f} 分钟")
输出示例:
行为模式分析
============================================================
总监测时间: 3609 分钟 (60.1 小时)
静止时间: 1976 分钟 (32.9 小时)
运动时间: 1633 分钟 (27.2 小时)
静止时间占比: 54.8%
运动时间占比: 45.2%
最长连续静止时间: 51 分钟
平均连续静止时间: 31.4 分钟
知识点:
- 分析行为模式,识别连续静止时间段
- 统计静止和运动的总时间
- 计算最长连续静止时间和平均连续静止时间
3.6.2 健康建议生成
根据静止时间模式,生成个性化的健康建议。
def generate_health_recommendations(behavior_stats):
"""根据行为模式生成健康建议"""
recommendations = []
# 1. 总体静止时间建议
if behavior_stats['static_percentage'] > 80:
recommendations.append({
'type': 'warning',
'title': '久坐警告',
'message': f"您的静止时间占比为{behavior_stats['static_percentage']:.1f}%,超过80%。建议增加运动时间。",
'suggestion': '建议每天至少运动30分钟,可以尝试散步、慢跑或做家务。'
})
elif behavior_stats['static_percentage'] > 60:
recommendations.append({
'type': 'info',
'title': '运动提醒',
'message': f"您的静止时间占比为{behavior_stats['static_percentage']:.1f}%。",
'suggestion': '建议适当增加运动时间,保持健康的生活方式。'
})
else:
recommendations.append({
'type': 'success',
'title': '运动充足',
'message': f"您的运动时间占比为{behavior_stats['moving_percentage']:.1f}%,运动量充足。",
'suggestion': '继续保持良好的运动习惯!'
})
# 2. 连续静止时间建议
if behavior_stats['max_static_duration'] > 120:
recommendations.append({
'type': 'warning',
'title': '长时间静止警告',
'message': f"您最长连续静止时间为{behavior_stats['max_static_duration']:.0f}分钟({behavior_stats['max_static_duration']/60:.1f}小时)。",
'suggestion': '建议每60分钟起身活动5-10分钟,可以设置定时提醒。'
})
elif behavior_stats['max_static_duration'] > 60:
recommendations.append({
'type': 'info',
'title': '久坐提醒',
'message': f"您最长连续静止时间为{behavior_stats['max_static_duration']:.0f}分钟。",
'suggestion': '建议每60分钟起身活动一下,可以倒杯水、伸展身体。'
})
# 3. 运动时间建议
if behavior_stats['moving_minutes'] < 30:
recommendations.append({
'type': 'warning',
'title': '运动不足',
'message': f"您今天的运动时间为{behavior_stats['moving_minutes']:.0f}分钟,低于推荐的30分钟。",
'suggestion': '建议增加日常活动,如步行上班、爬楼梯、做家务等。'
})
return recommendations
# 生成健康建议
recommendations = generate_health_recommendations(behavior_stats)
print("=" * 60)
print("个性化健康建议")
print("=" * 60)
for i, rec in enumerate(recommendations, 1):
print(f"\n【建议 {i}】{rec['title']}")
print(f" {rec['message']}")
print(f" 💡 {rec['suggestion']}")
输出示例:
个性化健康建议
============================================================
【建议 1】运动充足
您的运动时间占比为45.2%,运动量充足。
💡 继续保持良好的运动习惯!
知识点:
- 根据行为模式生成个性化的健康建议
- 建议包括总体静止时间、连续静止时间、运动时间等方面
- 根据不同的行为模式,提供不同级别的建议(警告、提醒、鼓励)
3.6.3 交互式健康监测界面
创建一个简单的交互式界面,展示健康监测结果和建议。
from IPython.display import display, HTML
def create_health_dashboard(behavior_stats, recommendations):
"""创建健康监测仪表板"""
# 创建HTML仪表板
dashboard_html = f"""
<div style='padding: 20px; background-color: #f5f5f5; border-radius: 10px;'>
<h2 style='color: #2c3e50; text-align: center;'>健康监测仪表板</h2>
<div style='display: flex; justify-content: space-around; margin: 20px 0;'>
<div style='background-color: white; padding: 15px; border-radius: 8px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1);'>
<h3 style='color: #27ae60; margin: 0;'>总监测时间</h3>
<p style='font-size: 24px; font-weight: bold; margin: 10px 0;'>{behavior_stats['total_minutes']/60:.1f} 小时</p>
</div>
<div style='background-color: white; padding: 15px; border-radius: 8px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1);'>
<h3 style='color: #e74c3c; margin: 0;'>静止时间</h3>
<p style='font-size: 24px; font-weight: bold; margin: 10px 0;'>{behavior_stats['static_minutes']/60:.1f} 小时</p>
<p style='color: #7f8c8d; margin: 0;'>({behavior_stats['static_percentage']:.1f}%)</p>
</div>
<div style='background-color: white; padding: 15px; border-radius: 8px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1);'>
<h3 style='color: #3498db; margin: 0;'>运动时间</h3>
<p style='font-size: 24px; font-weight: bold; margin: 10px 0;'>{behavior_stats['moving_minutes']/60:.1f} 小时</p>
<p style='color: #7f8c8d; margin: 0;'>({behavior_stats['moving_percentage']:.1f}%)</p>
</div>
</div>
<div style='background-color: white; padding: 20px; border-radius: 8px; margin-top: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);'>
<h3 style='color: #2c3e50; margin-top: 0;'>健康建议</h3>
"""
for rec in recommendations:
color_map = {'warning': '#e74c3c', 'info': '#f39c12', 'success': '#27ae60'}
icon_map = {'warning': '⚠️', 'info': 'ℹ️', 'success': '✅'}
color = color_map.get(rec['type'], '#3498db')
icon = icon_map.get(rec['type'], '💡')
dashboard_html += f"""
<div style='border-left: 4px solid {color}; padding-left: 15px; margin: 10px 0;'>
<h4 style='color: {color}; margin: 5px 0;'>{icon} {rec['title']}</h4>
<p style='margin: 5px 0; color: #34495e;'>{rec['message']}</p>
<p style='margin: 5px 0; color: #7f8c8d; font-style: italic;'>{rec['suggestion']}</p>
</div>
"""
dashboard_html += """
</div>
</div>
"""
return dashboard_html
# 创建并显示仪表板
dashboard = create_health_dashboard(behavior_stats, recommendations)
display(HTML(dashboard))
知识点:
- 创建交互式的健康监测界面
- 使用HTML和CSS创建美观的仪表板
- 展示监测结果和健康建议
4. 关键技术点总结
4.1 无监督学习:K-Means聚类
- K-Means算法:将数据分为K个簇,同一簇内的对象彼此相似
- 肘部法则:通过绘制不同k值的簇内平方和,选择最优k值
- 数据标准化:标准化对K-Means聚类很重要,因为K-Means基于距离计算
4.2 模型评估指标
- Homogeneity(同质性):每个簇只包含单一类别的样本
- Completeness(完整性):所有同类样本都在同一簇中
- V-measure:同质性和完整性的调和平均
- ARI(调整兰德指数):衡量聚类结果与真实标签的一致性
- AMI(调整互信息):衡量聚类结果与真实标签的信息量
- Silhouette(轮廓系数):衡量簇内紧密度和簇间分离度
4.3 行为模式分析
- 连续静止时间段识别:识别用户长时间静止的状态
- 时间统计:统计静止和运动的总时间
- 健康建议生成:根据行为模式生成个性化的健康建议
4.4 交互式界面
- HTML仪表板:创建美观的健康监测界面
- 数据可视化:展示监测结果和健康建议
5. 总结与扩展
5.1 主要发现
- K-Means聚类效果优秀:V-measure达到0.978,ARI达到0.991,准确率达到99.78%
- 数据标准化很重要:标准化后聚类效果显著提升
- 二分类效果更好:将6类行为转换为2类(静止/运动)后,聚类效果显著提升
- 行为模式分析有价值:通过分析连续静止时间段,可以识别长时间静止状态
5.2 后续改进方向
-
实时数据采集和处理:
- 集成智能手机传感器API
- 实时采集和处理传感器数据
- 实时更新健康监测结果
-
更细粒度的行为分类:
- 使用6类行为(而不是2类)进行更详细的分析
- 识别更多行为模式(如睡眠、工作、休息等)
-
个性化健康建议算法优化:
- 根据用户的历史数据优化建议算法
- 考虑用户的年龄、性别、健康状况等因素
-
移动端应用开发:
- 开发iOS和Android应用
- 集成推送通知功能
- 提供更丰富的交互体验
-
数据可视化增强:
- 创建更丰富的可视化图表
- 提供历史数据对比
- 展示趋势分析
6. 参考资料
-
数据集:
- Kaggle: Simplified Human Activity Recognition
- 链接:https://www.kaggle.com/mboaglio/simplifiedhuarus
-
技术文档:
- Scikit-learn官方文档:https://scikit-learn.org/
- Pandas官方文档:https://pandas.pydata.org/
-
相关论文:
- K-Means聚类算法研究
- 健康行为监测系统研究
-
代码仓库(在建中):
- 项目代码可在GitHub上查看
- Jupyter Notebook文件包含完整的实现代码
结语
本项目完整展示了从需求界定到模型部署的AI项目周期,通过K-Means聚类算法,我们成功将用户行为分为静止类和运动类,并构建了一个完整的健康监测应用。在实际应用中,可以根据具体需求扩展功能,如实时数据采集、更细粒度的行为分类、个性化健康建议等。
希望本文能够帮助读者理解无监督学习在健康监测领域的应用,并为实际项目提供参考。如有问题或建议,欢迎交流讨论!
作者 :Testopia
日期 :2026年2月
标签:#机器学习 #K-Means聚类 #无监督学习 #健康监测 #久坐提醒 #AI项目周期 #Python