KeyError: Ty('p') #62
-
Hi Lambeq support, I am trying to train a binary classification model using my own dataset, which I built following the same structure as in the example datasets. The problem is that when trying to parameterise the string diagrams I get the error: KeyError: Ty('p'). Thanks a lot for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Ferchu18 The tutorial docs here demonstrate how to parameterise string diagrams containing only noun and sentence types.
|
Beta Was this translation helpful? Give feedback.
Hi @Ferchu18
It would be useful to see the code snippet which raises this error.
My guess is that for your dataset, the parser produces diagrams which contain the
PREPOSITIONAL_PHRASE
type, denoted by'p'
.When parameterising a string diagram using an ansatz, it is necessary to provide a map from all the types in the string diagram to the target representation (number of qubits in the quantum case.)
The tutorial docs here demonstrate how to parameterise string diagrams containing only noun and sentence types.
For a dataset containing the preposition phrase type, this can be modified as follows: