LimeTextExplainer for MultiClass classification - Facing issue for explain instance with custom classifier function
exp = explainer.explain_instance(df_val_final.Description[idx],predproba_list,num_features=5, top_labels=2)
While executing the explain instance of LimeTextExplainer, the above statement keeps on executing continuously with the below warning message. Execution stops only if I interrupt the kernel
C:\ProgramData\Anaconda3\lib\site-packages\fastai\torch_core.py:83: UserWarning: Tensor is int32: upgrading to int64; for better performance use int64 input
warn('Tensor is int32: upgrading to int64; for better performance use int64 input')
C:\ProgramData\Anaconda3\lib\site-packages\fastai\torch_core.py:83: UserWarning: Tensor is int32: upgrading to int64; for better performance use int64 input
warn('Tensor is int32: upgrading to int64; for better performance use int64 input')
C:\ProgramData\Anaconda3\lib\site-packages\fastai\torch_core.py:83: UserWarning: Tensor is int32: upgrading to int64; for better performance use int64 input
warn('Tensor is int32: upgrading to int64; for better performance use int64 input')
I want to use my own custom classifier model and hence I wrote a classifier function - predproba_list, which returns a numpy array of predicted probabilities for the classes Below is the function code
def predproba_list(test1) :
pred = learn_clf.predict(test1)
return np.array(pred[2])
pred[2] vaue is tensor([0.1423, 0.2133, 0.6444]) which i then convert to a numpy array
Can you please advise if the return value of the function is as expected by the explain instance's classifier function, and what could be causing the code to keep on executing without any result?
Topic lime
Category Data Science