rdkit.ML.Composite.BayesComposite module¶
code for dealing with Bayesian composite models
For a model to be useable here, it should support the following API:
- _ClassifyExample(example)_, returns a classification
Other compatibility notes:
- To use _Composite.Grow_ there must be some kind of builder functionality which returns a 2-tuple containing (model,percent accuracy).
- The models should be pickleable
- It would be very happy if the models support the __cmp__ method so that membership tests used to make sure models are unique work.
-
class
rdkit.ML.Composite.BayesComposite.BayesComposite¶ Bases:
rdkit.ML.Composite.Composite.Compositea composite model using Bayesian statistics in the Decision Proxy
Notes
typical usage:
- grow the composite with AddModel until happy with it
- call AverageErrors to calculate the average error values
- call SortModels to put things in order by either error or count
- call Train to update the Bayesian stats.
-
ClassifyExample(example, threshold=0, verbose=0, appendExample=0)¶ classifies the given example using the entire composite
Arguments
example: the data to be classified
- threshold: if this is a number greater than zero, then a
classification will only be returned if the confidence is above _threshold_. Anything lower is returned as -1.
Returns
a (result,confidence) tuple
-
Train(data, verbose=0)¶
-
rdkit.ML.Composite.BayesComposite.BayesCompositeToComposite(obj)¶ converts a BayesComposite to a Composite.Composite
-
rdkit.ML.Composite.BayesComposite.CompositeToBayesComposite(obj)¶ converts a Composite to a BayesComposite
- if _obj_ is already a BayesComposite or if it is not a _Composite.Composite_ ,
- nothing will be done.