You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地Mac的Jupyter与Kaggle运行fastai表格代码结果差异排查

本地运行fastai成人样本代码训练准确率为0的问题

我在运行fastbook第一章的示例代码,但在Mac本地的Jupyter或VSCode内核中运行以下代码时,训练准确率始终为0.00000,和Kaggle上运行完全相同代码的结果存在明显差异。

代码如下:

from fastai.tabular.all import *
path = untar_data(URLs.ADULT_SAMPLE)

dls = TabularDataLoaders.from_csv(path/'adult.csv', path=path, y_names="salary",
    cat_names = ['workclass', 'education', 'marital-status', 'occupation',
                 'relationship', 'race'],
    cont_names = ['age', 'fnlwgt', 'education-num'],
    procs = [Categorify, FillMissing, Normalize])

learn = tabular_learner(dls, metrics=accuracy)
learn.fit_one_cycle(3)

本地Jupyter输出:
本地Jupyter输出

Kaggle输出:
Kaggle输出

如您所见,本地训练的所有轮次准确率均为0.00。我忽略了什么?

内容的提问来源于stack exchange,提问作者epicwhale

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 10:32:03