def createTeam(firstIndex, secondIndex, isRed, first='OffensiveAgent', second='DefensiveDummyAgent'): """ This function should return a list of two agents that will form the team, initialized using firstIndex and secondIndex as their agent index numbers. isRed is True if the red team is being created, and will be False if the blue team is being created. As a potentially helpful development aid, this function can take additional string-valued keyword arguments ("first" and "second" are such arguments in the case of this function), which will come from the --redOpts and --blueOpts command-line arguments to capture.py. For the nightly contest, however, your team will be created without any extra arguments, so you should make sure that the default behavior is what you want for the nightly contest. """ locationFinder = Finder() locationFinder.__init__() # The following line is an example only; feel free to change it. return [ eval(first)(firstIndex, locationFinder), eval(second)(secondIndex, locationFinder) ]
def __init__(self, ensembleType, finder, nClassifiers, modelPath, percentOfTraining=0,\ duplicatesAllowed=False, randomSeed=42, rerankType='vote', countOther=True): """ Create an ensemble classifier. type = 'feature', 'featureType', 'abstract' finder = classifier to create copies of nClassifiers = number of classifiers in the ensemble percentOfTraining = is percentage of the training set used for each classifier's training set (if 0, then the training sets are disjoint and there is no overlap) duplicates = are duplicate training examples allowed entityTypes = list of mention types (e.g. group, outcome) to find """ Finder.__init__(self, finder.entityTypes) self.finderType = 'ensemble' self.type = ensembleType self.finder = finder self.nClassifiers = nClassifiers self.duplicatesAllowed = duplicatesAllowed self.percentOfTraining = percentOfTraining self.randomSeed = randomSeed self.baggedFeatures = [] self.modelPath = modelPath if self.modelPath[-1] != '/': self.modelPath = self.modelPath + '/' self.countOther = countOther self.rerankType = rerankType self.modelFilenames = [] for i in range(self.nClassifiers): self.modelFilenames.append('%s%s.%d.train.model' %(self.modelPath,self.entityTypesString,i)) self.ensembleTypes = set([]) for i in range(self.nClassifiers): for eType in self.entityTypes: self.ensembleTypes.add(self.toEnsembleLabel(eType, i))
def __init__(self, entityType, sentenceFilter, useDetected=True): """ create a component that can be trained cluster similar mentions of a given type. useDetected = True if detected mentions should be clustered. Otherwise cluster annotated mentions """ Finder.__init__(self, [entityType]) self.finderType = 'clusterer' self.sentenceFilter = sentenceFilter self.useDetected = useDetected
def __init__(self, entityTypes, tokenClassifier): """ Create a new mention finder to find a given list of mention types. entityTypes = list of mention types (e.g. group, outcome) to find """ Finder.__init__(self, entityTypes) self.tokenClassifier = tokenClassifier if self.tokenClassifier != None: self.finderType = 'mention.'+self.tokenClassifier.classifierType else: self.finderType = 'mention'
def __init__(self, groupFinder, outcomeFinder, eventrateFinder, numberFinder, modelPath, jointAssignment=True, \ useRules=False, maxTopK=2, theta=0.8): """ Create a new re-ranker. """ Finder.__init__(self, ['group', 'outcome', 'eventrate', 'on', 'gs']) self.groupFinder = groupFinder self.outcomeFinder = outcomeFinder self.eventrateFinder = eventrateFinder self.numberFinder = numberFinder self.modelPath = modelPath self.featureIds = {} self.trainFolds = 5 self.maxTopK = maxTopK self.jointAssignment = jointAssignment self.useRules = useRules self.theta = theta self.labelingWeights = [] # self.labelingWeights = self.poissonWeights() self.labelingWeights = self.linearWeights() # self.labelingWeights = self.exponentialWeights() for i, w in enumerate(self.labelingWeights): print '%2d %.8f' % (i, w)
def __init__(self, entityType1, entityType2, useLabels=True): """ create a new mention-quantity associator given a specific mention type and quantity type. """ Finder.__init__(self, [entityType1, entityType2]) self.finderType = 'associator' self.useLabels = useLabels
def __init__(self): Finder.__init__(self)
def __init__(self, entityTypes=[]): """ Does nothing """ Finder.__init__(self, entityTypes)