Trains the classifier with the given document of the given type (i.e., class). A document can be a Document, Vector, dict, list or string. If no type is given, Document.type will be used instead.
(self, document, type=None)
| 1741 | return moment(a, m, 3) / (moment(a, m, 2) ** 1.5 or 1) |
| 1742 | |
| 1743 | def train(self, document, type=None): |
| 1744 | """ Trains the classifier with the given document of the given type (i.e., class). |
| 1745 | A document can be a Document, Vector, dict, list or string. |
| 1746 | If no type is given, Document.type will be used instead. |
| 1747 | """ |
| 1748 | type, vector = self._vector(document, type) |
| 1749 | self._vectors.append((type, vector)) |
| 1750 | self._classes[type] = self._classes.get(type, 0) + 1 |
| 1751 | |
| 1752 | def classify(self, document, discrete=True): |
| 1753 | """ Returns the type with the highest probability for the given document. |