BeagleComposite combines the BEAGLE order and context model with a user defined ratio. Default ratio is .5 which weighs order and context matrices equally.
Methods
| BeagleComposite.__init__(ctx_corp, ...[, ...]) | Assume that the context corpus is a subcorpus of the order corpus and that the eventual composite corpus is the context corpus. |
| BeagleComposite.load(f) | Takes a filename or file object and loads it as an npz archive |
| BeagleComposite.save(f) | Takes a filename or file object and saves self.matrix in an npz archive. |
| BeagleComposite.train([wgt]) | Combines the context and order matrices blended by wgt ratio. |
Assume that the context corpus is a subcorpus of the order corpus and that the eventual composite corpus is the context corpus. The order matrix is sliced and reordered so that it aligns with the context matrix.
| Parameters: |
|
|---|
Takes a filename or file object and loads it as an npz archive into a BaseModel object.
| Parameters: | file (str-like or file-like object) – Designates the file to read. If file is a string ending in .gz, the file is first gunzipped. See numpy.load for further details. |
|---|---|
| Returns: | A dictionary storing the data found in file. |
| See Also: | numpy.load() |
Takes a filename or file object and saves self.matrix in an npz archive.
| Parameters: | file (str-like or file-like object) – Designates the file to which to save data. See numpy.savez for further details. |
|---|---|
| Returns: | None |
| See Also: | numpy.savez() |
Combines the context and order matrices blended by wgt ratio.
| Parameters: | wgt (float, optional) – The weight of context model. If wgt is .7 then the ratio of context and order model is 7:3. wgt should be a value in [0,1]. Default is .5. |
|---|---|
| Returns: | None |