TobiasLee / Text-Classification

Implementation of papers for text classification task on DBpedia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in attn_bi_lstm.py while feeding data label during training

simonefrancia opened this issue · comments

> python attn_bi_lstm.py

InvalidArgumentError (see above for traceback): Received a label value of 
-2147483648 which is outside the valid range of [0, 15).  Label values: -2147483648
 -2147483648 -2147483648 -2147483648 -2147483648 -2147483648 
-2147483648 -2147483648 -2147483648 -2147483648 -2147483648
 -2147483648 -2147483648 -2147483648 -2147483648 -2147483648 
-2147483648 -2147483648 -2147483648 -2147483648 -2147483648 
-2147483648 -2147483648 -2147483648 -2147483648 -2147483648 
-2147483648 -2147483648 -2147483648 -2147483648 -2147483648 -2147483648
	 [[{{node SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits}}
 = SparseSoftmaxCrossEntropyWithLogits[T=DT_FLOAT, Tlabels=DT_INT32, 
_device="/job:localhost/replica:0/task:0/device:CPU:0"](xw_plus_b, _arg_Placeholder_1_0_1)]]

Printing y_train values:


5164    NaN
3458    NaN
3236    NaN
3118    NaN
1555    NaN
930     NaN
3188    NaN
2899    NaN
2918    NaN
1431    NaN
2373    NaN
1205    NaN
2734    NaN
2560    NaN
1495    NaN
5430    NaN
2912    NaN
2098    NaN
2410    NaN
4482    NaN
1045    1.0
2469    NaN
1703    NaN
250     NaN
5214    NaN
4767    NaN
849     NaN
976     NaN
5489    NaN
5545    NaN
5241    NaN
3128    NaN

Thanks

please check ur data file ...check shape and which column ur are trying to feed . I think ur feeding the wrong column.

@simonefrancia I checked code and find a strange phenomena that causes your problem. The shuffle operation in fill_feed_dict makes data_Y become NaN, but it doesn't perform in a consistent way, other models don't have this problem while they use the same function. So I change the way of shuffling data by using shuffle() function in sklearn. I ran the new code and the problem is solved.