可以尝试增加网络的深度和宽度,例如增加隐藏层的数量和每个隐藏层的神经元数量,可以使用ReLU作为激活函数。

具体代码修改如下:

def get_net():
    net = nn.Sequential(
        nn.Linear(in_features, 256),
        nn.ReLU(),
        nn.Linear(256, 64),
        nn.ReLU(),
        nn.Linear(64, 1)
    )
    return net

这里增加了两个隐藏层,分别有256个和64个神经元,并使用ReLU作为激活函数。

import hashlibimport osimport tarfileimport zipfileimport requests#saveDATA_HUB = dictDATA_URL = httpd2l-datas3-accelerateamazonawscomdef downloadname cache_dir=ospathjoin data #save 下载一个DATA_HUB中

原文地址: https://www.cveoy.top/t/topic/ezTE 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录