Dear Greg,

"
# build fingerprints:
fps = [AllChem.GetMorganFingerprintAsBitVect(x,2,2048) for x in ms]

nPossible = [0]+[2]*2048+[3]

# now build our list of points:
pts = []
for i,m in enumerate(ms):
    if m.GetProp('affinity')=='low':
        act=2
    elif m.GetProp('affinity')=='intermediate':
        act=1
    else:
        act=0
    pts.append([m.GetProp('ID'),fps[i],act])

# and save them to a file:
import cPickle
cPickle.dump(pts,file('pts.pkl','wb+'))

# Building a single decision tree

import cPickle,numpy
from rdkit.ML.DecTree.BuildSigTree import BuildSigTree

pts = cPickle.load(file('pts.pkl','rb'))

cmp = Composite()
cmp.Grow(pts,attrs=[1],nPossibleVals=[3],nTries=10,
         buildDriver=CrossValidate.CrossValidationDriver,
         treeBuilder=SigTreeBuilder,needsQuantization=False,maxDepth=3)
"

=>  name 'Composite' is not defined

I only imported:
"
from rdkit import Chem
from rdkit.Chem import AllChem
"

Is anything missing?


Thanks & Cheers,
Paul



> Dear Paul,
>
>
> Not tested, but what I think you want is:
>
> # build a composite (bag) with 10 trees:
> cmp = Composite()
> cmp.Grow(pts,attrs=[1],nPossibleVals=[3],nTries=10,
>          buildDriver=CrossValidate.CrossValidationDriver,
>          treeBuilder=SigTreeBuilder,needsQuantization=False,maxDepth=3)
>
> -greg
>
>
> On Tue, May 10, 2011 at 10:02 AM,  <[email protected]> wrote:
> > Dear Greg,
> >
> >
> >> >
> >> > However, I wonder how to build a 3-class model:
> >> >
> >> > "
> >> > for i,m in enumerate(ms):
> >> >  if m.GetProp('ACTIVITY_CLASS')=='active':
> >> >  act=1
> >> >  else:
> >> >  act=0
> >> >  pts.append([m.GetProp('CompoundName')]+list(descrs[i])+[act])
> >> > "
> >> >
> >> > Naively, I just tried act 0,1 or 2 - but this did not work.
> >>
> >> You do need to add 0,1,2, but you also need to change the last value
> >> in nPossible (the number of values each descriptor + the activity can
> >> take) to 3. Something like this (not tested):
> >> nPossible = [0]+[2]*ndescrs+[3]
> >>
> >> Then it should work.
> >
> >
> > Where does ndescrs come from?
> >
> > Using the MorganFingerprint example from the Wiki:
> > # build fingerprints:
> > fps = [AllChem.GetMorganFingerprintAsBitVect(x,2,2048) for x in ms]
> > nPossible = [0]+[2]*fps+[3]
> >
> >
> > This did not work.
> > Does your example code only go with descriptors rather than
fingerprints?
> >
> > Cheers & Thanks,
> > Paul


This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended recipient,
you must not copy this message or attachment or disclose the contents to
any other person. If you have received this transmission in error, please
notify the sender immediately and delete the message and any attachment
from your system. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not accept liability for any omissions or errors in this
message which may arise as a result of E-Mail-transmission or for damages
resulting from any unauthorized changes of the content of this message and
any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
subsidiaries do not guarantee that this message is free of viruses and does
not accept liability for any damages caused by any virus transmitted
therewith.

Click http://disclaimer.merck.de to access the German, French, Spanish and
Portuguese versions of this disclaimer.


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to