搭建完整的前后端分离架构,实现数据概览、预测分析、聚类分析等核心功能模块 详细版: feat: 初始化员工缺勤分析系统项目 - 后端:基于 Flask 搭建 RESTful API,包含数据概览、特征分析、预测模型、聚类分析四大模块 - 前端:基于 Vue.js 构建单页应用,实现 Dashboard、预测、聚类、因子分析等页面 - 模型:集成随机森林、XGBoost、LightGBM、Stacking 等多种机器学习模型 - 文档:完成需求规格说明、系统架构设计、接口设计、数据设计、UI原型设计等文档
19 lines
573 B
Python
19 lines
573 B
Python
from core.clustering import KMeansAnalyzer
|
|
|
|
|
|
class ClusterService:
|
|
def __init__(self):
|
|
self.analyzer = KMeansAnalyzer()
|
|
|
|
def get_cluster_result(self, n_clusters=3):
|
|
return self.analyzer.get_cluster_results(n_clusters)
|
|
|
|
def get_cluster_profile(self, n_clusters=3):
|
|
return self.analyzer.get_cluster_profile(n_clusters)
|
|
|
|
def get_scatter_data(self, n_clusters=3, x_axis='Age', y_axis='Absenteeism time in hours'):
|
|
return self.analyzer.get_scatter_data(n_clusters, x_axis, y_axis)
|
|
|
|
|
|
cluster_service = ClusterService()
|