
# quants package

Package for Artifical Neural Network (**ANN**) based learning of quantifiers.

It contains definition of scenes of elements and classes for both quantifier sampling and NN simple example package.


## Classes

### Quantifer classes
These classes are a quantifier hierarchy with methods and definitions for:
* *Scenes* that are composed of world *elements* pertaining to use of a sentence of the form "**q as are bs**".
* Construction of quantifier if parameters (such as in the case of ExactlyN for instance) are required.
* Static method for generation of a completely random scene.
* Generation of permuted prototype scenes that are evaluated as true under the given quantifier q.
* Evaluation of a given scene (returns **TRUE** for scenes generated by the same quantifier q in the previous method).

### Classifier class approach
This approach assumes that quantifiers are learned as a group, essentially each quantifier q **TRUE** *scene* is a negative example for all other quantifiers q'.
There is of course many scenes for which more than one quantifier is evaluated as **TRUE**, for instance if "Both students are eating" is **TRUE** then "Some students are eating" is also **TRUE**, this can be mitigated by implicatures which we do not address.

The classifier is in effect a solver for which q makes the sentence "**q as are bs**" most likely given an input *scene* s.

This enables us to use not only the quantifier quantify evaluation methods but the classifier in order to generate a teacher-student scheme.

### AE approach
The AE approach tries to let an AE look at *scenes* where a given quantifier q was used by a teacher (language speaker), this is repeated many times till whatever structure typical to scenes **TRUE** under the quantifier q are encoded in the AE hidden values' represented structure. When learning is complete and when we are given a scene we use the AE as an anomaly detector to decide whether the scene is True under the quantifier q. The idea is that after seeing many q **TRUE** scenes a non q **TRUE** scene will have relatively high reconstruction errors.
