Exemple #1
0
	ys1 = []
	ys2 = []
	tally = []
	for r in range(r_start, r_end + 1):
		total = 0
		maximum = 0
		count = 0
		worker = Worker(str(uuid.uuid1()), 0, p, r, 1, 1)
		worker.addNoise(0, 0.1)
		for i in range(0, runs):
			ts = []
			cs = []
			for j in range(0, horizon):
				task = tasks[j]
				answer = worker.doTask(task, outcomes)
				if answer == task:
					count += 1
				ts.append(j + 1)
				cs.append(count)
				learning = learn.learnCurve(cs, ts)
				err = learning['e']
				#print err
				#print learning['r']
				if math.isnan(err):
					continue
				if err < threshold:
					total += j + 1
					tally.append(j+1)
					if j + 1 > maximum:
						maximum = j + 1
Exemple #2
0
	cqs = [] #cumulative quality
	qs = [] #quality


	aqs = [] #average quality
	ecqs = [] #estimated by linear regression
	eqs = [] #estimated by linear regression
	fqs = []
	###for learning
	cs = []
	ts = []
	errs = []
	count = 0
	for i in range(0, len(tasks)):
		task = tasks[i]
		answer = worker.doTask(task)
		if answer == task:
			count += 1
		cqs.append(worker.getCumulativeQuality(i + 1))
		qs.append(worker.getQuality())
		aqs.append(float(count) / float(i + 1))
		#learn
		ts.append(i + 1)
		cs.append(count)
		learning = learn.learnCurve(cs, ts)
		fake = Worker(str(uuid.uuid1()), i+1, learning['p'], learning['r'], 1, 1)
		ecqs.append(fake.getCumulativeQuality(i+1))
		eqs.append(fake.getQuality())
		errs.append(learning['e'])
		if i == 0:
			fqs.append(float(count) / float(i+1))