本文整理汇总了Python中experiment.Experiment.assign方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.assign方法的具体用法?Python Experiment.assign怎么用?Python Experiment.assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类experiment.Experiment
的用法示例。
在下文中一共展示了Experiment.assign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CounterbalanceTestCase
# 需要导入模块: from experiment import Experiment [as 别名]
# 或者: from experiment.Experiment import assign [as 别名]
class CounterbalanceTestCase(unittest.TestCase):
def set_up(self):
color = {}
shape = {}
shape["choices"] = ["square", "circle"]
shape["conditioned_on"] = []
shape["name"] = "shape"
color["choices"] = ["green", "blue"]
color["conditioned_on"] = [shape]
color["name"] = "color"
self.e = Experiment([color, shape])
def test_dict(self):
a = self.e.assign(1)
b = self.e.assign(2)
assert a == b
def test_dist(self):
for i in range(100):
self.e.assign(i)
assert self.e.params[0]["dist"]["blue"] == 50