TeamHG-Memex / eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
http://eli5.readthedocs.io
MIT License
2.74k stars 332 forks source link

explain_prediction_keras support more types for doc #331

Open teabolt opened 4 years ago

teabolt commented 4 years ago

The explain_prediction_keras function (https://github.com/TeamHG-Memex/eli5/pull/325) takes a doc argument that is the input to a Keras model. Currently doc must be a numpy array.

It would be nice to support other types for doc, not just numpy arrays. See https://github.com/keras-team/keras/blob/ed07472bc5fc985982db355135d37059a1f887a9/keras/engine/training.py#L1315 or https://keras.io/models/sequential/#predict for a list of what types input Keras models can accept.

In particular for text it would be nice to support input in a Python list (for example keras.preprocessing.sequence.pad_sequences can return lists).