コード例 #1
0
  def test1(self):
    """ basics """
    self.details.tableName = 'ferro_quant'
    refComposName = 'ferromag_quant_10.pkl'

    refCompos = pickle.load(open(os.path.join(self.baseDir,refComposName),
                                 'rb'))

    # first make sure the data are intact
    self._init(refCompos)
    compos = BuildComposite.RunIt(self.details,saveIt=0)

    self.compare(compos,refCompos)
コード例 #2
0
 def test7(self):
   """ Test composite of naive bayes"""
   self.details.tableName = 'ferro_noquant'
   refComposName = 'ferromag_NaiveBayes.pkl'
   pklFile = open(os.path.join(self.baseDir,refComposName), 'rb')
   refCompos = pickle.load(pklFile)
   self._init(refCompos,copyBounds=1)
   self.details.useTrees = 0
   self.details.useNaiveBayes = 1
   self.details.mEstimateVal = 20.0
   self.details.qBounds = [0] + [2]*6 + [0]
   compos = BuildComposite.RunIt(self.details, saveIt= 0)
   self.compare(compos,refCompos)
コード例 #3
0
  def test6(self):
    """ auto bounds with a real valued activity"""
    self.details.tableName = 'ferro_noquant_realact'
    refComposName = 'ferromag_auto_10_3.pkl'

    refCompos = pickle.load(open(os.path.join(self.baseDir,refComposName),
                                 'rb'))

    # first make sure the data are intact
    self._init(refCompos,copyBounds=1)
    self.details.limitDepth = 3
    self.details.nModels = 10
    self.details.activityBounds=[0.5]
    compos = BuildComposite.RunIt(self.details,saveIt=0)
    self.compare(compos,refCompos)
コード例 #4
0
  def test4(self):
    """ more trees """
    self.details.tableName = 'ferro_quant'
    refComposName = 'ferromag_quant_50_3.pkl'

    refCompos = pickle.load(open(os.path.join(self.baseDir,refComposName),
                                 'rb'))

    # first make sure the data are intact
    self._init(refCompos)
    self.details.limitDepth = 3
    self.details.nModels = 50
    compos = BuildComposite.RunIt(self.details,saveIt=0)

    self.compare(compos,refCompos)
コード例 #5
0
  def test3(self):
    """ depth limit + less greedy """
    self.details.tableName = 'ferro_quant'
    refComposName = 'ferromag_quant_10_3_lessgreedy.pkl'

    refCompos = pickle.load(open(os.path.join(self.baseDir,refComposName),
                                 'rb'))

    # first make sure the data are intact
    self._init(refCompos)
    self.details.limitDepth = 3
    self.details.lessGreedy = 1
    compos = BuildComposite.RunIt(self.details,saveIt=0)

    self.compare(compos,refCompos)
コード例 #6
0
    def test7(self):
        """ Test composite of naive bayes"""
        self.details.tableName = 'ferro_noquant'
        refComposName = 'ferromag_NaiveBayes.pkl'
        with open(os.path.join(self.baseDir, refComposName), 'r') as pklTFile:
            buf = pklTFile.read().replace('\r\n', '\n').encode('utf-8')
            pklTFile.close()
        with io.BytesIO(buf) as pklFile:
            refCompos = pickle.load(pklFile)
        self._init(refCompos, copyBounds=1)
        self.details.useTrees = 0
        self.details.useNaiveBayes = 1
        self.details.mEstimateVal = 20.0
        self.details.qBounds = [0] + [2] * 6 + [0]
        compos = BuildComposite.RunIt(self.details, saveIt=0)

        self.compare(compos, refCompos)
コード例 #7
0
    def test2(self):
        """ depth limit """
        self.details.tableName = 'ferro_quant'
        refComposName = 'ferromag_quant_10_3.pkl'

        with open(os.path.join(self.baseDir, refComposName), 'r') as pklTF:
            buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
            pklTF.close()
        with io.BytesIO(buf) as pklF:
            refCompos = pickle.load(pklF)

        # first make sure the data are intact
        self._init(refCompos)
        self.details.limitDepth = 3
        compos = BuildComposite.RunIt(self.details, saveIt=0)

        self.compare(compos, refCompos)
コード例 #8
0
    def test6(self):
        """ auto bounds with a real valued activity"""
        self.details.tableName = 'ferro_noquant_realact'
        refComposName = 'ferromag_auto_10_3.pkl'

        with open(os.path.join(self.baseDir, refComposName), 'r') as pklTF:
            buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
            pklTF.close()
        with io.BytesIO(buf) as pklF:
            refCompos = pickle.load(pklF)

        # first make sure the data are intact
        self._init(refCompos, copyBounds=1)
        self.details.limitDepth = 3
        self.details.nModels = 10
        self.details.activityBounds = [0.5]
        compos = BuildComposite.RunIt(self.details, saveIt=0)

        self.compare(compos, refCompos)
コード例 #9
0
ファイル: UnitTestBuildComposite.py プロジェクト: yinxx/rdkit
    def test1_basics(self):
        # """ basics """
        self.details.tableName = 'ferro_quant'
        refComposName = 'ferromag_quant_10.pkl'

        with open(os.path.join(self.baseDir, refComposName), 'r') as pklTF:
            buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
            pklTF.close()
        with io.BytesIO(buf) as pklF:
            refCompos = pickle.load(pklF)

        # first make sure the data are intact
        self._init(refCompos)
        compos = BuildComposite.RunIt(self.details, saveIt=0)

        # pickle.dump(compos,open(os.path.join(self.baseDir,refComposName), 'wb'))
        # with open(os.path.join(self.baseDir,refComposName), 'rb') as pklF:
        #   refCompos = pickle.load(pklF)

        self.compare(compos, refCompos)