Library Search
结果页4 行代码训练宠物品种分类器
在 技术栈 中找到 8 个匹配结果。
技术栈
技术栈
8 个 FastAI # FastAI 宠物品种分类:4 行代码 SOTA
## 目标
用 FastAI 的高级 API,仅 4 行核心代码训练一个 37 种宠物品种分类模型(Oxford-IIIT Pet Dataset)。
## 完整代码
```python
from fastai.vision.all import *
# ─── 第 1 行:下载数据 ───
path = untar_data(URL… 2% Scikit-learn (
X, y, test_size=0.3, random_state=42
)
# 3. 创建并训练模型
clf = RandomForestClassifier(n_estimators=100, random_state=42)
clf.fit(X_train, y_train)
# 4. 预测并评估
y_pred = clf.predict(X_test)
accuracy =… 2% Solid.js 样式
const mainStyle = {
"max-width": "540px",
margin: "40px auto",
padding: "0 16px",
"font-family": "-apple-system, 'Microsoft YaHei', sans-serif",
};
const inputStyle = {
width: "100%",
p… 2% MyBatis-Plus // 查询单个
User user = userMapper.selectOne(
new LambdaQueryWrapper<User>().eq(User::getEmail, "test@test.com")
);
// 只查指定字段
wrapper.select(User::getId, User::getName);
// 排除字段
wrapper.select(User.… 2% XGBoost (
X, y, test_size=0.2, random_state=42, stratify=y
)
# ─── 2. 训练模型 ───
model = xgb.XGBClassifier(
n_estimators=100,
max_depth=4,
learning_rate=0.1,
subsample=0.8,
colsample_by… 2% Envoy ```bash
$ for i in {1..20}; do curl -s http://localhost:10000/api; done | sort | uniq -c
18 {"version":"v1","message":"This is stable version"}
2 {"version":"v2","message":"This is canary v… 2% HuggingFace Transformers # ─── 5. 文本摘要 ───
summarizer = pipeline("summarization")
text = """The Apollo program, also known as Project Apollo, was the third United States
human spaceflight program carried out by NASA, which s… 1% Elasticsearch ```python
# 按分类统计数量
agg_result = es.search(index='products', body={
'size': 0,
'aggs': {
'category_stats': {'terms': {'field': 'category'}},
'avg_price': {'avg': {'field': 'pri… 1%