小编Mar*_*nen的帖子

onnx图,如何获取输出维度?

如何获取onnx神经网络输出层的维度?

我可以得到 onnx 图,但没有输出尺寸:

~/onnx-tensorrt/third_party/onnx/onnx/tools/net_drawer.py --input ./weights/tiny_3l_v5_11_608.onnx  --output ./weights/tiny_3l_v5_11_608.dot --embed_docstring
Run Code Online (Sandbox Code Playgroud)

特尔维辛,马库斯

python-3.x onnx

6
推荐指数
2
解决办法
6013
查看次数

参数不会在 scikit-learn GridSearchCV 中自定义估计器

我正在尝试将参数传递给 scikit learn 中的自定义估计器,但失败了。lr我希望在网格搜索期间更改参数。问题是lr参数没有改变......

代码示例是从此处复制和更新的

(原始代码对我来说都不起作用)

任何GridSearchCV使用自定义估计器并更改参数的完整工作示例将不胜感激。

我在ubuntu18.10 使用scikit-learn0.20.2

from sklearn.model_selection import GridSearchCV
from sklearn.base import BaseEstimator, ClassifierMixin
import numpy as np

class MyClassifier(BaseEstimator, ClassifierMixin):

     def __init__(self, lr=0.1):
         # Some code
         print('lr:', lr)
         return self

     def fit(self, X, y):
         # Some code
         return self

     def predict(self, X):
         # Some code
         return X % 3

params = {
    'lr': [0.1, 0.5, 0.7]
}
gs = GridSearchCV(MyClassifier(), param_grid=params, cv=4)

x = …
Run Code Online (Sandbox Code Playgroud)

python parameter-passing scikit-learn gridsearchcv

3
推荐指数
1
解决办法
1290
查看次数