htmd.adaptive.adaptivebandit module#
- class htmd.adaptive.adaptivebandit.AdaptiveBandit#
Bases:
AdaptiveBaseAdaptive sampling using a bandit algorithm for state selection.
Uses an Upper Confidence Bound (UCB) strategy over a Markov state model to balance exploration and exploitation when choosing respawning conformations.
- Parameters:
app (
SimQueueobject, defaultNone) – A SimQueue class object used to retrieve and submit simulationsproject (
str, default'adaptive') – The name of the projectnmin (
int, default0) – Minimum number of running simulationsnmax (
int, default1) – Maximum number of running simulationsnepochs (
int, default1000) – Stop adaptive once we have reached this number of epochsnframes (
int, default0) – Stop adaptive once we have simulated this number of aggregate simulation frames.inputpath (
str, default'input') – The directory used to store input foldersgeneratorspath (
str, default'generators') – The directory containing the generatorsdryrun (
boolean, defaultFalse) – A dry run means that the adaptive will retrieve and generate a new epoch but not submit the simulationsupdateperiod (
float, default0) – When set to a value other than 0, the adaptive will run synchronously every updateperiod secondscoorname (
str, default'input.coor') – Name of the file containing the starting coordinates for the new simulationsboxname (
str, default'input.xsc') – Name of the file containing the starting box dimensions for the new simulations. Set to ‘none’ to disable box writing.lock (
bool, defaultFalse) – Lock the folder while adaptive is ongoingmps (
int, default0) – If mps > 0, it will run simulations using the Multi-Process Service (MPS) with the number of processes specified. If set to 0, mps is disableddatapath (
str, default'data') – The directory in which the completed simulations are storedfilter (
bool, defaultTrue) – Enable or disable filtering of trajectories.filtersel (
str, default'not water') – Filtering atom selectionfilteredpath (
str, default'filtered') – The directory in which the filtered simulations will be storedprojection (
Projectionobject, defaultNone) – A Projection class object or a list of objects which will be used to project the simulation data before constructing a Markov modelgoalfunction (
function, defaultNone) – This function will be used to convert the goal-projected simulation data to a ranking whichcan be used for the directed component of FAST.reward_method (
str, default'mean') – The reward methodstatetype (
(``’cluster’, ``'micro','macro'),str, default'micro') – State type (cluster, micro, macro) to use for reward calculations.skip (
int, default1) – Allows skipping of simulation frames to reduce data. i.e. skip=3 will only keep every third framelag (
int, default1) – The lagtime used to create the Markov model. Units are in frames.exploration (
float, default0.01) – Exploration is the coefficient used in UCB algorithm to weight the exploration valuetemperature (
int, default300) – Temperature used to compute the free energyticalag (
int, default20) – Lagtime to use for TICA in frames. When using skip remember to change this accordinly.ticadim (
int, default3) – Number of TICA dimensions to use. When set to 0 it disables TICAclustmethod (
ClusterMixinclass, default <class'sklearn.cluster._kmeans.MiniBatchKMeans'>) – Clustering algorithm used to cluster the contacts or distancesmacronum (
int, default8) – The number of macrostates to producesave_qval (
bool, defaultFalse) – Save the Q(a) and N values for every epochactionspace (
(``’metric’, ``'goal','tica','ticapcca'),str, default'tica') – The projected space which will be clustered and used to define our action spacerecluster (
bool, defaultFalse) – If to recluster the projected space used in MSM estimation with a different clustering.reclusterMethod (, default <class
'htmd.clustering.regular.RegCluster'>) – Clustering method for reclustering.goal_init (
float, default0.3) – The proportional ratio of goal initialization compared to max frames set by nframes
- count_pucb(q_value, exploration, predictor, step, n_value)#
Compute the predictive UCB value for a state.
- Parameters:
q_value (
float) – Current estimated reward for the state.exploration (
float) – Exploration coefficient weighting the confidence bound.predictor (
float) – Predictor value scaling the exploration bonus.step (
int) – Total number of steps taken so far.n_value (
int) – Number of times the state has been visited.
- Returns:
pucb – Predictive UCB score for the state.
- Return type:
- count_ucb(q_value, exploration, step, n_value)#
Compute the UCB value for a state.
- Parameters:
- Returns:
ucb – UCB score for the state.
- Return type: