小编Bru*_*ito的帖子

Skorch GridSearchCV:FitFailedWarning:估计器拟合失败。这些参数在此训练测试分区上的分数将设置为 nan

我有特征和标签x的维度数据。(n_samples, time_steps, n_features)(n_samples, 1, n_labels)y

由此我创建了一个训练、开发和测试 pytorch 数据集。

我想使用 GridSearchCV 对超参数进行网格搜索。那是我写的:

'Define the network'
sampling_interval = 0.1
net = ConvNet(time_window, ny)
net.float()

'Split test training set'
# trainin test. In this case we take some experiements as test and some as trainint
train_set_split = 0.9
dev_set_split = 0.05
test_set_split = 0.05

# Creating data indices for training and validation splits:
dataset_size = x.shape[0]
indices = list(range(dataset_size))
np.random.shuffle(indices)
split1 = int(np.floor(train_set_split * dataset_size))
split2 = int(np.floor(dev_set_split …
Run Code Online (Sandbox Code Playgroud)

python conv-neural-network pytorch skorch

6
推荐指数
0
解决办法
1万
查看次数

Ubuntu 16.04 LTS 中的 Python 给出错误 /lib/x86_64-linux-gnu/libc.so.6 版本“GLIBC_2.25”未找到

当我尝试在 Ubuntu 上运行 Python 3.6 时遇到此问题:

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found 
Run Code Online (Sandbox Code Playgroud)

造成这种情况的原因是什么?

python ubuntu glibc

5
推荐指数
1
解决办法
1万
查看次数

ImportError:无法从“traitlets”导入名称“Callable”

我可以运行 jupyter 笔记本,但是当我尝试打开 jupyter 文件时,我的浏览器上出现以下错误

500内部服务器错误

在控制台中,我收到此错误消息

    To access the notebook, open this file in a browser:
        file:///C:/Users/Bruno/AppData/Roaming/jupyter/runtime/nbserver-23164-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=1e5a289e6fd9b36cab176131f1e3d0b673921c1a76258552
     or http://127.0.0.1:8888/?token=1e5a289e6fd9b36cab176131f1e3d0b673921c1a76258552
[W 16:19:04.850 NotebookApp] 404 GET /ipyparallel/clusters?_=1649168344196 (::1) 16.95ms referer=http://localhost:8888/tree
[E 16:19:24.938 NotebookApp] Uncaught exception GET /notebooks/examples/jupyter_notebooks/greenhouse.ipynb (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/examples/jupyter_notebooks/greenhouse.ipynb', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "c:\users\...\tornado\web.py", line 1697, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "c:\users\..\tornado\web.py", line 3174, in wrapper
        return method(self, *args, **kwargs)
      File "c:\users\..\notebook\notebook\handlers.py", line …
Run Code Online (Sandbox Code Playgroud)

python jupyter-notebook

5
推荐指数
1
解决办法
4972
查看次数

Pytorch:为什么 print(model) 不显示激活函数?

我需要从 pytorch 中经过训练的神经网络中提取权重、偏差和至少激活函数的类型。

我知道要提取权重和偏差,命令是:

model.parameters()

但我不知道如何提取层上使用的激活函数。这是我的网络

class NetWithODE(torch.nn.Module):
    def __init__(self, n_feature, n_hidden, n_output, sampling_interval, scaler_features):
        super(NetWithODE, self).__init__()
        self.hidden = torch.nn.Linear(n_feature, n_hidden)  # hidden layer
        self.predict = torch.nn.Linear(n_hidden, n_output)  # output layer
        self.sampling_interval = sampling_interval
        self.device = torch.device("cpu")
        self.dtype = torch.float
        self.scaler_features = scaler_features

    def forward(self, x):
        x0 = x.clone().requires_grad_(True)
        # activation function for hidden layer
        x = F.relu(self.hidden(x))
        # linear output, here r should be the output
        r = self.predict(x)
        # Now the r enters the integrator
        x = self.integrate(r, …
Run Code Online (Sandbox Code Playgroud)

python pytorch

4
推荐指数
1
解决办法
4472
查看次数

从请求导入PandaRequest ImportError:没有名为“ request”的模块

我正在尝试使用熊猫。当我导入为

import panda as pd
Run Code Online (Sandbox Code Playgroud)

我得到这个错误

  File "/usr/local/lib/python3.5/dist-packages/panda/__init__.py", line 1, in <module>
from request import PandaRequest ImportError: No module named 'request'
Run Code Online (Sandbox Code Playgroud)

'request'似乎已经安装:

  Requirement already satisfied: request in /usr/local/lib/python3.5/dist-packages
Run Code Online (Sandbox Code Playgroud)

我正在使用Python 3.5。我看了看,问题似乎只存在于2.7。您是否知道为什么它不起作用?

谢谢

布鲁诺

python import packages request python-3.x

2
推荐指数
3
解决办法
3890
查看次数