Получение ошибки при применении молотить к табличной модели на fastai - PullRequest
0 голосов
/ 27 сентября 2019

Я пытаюсь изменить пороговое значение по умолчанию, равное 0,5, в табличной модели fastai, но не могу заставить его работать.

Я использую это, используя последнюю версию fastai + conda и python3

f1_score =FBeta(average='macro',beta = 1)
acc_02 = partial(accuracy_thresh, thresh=0.2)
f_score = partial(fbeta, thresh=0.2)
learn = tabular_learner(data, layers=[1000, 200, 15], emb_szs=emb_szs, metrics=[acc_02,f1_score],emb_drop=0.1, callback_fns=ShowGraph)```


I would expect to set the tresh to 0.2 but I'm getting the following error:

```python
RuntimeError                              Traceback (most recent call last)
<ipython-input-196-fd2bddb11935> in <module>()
----> 1 learn.fit_one_cycle(2, max_lr=slice(1e-01))

8 frames
/usr/local/lib/python3.6/dist-packages/fastai/metrics.py in accuracy_thresh(y_pred, y_true, thresh, sigmoid)
     33     "Computes accuracy when `y_pred` and `y_true` are the same size."
     34     if sigmoid: y_pred = y_pred.sigmoid()
---> 35     return ((y_pred>thresh).byte()==y_true.byte()).float().mean()
     36 
     37 def top_k_accuracy(input:Tensor, targs:Tensor, k:int=5)->Rank0Tensor:

RuntimeError: The size of tensor a (2) must match the size of tensor b (64) at non-singleton dimension 1```
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...