transtab
transtab copied to clipboard
A bug in transfer_learning demo
First of all, my environment is : python 3.9 , transtab : 0.0.5,window10
When I run the example demo transfer_learning.ipynb
, I found the last paragraph
ypred = transtab.predict(model, x_test)
transtab.evaluate(ypred, y_test, metric='auc')
will throw an exception:
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_25172\1474315435.py in <cell line: 2>()
1 x_test, y_test = testset[1]
----> 2 ypred = transtab.predict(model, x_test)
D:\Anaconda\envs\torch_gpu_1.13.1\lib\site-packages\transtab\evaluator.py in predict(clf, x_test, y_test, return_loss, eval_batch_size)
47 for i in range(0, len(x_test), eval_batch_size):
48 bs_x_test = x_test.iloc[i:i+eval_batch_size]
---> 49 bs_y_test = y_test.iloc[i:i+eval_batch_size]
50 with torch.no_grad():
51 logits, loss = clf(bs_x_test, bs_y_test)
AttributeError: 'NoneType' object has no attribute 'iloc'
And I have solved it.Just change it to following statement.
ypred = transtab.predict(model, x_test=x_test, y_test=y_test)