#!/usr/bin/env python3 import crowdsim import operator g = crowdsim.generator.GeneralGenerator(10, 2, 1) #s = crowdsim.solver.PSolver(10, lambda x: 0.8, duplicate = 3) a = crowdsim.assigner.SimpleAssigner(3) w = crowdsim.worker.PWorker(10, lambda x: 0.8) d = crowdsim.deducer.MajorityVote() crowdsim.linkAll(g, a, w, d) print('========== Answers ==========') for x in sorted(w, key=lambda x: x.task.id): print(x) print('=============================') print('Accuracy:', crowdsim.evaluate(d, strict=True))
#!/usr/bin/env python3 import crowdsim import operator g = crowdsim.generator.GeneralGenerator(10, 2, 1) #s = crowdsim.solver.PSolver(10, lambda x: 0.8, duplicate = 3) a = crowdsim.assigner.SimpleAssigner(3) w = crowdsim.worker.PWorker(10, lambda x: 0.8) d = crowdsim.deducer.MajorityVote() crowdsim.linkAll(g, a, w, d) print('========== Answers ==========') for x in sorted(w, key = lambda x: x.task.id): print(x) print('=============================') print('Accuracy:', crowdsim.evaluate(d, strict = True))
return obj config = configparser.ConfigParser() config.read(sys.argv[1]) outputMetric = False if 'workerpool' in config['crowdsim']: # do not use the crowd, use simulation, ignore AMT setting outputMetric = True with open(config['others']['input_answers']) as f: trueLabelGenerator = [int(l) for l in f] g = crowdsim.generator.GeneralGenerator(len(trueLabelGenerator), 2, trueLabelGenerator) a = constructComponent('assigner') dw = w = constructComponent('workerpool') d = constructComponent('deducer') crowdsim.linkAll(g, a, w, d) else: # initialization collect = config['others'].get('collect', False) == 'True' batchSize = int(config['others'].get('batchSize', 1)) csv = csvReader(open(config['others']['input_questions']), batchSize) amtagent = AMTAgent(config['AMT']['KeyId'], config['AMT']['SecretKey'], debug = True) hpConstructor = generateHPConstructor(csv, config['AMT_HIT']['Lifetime'], config['AMT_HIT']['LayoutId'], config['AMT_HIT']['Title'], config['AMT_HIT']['Description'], config['AMT_HIT']['Reward'], config['AMT_HIT']['AssignmentDurationInSeconds'], config['AMT_HIT']['Keywords'], config['AMT_HIT']['AutoApprovalDelayInSeconds'],
config = configparser.ConfigParser() config.read(sys.argv[1]) outputMetric = False if 'workerpool' in config['crowdsim']: # do not use the crowd, use simulation, ignore AMT setting outputMetric = True with open(config['others']['input_answers']) as f: trueLabelGenerator = [int(l) for l in f] g = crowdsim.generator.GeneralGenerator(len(trueLabelGenerator), 2, trueLabelGenerator) a = constructComponent('assigner') dw = w = constructComponent('workerpool') d = constructComponent('deducer') crowdsim.linkAll(g, a, w, d) else: # initialization collect = config['others'].get('collect', False) == 'True' batchSize = int(config['others'].get('batchSize', 1)) csv = csvReader(open(config['others']['input_questions']), batchSize) amtagent = AMTAgent(config['AMT']['KeyId'], config['AMT']['SecretKey'], debug=True) hpConstructor = generateHPConstructor( csv, config['AMT_HIT']['Lifetime'], config['AMT_HIT']['LayoutId'], config['AMT_HIT']['Title'], config['AMT_HIT']['Description'],