Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水煮美味鱼
Python_673385
提交
7daac06c
P
Python_673385
项目概览
水煮美味鱼
/
Python_673385
与 Fork 源项目一致
Fork自
inscode / Python
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Python_673385
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7daac06c
编写于
3月 14, 2025
作者:
U
u010395817
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fri Mar 14 18:09:00 CST 2025 inscode
上级
0a575cc3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
0 deletion
+40
-0
Flask-Login
Flask-Login
+11
-0
Scikit-learn
Scikit-learn
+10
-0
elk
elk
+6
-0
sls
sls
+13
-0
未找到文件。
Flask-Login
0 → 100644
浏览文件 @
7daac06c
from flask_login import UserMixin, LoginManager
from werkzeug.security import generate_password_hash, check_password_hash
class User(UserMixin):
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
Scikit-learn
0 → 100644
浏览文件 @
7daac06c
from
sklearn
.
ensemble
import
IsolationForest
import
pandas
as
pd
def
anomaly_detection
(
data
):
model
=
IsolationForest
(
contamination
=
0.01
)
data
=
pd
.
DataFrame
(
data
)
#
假设数据为字典列表格式
model
.
fit
(
data
)
predictions
=
model
.
predict
(
data
)
anomalies
=
data
[
predictions
==
-
1
]
return
anomalies
elk
0 → 100644
浏览文件 @
7daac06c
from elasticsearch import Elasticsearch
def fetch_elk_logs(index_name, query_body):
es = Elasticsearch(['http://localhost:9200'])
response = es.search(index=index_name, body=query_body)
return response['hits']['hits']
sls
0 → 100644
浏览文件 @
7daac06c
from aliyunsdkcore.client import AcsClient
from aliyunsdklog.request.v20200619 import GetLogsRequest
def fetch_sls_logs(project_name, logstore_name, from_time, to_time):
client = AcsClient('<your-access-key-id>', '<your-access-key-secret>', 'cn-hangzhou')
request = GetLogsRequest.GetLogsRequest()
request.set_ProjectName(project_name)
request.set_LogstoreName(logstore_name)
request.set_FromTime(from_time)
request.set_ToTime(to_time)
response = client.do_action_with_exception(request)
return response
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录