Esempio n. 1
0
    def propose(self, **kwargs):
        ret_value, fb = None, None
        while True: # keep trying to propose
            try:
                ret_value, fb = regeneration_proposal(self.grammar, self.value, **kwargs)
                break
            except ProposalFailedException:
                pass

        ret = self.__copy__(value=ret_value)

        return ret, fb
Esempio n. 2
0
    def propose(self, **kwargs):
        ret_value, fb = None, None
        while True:  # keep trying to propose
            try:
                ret_value, fb = regeneration_proposal(self.grammar, self.value,
                                                      **kwargs)
                break
            except ProposalFailedException:
                pass

        ret = self.__copy__(value=ret_value)

        return ret, fb
Esempio n. 3
0
    def propose(self, **kwargs):
        ret_value, fb = None, None
        while True: # keep trying to propose
            try:
                #ret_value, fb = numpy.random.choice([insert_delete_proposal,regeneration_proposal])(self.grammar, self.value, **kwargs)

                # Use a special proposer that won't propose to partition nodes
                ret_value, fb = regeneration_proposal(self.grammar, self.value, resampleProbability=lambda n: getattr(n, "p_propose", 1.0))

                break
            except ProposalFailedException:
                pass

        ret = self.__copy__(value=ret_value)

        return ret, fb
Esempio n. 4
0
    def propose(self, **kwargs):
        ret_value, fb = None, None
        while True:  # keep trying to propose
            try:
                #ret_value, fb = numpy.random.choice([insert_delete_proposal,regeneration_proposal])(self.grammar, self.value, **kwargs)

                # Use a special proposer that won't propose to partition nodes
                ret_value, fb = regeneration_proposal(
                    self.grammar,
                    self.value,
                    resampleProbability=lambda n: getattr(n, "p_propose", 1.0))

                break
            except ProposalFailedException:
                pass

        ret = self.__copy__(value=ret_value)

        return ret, fb