public class Bayesian extends Object
Modifier and Type | Field and Description |
---|---|
protected ArrayList<Boolean> |
activity |
protected Map<Integer,Double> |
contribs |
protected double[] |
estimates |
protected double |
highThresh |
protected Map<Integer,int[]> |
inHash |
protected double |
invRange |
protected double |
lowThresh |
protected double |
range |
protected double |
rocAUC |
protected String |
rocType |
protected float[] |
rocX |
protected float[] |
rocY |
protected ArrayList<int[]> |
training |
protected int |
trainingActives |
protected int |
trainingSize |
Constructor and Description |
---|
Bayesian(int classType)
Instantiate a Bayesian model with no data.
|
Bayesian(int classType,
int folding)
Instantiate a Bayesian model with no data.
|
Modifier and Type | Method and Description |
---|---|
void |
addMolecule(IAtomContainer mol,
boolean active)
Appends a new row to the model source data, which consists of a molecule and whether or not it
is considered active.
|
void |
build()
Performs that Bayesian model generation, using the {molecule:activity} pairs that have been submitted up to this
point.
|
void |
clearTraining()
Clears out the training set, to free up memory.
|
static Bayesian |
deserialise(BufferedReader rdr)
Reads the incoming stream and attempts to convert it into an instantiated model.
|
static Bayesian |
deserialise(String str)
Converts a given string into a Bayesian model instance, or throws an exception if it is not valid.
|
int |
getClassType()
Access to the fingerprint type.
|
int |
getFolding()
Access to the fingerprint folding extent.
|
String[] |
getNoteComments()
Returns the optional comments, which is a list of arbitrary text strings.
|
String |
getNoteOrigin()
Returns the optional description of the source for the model.
|
String |
getNoteTitle()
Returns the optional title used to describe the model.
|
double |
getROCAUC()
Returns the integral of the area-under-the-curve of the receiver-operator-characteristic.
|
String |
getROCType()
Returns a string description of the method used to create the ROC curve (e.g.
|
float[] |
getRocX()
Returns X-values that can be used to plot the ROC-curve.
|
float[] |
getRocY()
Returns Y-values that can be used to plot the ROC-curve.
|
int |
getTrainingActives()
Returns the number of actives in the training set that was used to create the model.
|
int |
getTrainingSize()
Returns the size of the training set, i.e.
|
double |
predict(IAtomContainer mol)
For a given molecule, determines its fingerprints and uses them to calculate a Bayesian prediction.
|
double |
scalePredictor(double pred)
Converts a raw Bayesian prediction and transforms it into a probability-like range, i.e.
|
String |
serialise()
Converts the current model into a serialised string representation.
|
void |
setNoteComments(String[] comments)
Sets the comments for the model, which is a list of strings containing arbitrary content.
|
void |
setNoteOrigin(String origin)
Provides an arbitrary string that briefly describes the model origin, which may include authors, data
source keywords, or other pertinent information.
|
void |
setNoteTitle(String title)
Provides an arbitrary title string that briefly summarises the model.
|
void |
validateFiveFold()
Produces a ROC validation set by partitioning the inputs into 5 groups, and performing five separate 80% in/20% out
model simulations.
|
void |
validateLeaveOneOut()
Produces an ROC validation set, using the inputs provided prior to the model building, using leave-one-out.
|
void |
validateThreeFold()
Produces a ROC validation set by partitioning the inputs into 3 groups, and performing three separate 66% in/33% out
model simulations.
|
protected ArrayList<int[]> training
protected double lowThresh
protected double highThresh
protected double range
protected double invRange
protected double[] estimates
protected float[] rocX
protected float[] rocY
protected String rocType
protected double rocAUC
protected int trainingSize
protected int trainingActives
public Bayesian(int classType)
classType
- one of the CircularFingerprinter.CLASS_* constantspublic Bayesian(int classType, int folding)
folding
- the maximum number of fingerprint bits, which must be a power of 2 (e.g. 1024, 2048) or 0 for no foldingpublic int getClassType()
public int getFolding()
public void addMolecule(IAtomContainer mol, boolean active) throws CDKException
mol
- molecular structure, which must be non-blankactive
- whether active or notCDKException
public void build() throws CDKException
CDKException
public double predict(IAtomContainer mol) throws CDKException
mol
- molecular structure which cannot be blank or nullCDKException
public double scalePredictor(double pred)
pred
- raw prediction, as provided by the predict(..) methodpublic void validateLeaveOneOut()
public void validateFiveFold()
public void validateThreeFold()
public void clearTraining()
public int getTrainingSize()
public int getTrainingActives()
public double getROCAUC()
public String getROCType()
public float[] getRocX()
public float[] getRocY()
public String getNoteTitle()
public void setNoteTitle(String title)
title
- short text description (no newlines or tabs); use null if nonepublic String getNoteOrigin()
public void setNoteOrigin(String origin)
origin
- short text description (no newlines or tabs); use null if nonepublic String[] getNoteComments()
public void setNoteComments(String[] comments)
comments
- list of strings; use null or empty array if nonepublic String serialise()
public static Bayesian deserialise(String str) throws IOException
str
- string containing the serialised modelIOException
public static Bayesian deserialise(BufferedReader rdr) throws IOException
rdr
- readerIOException
Copyright © 2017. All Rights Reserved.