NeuroNER icon indicating copy to clipboard operation
NeuroNER copied to clipboard

ZeroDivisionError: Weights sum to zero, can't be normalized

Open kiran-surya opened this issue 7 years ago • 2 comments

Hi,

I'm facing the following error, while testing on unannotated example using my custom model:

Generating plots for the test set Traceback (most recent call last): File "main.py", line 251, in main() File "main.py", line 247, in main nn.fit() File "/Users/kirantvs/Downloads/NeuroNER-master/src/neuroner.py", line 394, in fit evaluate.evaluate_model(results, dataset, y_pred, y_true, stats_graph_folder, epoch_number, epoch_start_time, output_filepaths, parameters) File "/Users/kirantvs/Downloads/NeuroNER-master/src/evaluate.py", line 239, in evaluate_model verbose=verbose) File "/Users/kirantvs/Downloads/NeuroNER-master/src/evaluate.py", line 17, in assess_model classification_report = sklearn.metrics.classification_report(y_true, y_pred, labels=labels, target_names=target_names, sample_weight=None, digits=4) File "/usr/local/lib/python3.6/site-packages/sklearn/metrics/classification.py", line 1457, in classification_report np.average(p, weights=s), File "/usr/local/lib/python3.6/site-packages/numpy/lib/function_base.py", line 1158, in average "Weights sum to zero, can't be normalized") ZeroDivisionError: Weights sum to zero, can't be normalized

Could anyone please help ?

Regards, Kiran.

kiran-surya avatar Feb 07 '18 18:02 kiran-surya

Any clues on this ?

kiran-surya avatar Feb 08 '18 16:02 kiran-surya

Hello,

I recently ran into this problem myself. The reason to why I got it was that either my Train, Valid or Test set did not have any correct .ann-file (with the "true" annotations). Double check that all files have an .ann file (that isn't empty) for your Train, Valid and Test set.

JustusJL avatar Apr 25 '18 07:04 JustusJL