Skip to content

Commit 66ead51

Browse files
2 parents f08a0a7 + 31a940b commit 66ead51

File tree

6 files changed

+34
-21
lines changed

6 files changed

+34
-21
lines changed

blog/2024-8-30.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ description: 机器学习与LLM舆情分析
1010

1111
该项目适合作为小型的项目原型,适合教学和练手。最初这个项目的灵感源于我的个人需求,我需要一个工具来查看主流话题,同时又不想下载一堆 APP 来接收推送。项目最终的数据使用github pages来展示。
1212

13-
可以结合我的另一个项目`pocwatchdog`实现定时执行加发送邮件。
14-
15-
1613
项目开源地址:[https://github.com/jiangyangcreate/SocialMood](https://github.com/jiangyangcreate/SocialMood)
1714

1815
项目查看地址:[https://jiangyangcreate.github.io/SocialMood/](https://jiangyangcreate.github.io/SocialMood/)

docs/docs/云原生开发/接口开发.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,29 @@ if __name__ == "__main__":
614614

615615
```
616616

617+
下面是异步函数作为FastAPI的返回值的示例
618+
619+
```python showLineNumbers
620+
from fastapi import FastAPI
621+
from fastapi.responses import StreamingResponse
622+
import asyncio
623+
import random
624+
625+
app = FastAPI()
626+
627+
async def async_range(n):
628+
for i in range(n):
629+
yield f"<p>{i}</p>"
630+
await asyncio.sleep(random.randint(1, 3) * 1)
631+
632+
@app.get("/stream")
633+
async def stream_numbers():
634+
return StreamingResponse(async_range(5), media_type="html", background=None)
635+
636+
if __name__ == "__main__":
637+
import uvicorn
638+
uvicorn.run(app, host="0.0.0.0", port=8000)
639+
```
617640

618641
### Django
619642

docs/docs/机器学习/传统算法/朴素贝叶斯.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ P(恭喜|正常邮件) = 6/20 = 0.3
4040
P(辛苦|正常邮件) = 2/20 = 0.1
4141
```
4242

43-
现在我收到了一封邮件,这封邮件内容为:“恭喜您获得了一次免费的机会”,我想知道这封邮件是垃圾邮件的概率是多少?
43+
现在我收到了一封邮件,这封邮件内容为:“**恭喜**您获得了一次**免费**的机会”,我想知道这封邮件是垃圾邮件的概率是多少?
4444

4545
```markdown
46-
P(垃圾邮件|免费,恭喜) = P(免费|垃圾邮件)_P(恭喜|垃圾邮件)_ P(垃圾邮件)= 0.25 _0.625_ 0.8 = 0.125
46+
P(垃圾邮件|免费,恭喜) = P(免费|垃圾邮件)* P(恭喜|垃圾邮件)* P(垃圾邮件)= 0.25 * 0.625 * 0.8 = 0.125
4747

48-
P(正常邮件|免费,恭喜) = P(免费|正常邮件)_P(恭喜|正常邮件)_ P(正常邮件)= 0.25 _0.3_ 0.2 = 0.015
48+
P(正常邮件|免费,恭喜) = P(免费|正常邮件)* P(恭喜|正常邮件)* P(正常邮件)= 0.25 * 0.3 * 0.2 = 0.015
4949
```
5050

5151
因为 P(垃圾邮件|免费,恭喜) > P(正常邮件|免费,恭喜),所以这封邮件被判定为垃圾邮件。
5252

53-
如果狡猾的垃圾邮件制造者把邮件内容改为:“恭喜您获得了一次免费的机会,辛苦您动动手指参加我们的免费活动”,那么这封邮件被判定为垃圾邮件的概率就会变成 0,因为“辛苦”这个词在正常邮件中有出现,在垃圾邮件中没有出现。
53+
如果狡猾的垃圾邮件制造者把邮件内容改为:“**恭喜**您获得了一次**免费**的机会,**辛苦**您动动手指参加我们的**免费**活动”,那么这封邮件被判定为垃圾邮件的概率就会变成 0,因为“辛苦”这个词在正常邮件中有出现,在垃圾邮件中没有出现。
5454

5555
改进:拉普拉斯平滑法
5656

5757
在每个关键词上人为的增加一个出现的次数,这样就不会出现概率为 0 的情况了。(下面的公式免费的平方表示这个关键词出现 2 次)
5858

5959
```markdown
60-
P(垃圾邮件|免费,恭喜) = P(免费|垃圾邮件)_P(恭喜|垃圾邮件)_ P(垃圾邮件)= (21/80)² _(51/80)_ 0.8 = 0.0351421875
60+
P(垃圾邮件|免费,恭喜,辛苦) = P(免费|垃圾邮件)* P(恭喜|垃圾邮件)* P(辛苦|垃圾邮件)* P(垃圾邮件)= (20+1/80)² * (50+1/80) * (0+1/80) * 0.8 = 0.0351421875
6161

62-
P(正常邮件|免费,恭喜) = P(免费|正常邮件)_P(恭喜|正常邮件)_ P(正常邮件)= (6/20)²*(7/20)* 0.2 =0.0063
62+
P(正常邮件|免费,恭喜,辛苦) = P(免费|正常邮件)* P(恭喜|正常邮件)* P(辛苦|正常邮件)* P(正常邮件)= (5+1/20)² * (6+1/20) * (2+1/20) * 0.2 =0.012885
6363
```
6464

6565
```python showLineNumbers

docs/docs/选择编程语言/Python/Python进阶.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,12 +2513,12 @@ requires = ["setuptools>=61.0", "wheel"]
25132513
build-backend = "setuptools.build_meta"
25142514
25152515
[project]
2516-
name = "pocwatchdog"
2517-
version = "1.1.6"
2516+
name = "exboard"
2517+
version = "1.0.12"
25182518
authors = [
25192519
{ name="Allen", email="[email protected]" },
25202520
]
2521-
description = "A pocwatchdog package for security monitoring"
2521+
description = "A exboard package for AIBOX"
25222522
readme = "README.md"
25232523
requires-python = ">=3.6"
25242524
classifiers = [
@@ -2531,8 +2531,8 @@ dependencies = [
25312531
]
25322532
25332533
[project.urls]
2534-
Homepage = "https://github.com/jiangyangcreate/pocwatchdog"
2535-
Issues = "https://github.com/jiangyangcreate/pocwatchdog/issues"
2534+
Homepage = "https://github.com/jiangyangcreate/exboard"
2535+
Issues = "https://github.com/jiangyangcreate/exboard/issues"
25362536
```
25372537

25382538
其中:dependencies 是依赖的包,在这里添加你需要的依赖包之后,安装此包时会自动安装这些依赖包。

src/pages/case.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ function ShowcaseGrid() {
2727
url: "https://jiangmiemie.com/jiangyangcreate/",
2828
category: "关于我",
2929
},
30-
{
31-
image: useBaseUrl("pages/case/pocwatchdog.webp"),
32-
title: "pocwatchdog",
33-
desc: "进程管理器,用于定时管理进程,多种组合式定时任务。支持成功发送邮件通知、失败发送邮件通知,可插入附件、图片,自动识别邮箱服务器与端口号。",
34-
url: "https://github.com/jiangyangcreate/pocwatchdog/",
35-
category: "模块库",
36-
},
3730
{
3831
image: useBaseUrl("pages/case/exboard.webp"),
3932
title: "exboard",

static/pages/case/pocwatchdog.webp

-44.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)