Franck-Dernoncourt / NeuroNER

Named-entity recognition using neural networks. Easy-to-use and state-of-the-art results.
http://neuroner.com
MIT License
1.69k stars 476 forks source link

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

Open kiran-surya opened 6 years ago

kiran-surya commented 6 years ago

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 commented 6 years ago

Any clues on this ?

JustusJL commented 6 years ago

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.