{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}} {\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 # Example custom model code\par # (C) Optibrium Ltd 2009\par # stardrop-support@optibrium.com\par #\par \par # This example code can be used to add in-house or third party models\par # into the StarDrop interface via the StarDrop model server (i.e.\par # making them available to all users). This example will provide a\par # continuous model by default but by changing the commenting (see\par # instructions in the code) it can easily be transformed into a\par # category model\par \par from implugin import IMPlugin # this is required for all models\par \par ## Comment out the line below if this is a category model\par from modeldescriptions import ContModelDescription\par \par ## Uncomment the line below if this is acategory model\par # from modeldescriptions import CatModelDescription\par \par class Plugin (IMPlugin):\par def __init__(self):\par \par ## Comment out these 8 lines to make this a category model\par model = ContModelDescription('MOD_CONT',\par 0.0, # minimum possible value of prediction\par 1000.0, # maximum possible value of prediction\par interactive = True,\par header='Cont',\par shortName = 'name',\par longName = 'a continuous model',\par description = 'This is an example')\par \par ## Uncomment these 7 lines to make this a category model\par # model = CatModelDescription('MOD_CAT',\par # ['low','medium','high'], # possible result categories\par # interactive=True,\par # header='3Cat',\par # shortName='3-category model',\par # longName='a three category model',\par # description='An example category model')\par \fs22\par \fs20 IMPlugin.__init__(self, model)\par \par # The predict function is where you need to add the custom code\par # for calculation or to call out to other applications. The molecule\par # is appsed to this function as a SMILES string\par \par def predict(self, smiles, extra):\par # implement model calculation here\par ## Comment out the lne below is this is a category model\par return [7.2, 0.5] # [prediction, standard deviation]\par ## Uncomment the line below if this is a category model\par # return [0.3,0.1,0.6] # probability of each category (listed above)\par ## For category models the "predicted category" is the one with the\par ## highest probability (in this case 'high')\par \par }