4

I have a trained model and I am running prediction with keras via:

model = pets.get_model(input_size=input_units)
model.compile(loss='categorical_crossentropy',
              optimizer='adam', metrics=['accuracy'])
model.load_weights('models/2019-03-01-02-03-53.h5')

prediction = model.predict(X)

This gives me a list that looks like [0.323 0.43 .099] and so on. How can I map that to rows in my X (which is a pandas DataFrame) so that I have an easy representation of input to outputs?

Shamoon
  • 41,293
  • 91
  • 306
  • 570

1 Answers1

2

By default, model.predict(X) and X itself will already be in the same order (first value of prediction corresponds to X's first row and so on).

For ease of visualization, you could try something like X['predicitons'] = prediction but that would add a column to X.

Victor Valente
  • 761
  • 9
  • 24