当前位置: 首页>>代码示例>>Python>>正文


Python Experiment.run方法代码示例

本文整理汇总了Python中experiment.Experiment.run方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.run方法的具体用法?Python Experiment.run怎么用?Python Experiment.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在experiment.Experiment的用法示例。


在下文中一共展示了Experiment.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: individualStrategies

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
def individualStrategies():
	#allxVals = {1: range(4, 10, 5), 2: range(100, 111, 10)}
	allxVals = {1: range(4, 101, 5), 2: range(100, 1001, 10)}
	allPlayerTypes = {'Random Play': players.RandomPlayer, 
					  'Honest Play': players.HonestPlayer, 
					  'Minimum Guessing': players.MinimumGuessingPlayer, 
					  'Constant Guessing': players.ConstantGuessPlayer, 
					  'Mean Guessing': players.MeanGuessPlayer, 
					  'Quantile Guessing': players.QuantileGuessPlayer,
					 }
	
	allExperimentTypes = [2]
	allStatistics = [2]

	for statistic in allStatistics:
		for experimentType in allExperimentTypes:
			xVals = allxVals[experimentType]
			for title, playerType in allPlayerTypes.items():
				playerTypes = {playerType: 1.0}
				savefile = title.replace(' ', '_')+str(experimentType)+str(statistic)+'.png'
				print "Running "+savefile

				exp = Experiment(xVals, playerTypes, experimentType, statistic)
				yVals = exp.run()
				print yVals
				plotResults(exp, yVals, title, savefile)
				print
开发者ID:tomsilver,项目名称:thesis,代码行数:29,代码来源:main.py

示例2: quantileStrategy

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
def quantileStrategy():
	xVals = [10]
	playerTypes = {players.QuantileGuessPlayer: 1.0}
	experimentType = 2
	statistic = 1
	title = "Quantile Guessing"

	exp = Experiment(xVals, playerTypes, experimentType, statistic)
	yVals = exp.run()
	print yVals
开发者ID:tomsilver,项目名称:thesis,代码行数:12,代码来源:main.py

示例3: run_model

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
def run_model():
    experiment = Experiment(model  = "../experiments/model-guthrie.json",
                            task   = "../experiments/task-guthrie.json",
                            result = "data/test-experiment-guthrie.npy",
                            report = "data/test-experiment-guthrie.txt",
                            n_session = 8, n_block = 1, seed = 1,
                            rootdir=os.path.dirname(__file__)) # for unittest and nosetests.
    records = experiment.run(session, save=True, force=True, parse=False)
    records = np.squeeze(records)
    mean = np.mean(records["best"], axis=0)[-1]
    assert mean >= 0.85
开发者ID:rougier,项目名称:basal-ganglia,代码行数:13,代码来源:test_reproduce.py

示例4: test_model

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
def test_model():
    experiment = Experiment(model  = "../experiments/model-guthrie.json",
                            task   = "../experiments/task-guthrie.json",
                            result = "data/test-experiment-guthrie.npy",
                            report = "data/test-experiment-guthrie.txt",
                            n_session = 25, n_block = 1, seed = 1,
                            rootdir=os.path.dirname(__file__))
    records = experiment.run(session, save=False, force=True, parse=False)
    records = np.squeeze(records)

    mean = np.mean(records["best"], axis=0)[-1]
    std  = np.std(records["best"], axis=0)[-1]
    print("Mean performance: %.2f ± %.2f" % (mean, std))
    print("-"*30)

    assert mean >= 0.85
开发者ID:rougier,项目名称:basal-ganglia,代码行数:18,代码来源:test-guthrie-model.py

示例5: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    exp.model["CTX:mot → STR:mot"].gain = g2
    exp.model["CTX:cog → STR:ass"].gain = g3
    exp.model["CTX:mot → STR:ass"].gain = g4
    for trial in exp.task.block(0):
        exp.model.process(exp.task, trial)
    records[1] = exp.task.records

    return records


mdl = "model-topalidou-thomas.json"
tsk = "tasks/task-topalidou.json"
rslt = folderRes + "protocol.npy"
rprt = folderRep + "protocol.txt"
experiment = Experiment(model=mdl, task=tsk, result=rslt, report=rprt, n_session=25, n_block=2, seed=377)
records = experiment.run(session, "Thomas Protocol")


# Textual results
# -----------------------------------------------------------------------------
P = np.squeeze(records["best"][:, 0, :25]) * 100
P = P.mean(axis=len(P.shape) - 1)
print("D1 start: %.3f ± %.3f" % (P.mean(), P.std()))
P = np.squeeze(records["best"][:, 0, -25:]) * 100
P = P.mean(axis=len(P.shape) - 1)
print("D1 end:   %.3f ± %.3f" % (P.mean(), P.std()))

print()

P = np.squeeze(records["best"][:, 1, :25]) * 100
P = P.mean(axis=len(P.shape) - 1)
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:33,代码来源:experiment-thomas-NoStr.py

示例6: str

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
mdl = "model-topalidou.json"

revr = [1050]# [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1250, 1300, 1350, 1400, 1450, 1500]
#, 1100, 1200, 1300, 1400, 1500, 1550]#10,50,
# revr = [300]
for i in revr:
    trial = str(i)
    tsk = "tasks/task-topalidou-reverse-" + trial + ".json"
    rslt = folderRes + trial + ".npy"
    rprt = folderRep + trial + ".txt"
    experiment = Experiment(model = mdl,
                            task = tsk,
                            result = rslt,
                            report = rprt,
                            n_session = 25, n_block = 1, seed = None)#None)
    records = experiment.run(session, "Protocol Reverse")
    records = np.squeeze(records)

    # -----------------------------------------------------------------------------
    w = 5
    start,end = experiment.task.blocks[0]
    P = np.mean(records["best"][:,end-w:end],axis=1)
    mean,std = np.mean(P), np.std(P)
    print("Acquisition (HC):  %.2f ± %.2f" % (mean,std))

    start,end = experiment.task.blocks[1]
    P = np.mean(records["best"][:,end-w:end],axis=1)
    mean,std = np.mean(P), np.std(P)
    print("Test (HC, GPi On): %.2f ± %.2f" % (mean,std))

开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:31,代码来源:experiment-reverse.py

示例7: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    records[1] = exp.task.records


    return records


mdl = "model-topalidou-thomas.json"
tsk = "tasks/task-thomas.json"
rslt = folderRes + "NoStrMot.npy"
rprt = folderRep + "NoStrMot.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session = 25, n_block = 2, seed=377)
records = experiment.run(session, "Thomas Protocol No Str Mot")


# Textual results
# -----------------------------------------------------------------------------
P = np.squeeze(records["best"][:,0,:25])*100
P = P.mean(axis=len(P.shape)-1)
print("D1 start: %.3f ± %.3f" % (P.mean(), P.std()))
P = np.squeeze(records["best"][:,0,-25:])*100
P = P.mean(axis=len(P.shape)-1)
print("D1 end:   %.3f ± %.3f" % (P.mean(), P.std()))

print()

P = np.squeeze(records["best"][:,1,:25])*100
P = P.mean(axis=len(P.shape)-1)
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:33,代码来源:experiment-thomas-NoStr-Mot-piron.py

示例8: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
        exp.model.process(exp.task, trial)
    records[2] = exp.task.records

    return records


mdl = "model-topalidou.json"
tsk = "tasks/task-topalidou.json"
rslt = folderRes + "protocol-2.npy"
rprt = folderRep + "protocol-2.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session = 25, n_block = 3, seed=927)
records = experiment.run(session, "Topalidou Protocol 2")


# Textual results
# -----------------------------------------------------------------------------
P = np.squeeze(records["best"][:,0,:25])
P = P.mean(axis=len(P.shape)-1)
print("D1 start: %.3f ± %.3f" % (P.mean(), P.std()))
P = np.squeeze(records["best"][:,0,-25:])
P = P.mean(axis=len(P.shape)-1)
print("D1 end:   %.3f ± %.3f" % (P.mean(), P.std()))

P = np.squeeze(records["RT"][:,0])
print("D1 mean RT: %.3f ± %.3f" % (P.mean(), P.std()))

print()
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:33,代码来源:experiment-topalidou-protocol-2.py

示例9: count_cross_possibilities

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
##########
all_cross_params = hyper_params['shared_cross_params']
del hyper_params['shared_cross_params']
n_shared_cross = count_cross_possibilities(all_cross_params)
cross_params = {
    'log_low_alpha': [-6],
    'log_high_alpha': [6],
    'n_alphas': [99],
    'momentum': [0.95],
    'delta': [1e-8],
}
all_cross_params.update(cross_params)
priority = 1
hyper_param_dicts = append_dicts(hyper_params, cross_dict(all_cross_params))

# extend corssed params with extra values (e.g. 'weight_filler_name')
hyper_param_dicts = [param_extender(hpd) for hpd in hyper_param_dicts]


##################
# run experiment #
##################
if DRY_RUN:
    print_hyper_param_dicts(n_shared_cross, all_cross_params, hyper_param_dicts, algorithm_template)
    print 'Exiting'
    exit()

e = Experiment(use_sge=True, DEBUG_MODE=False)
e.run(experiment_base_name, problem_template, algorithm_template, hyper_param_dicts,
      offer_compatible_runs=False, priority=priority)
开发者ID:kevinbache,项目名称:caffe_cluster_experiments,代码行数:32,代码来源:adl.py

示例10: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
        exp.model.process(exp.task, trial)
    records[1] = exp.task.records

    return records


mdl = "model-topalidou.json"
tsk = "tasks/task-topalidou.json"
rslt = folderRes + "control.npy"
rprt = folderRep + "control.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session = 25, n_block = 2, seed = 123)
records = experiment.run(session, "Topalidou Control")



# Textual results
# -----------------------------------------------------------------------------
P = np.squeeze(records["best"][:,0,:25])
P = P.mean(axis=len(P.shape)-1)
print("D1 start: %.3f ± %.3f" % (P.mean(), P.std()))
P = np.squeeze(records["best"][:,0,-25:])
P = P.mean(axis=len(P.shape)-1)
print("D1 end:   %.3f ± %.3f" % (P.mean(), P.std()))

P = np.squeeze(records["RT"][:,0])
print("D1 mean RT: %.3f ± %.3f" % (P.mean(), P.std()))
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:32,代码来源:experiment-topalidou-control.py

示例11: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    for trial in exp.task.block(1):
        exp.model.process(exp.task, trial)

    return exp.task.records


mdl = "model-topalidou-thomas.json"
tsk = "tasks/task-thomas.json"
rslt = folderRes + "NoStrAss-control.npy"
rprt = folderRep + "NoStrAss-control.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session = 25, n_block = 1, seed = 1)
records = experiment.run(session, "Thomas Protocol without Str Ass Control")
records = np.squeeze(records)



# Textual results
# -----------------------------------------------------------------------------
w = 25
start,end = experiment.task.blocks[0]
P = np.mean(records["best"][:,end-w:end],axis=1)
mean,std = np.mean(P), np.std(P)
print("Performances:")
print("--------------------------------------")
print("Training (HC, GPi On):  %.2f ± %.2f" % (mean,std))

start,end = experiment.task.blocks[1]
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:33,代码来源:experiment-thomas-NoStr-Ass-control-piron.py

示例12: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    # Day 2: GPi OFF
    exp.model["GPi:cog → THL:cog"].gain = 0
    exp.model["GPi:mot → THL:mot"].gain = 0
    for trial in exp.task:
        exp.model.process(exp.task, trial)
    records[1] = exp.task.records

    return records


experiment = Experiment(model = "model-topalidou.json",
                        task = "task-topalidou.json",
                        result = "data/experiment-topalidou-protocol-1.npy",
                        report = "data/experiment-topalidou-protocol-1.txt",
                        n_session = 25, n_block = 2, seed = None)
records = experiment.run(session, "Protocol 1")

# Save performance (one column per session)
# -----------------------------------------------------------------------------
# P = np.squeeze(records["best"][:,0])
# np.savetxt("data/experiment-topalidou-protocol-1-D1-P.csv", P.T, fmt="%d", delimiter=",")
# P = np.squeeze(records["best"][:,1])
# np.savetxt("data/experiment-topalidou-protocol-1-D2-P.csv", P.T, fmt="%d", delimiter=",")
# P = np.squeeze(records["RT"][:,0])
# np.savetxt("data/experiment-topalidou-protocol-1-D1-RT.csv", P.T, fmt="%.4f", delimiter=",")
# P = np.squeeze(records["RT"][:,1])
# np.savetxt("data/experiment-topalidou-protocol-1-D2-RT.csv", P.T, fmt="%.4f", delimiter=",")

# Textual results
# -----------------------------------------------------------------------------
P = np.squeeze(records["best"][:,0,:25])
开发者ID:humm,项目名称:basal-ganglia,代码行数:33,代码来源:experiment-topalidou-protocol-1.py

示例13: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    for trial in exp.task.block(2):
        exp.model.process(exp.task, trial)

    return exp.task.records


mdl = "model-topalidou.json"
tsk = "tasks/task-piron.json"
rslt = folderRes + "control.npy"
rprt = folderRep + "control.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session = 25, n_block = 1, seed = 508)
records = experiment.run(session, "Piron Protocol Control")
records = np.squeeze(records)


# Textual results
# -----------------------------------------------------------------------------
w = 25
start,end = experiment.task.blocks[0]
P = np.mean(records["best"][:,start:start+w],axis=1)
print("D1 start: %.3f ± %.3f" % (P.mean(), P.std()))
P = np.mean(records["best"][:,end-w:end],axis=1)
print("D1 end:   %.3f ± %.3f" % (P.mean(), P.std()))

P = np.mean(records["RT"][:,:],axis=1)
print("D1 mean RT: %.3f ± %.3f" % (P.mean(), P.std()))
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:32,代码来源:experiment-piron-control.py

示例14: Experiment

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
    exp.model.setup()
    for trial in exp.task:
        exp.model.process(exp.task, trial)
    return exp.task.records


mdl = "model-topalidou.json"
tsk = "tasks/task-guthrie.json"
rslt = folderRes + "control.npy"
rprt = folderRep + "control.txt"
experiment = Experiment(model = mdl,
						task = tsk,
						result = rslt,
						report = rprt,
                        n_session=25, n_block=1, seed=960)
records = experiment.run(session)
records = np.squeeze(records,"Guthrie Protocol")

#
# # Textual results
# # -----------------------------------------------------------------------------
P = records["best"]
P_mean = np.mean(P, axis=0)
P_std = np.std(P, axis=0)
print("Performances")
print("---------------------")
print("Start: %.3f ± %.3f" % (P_mean[:25].mean(), P_std[:25].mean()))
print("End:   %.3f ± %.3f" % (P_mean[-25:].mean(), P_std[-25:].mean()))


print("\n\n\nReaction time")
开发者ID:mtopalid,项目名称:Topalidou-et-al-2016,代码行数:33,代码来源:experiment-guthrie.py

示例15: Sketch

# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import run [as 别名]
class Sketch (EventEmitter):
	""" This object is the representation of the persistent sketch,
	stored in the database and in the event store. """

	# We will use a file based event store for now, then migrate to EventStore later.

	db = None
	dataDir = None

	@classmethod
	def createId (cls):
		id = str(uuid.uuid4())
		created_date = now()

		# Check that the UUID is not already used. I am sure this is probably unnecessary by definition...
		#rows = cls.db.runQuery("SELECT guid FROM sketches WHERE guid = ?", (id,))
		#if len(rows) == 0:
		#	break

		# Insert the new sketch into the DB
		def _done (result):
			return id

		return cls.db.runOperation("""
				INSERT INTO sketches
				(guid, title, user_id, created_date, modified_date, deleted)
				VALUES (?, ?, ?, ?, ?, 0)
			""",
			(id, "New Sketch", 1, created_date, created_date)
		).addCallback(_done)

	@classmethod
	def exists (cls, id):
		d = cls.db.runQuery("SELECT guid FROM sketches WHERE guid = ?", (id,))
		d.addCallback(lambda r: len(r) > 0)

		return d

	@classmethod
	def delete (cls, id):
		return cls.db.runOperation("UPDATE sketches SET deleted = 1 WHERE guid = ?", (id, ))

	@classmethod
	def restore (cls, id):
		return cls.db.runOperation("UPDATE sketches SET deleted = 0 WHERE guid = ?", (id, ))

	def __init__ (self, id):
		self.id = id
		self.title = ""
		self.user_id = 1
		self.loaded = False
		self.workspace = Workspace()
		self.experiment = None
		self.subscribers = {}
		self._eventIndex = 0

		self._sketchDir = FilePath(self.dataDir).child(id)
		if not self._sketchDir.exists():
			self._sketchDir.createDirectory()

		eventFile = self._sketchDir.child("events.log")
		if not eventFile.exists():
			eventFile.create()

		self._eventsLog = eventFile.open('a')

	def load (self):
		return self._loadFrom(self.id)

	def copyFrom (self, id):
		return self._loadFrom(id, copy = True)

	@defer.inlineCallbacks
	def _loadFrom (self, id, copy = False):
		sketch = yield self.db.runQuery(
			"SELECT title FROM sketches WHERE guid = ?",
			(id, )
		)

		if len(sketch) == 0:
			raise Error("Sketch %s not found." % id)

		self.title = sketch[0][0]
		self.loaded = True

		# Find the most recent snapshot file
		try:
			sketchDir = FilePath(self.dataDir).child(id)
			max_snap = max(map(
				lambda fp: int(
					os.path.splitext(fp.basename())[0].split('.')[1]
				),
				sketchDir.globChildren('snapshot.*.log')
			))

			log.msg(
				"Found snapshot {:d} for sketch {:s}".format(
					max_snap,
					id
				)
#.........这里部分代码省略.........
开发者ID:richardingham,项目名称:octopus-editor-server,代码行数:103,代码来源:sketch.py


注:本文中的experiment.Experiment.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。