lua---nnx icon indicating copy to clipboard operation
lua---nnx copied to clipboard

SoftMaxTree prediction when testing

Open jinfengr opened this issue 7 years ago • 0 comments

In the SoftMaxTree example given in the readme, it assumed we already know the label of target.

> input = torch.randn(5,10)
> target = torch.IntTensor{20,24,27,10,12}
> gradOutput = torch.randn(5)
> root_id = 29
> input_size = 10   
> hierarchy = {
>>    [29]=torch.IntTensor{30,1,2}, [1]=torch.IntTensor{3,4,5}, 
>>    [2]=torch.IntTensor{6,7,8}, [3]=torch.IntTensor{9,10,11},
>>    [4]=torch.IntTensor{12,13,14}, [5]=torch.IntTensor{15,16,17},
>>    [6]=torch.IntTensor{18,19,20}, [7]=torch.IntTensor{21,22,23},
>>    [8]=torch.IntTensor{24,25,26,27,28}
>> }
> smt = nn.SoftMaxTree(input_size, hierarchy, root_id)
> smt:forward{input, target}

What if we don't know the label of target during test? Do you have code for testing?

jinfengr avatar Nov 18 '16 19:11 jinfengr