fix(spatial): 把因果变量变成分布,让同族内两个标签并存
反复出现的同一个病:每加一族,模型就换一条按域的常量规则。原因是同族内因果变量
是固定的——"有接触"和"接触吃得上力"在家族内部是同一件事,于是恒答一行就能fit。
- 稳定性:上块 T 的 xy 从 {-13,-6,0,3,6,13}x{-9,0,0,0,9} 抽取,形心有时落在重叠
矩形之外,接触存在但不吃载,同族内真/假并存。
- 自由度:六个配合的轴向从六个自由度里抽,有时只覆盖五个(重复一个、缺一个),
实体数与边数完全不变。
- 七配合的家族保持冗余件在最后,删它依然无害。
This commit is contained in:
1 parent
8ab284e146
commit
32819042e5
1 file changed
+22
-3
+22
-3
@@ -144,15 +144,22 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
||||
# nothing. Without it "something was removed" and "the target lost support"
|
||||
# are the same event on every sample, and a one-bit rule fits the whole
|
||||
# family -- measured: that rule scores 1.000 here while knowing no physics.
|
||||
# the causal variable is drawn, not fixed. Until it was, "there is a contact"
|
||||
# and "the contact carries load" were the same event inside the family, so a
|
||||
# constant answer fit it and the model never had to look at geometry -- which
|
||||
# is exactly what the report kept showing.
|
||||
dx = rng.choice((-13, -6, 0, 3, 6, 13))
|
||||
dy = rng.choice((-9, 0, 0, 0, 9))
|
||||
ents = [Entity("G", "ground", attrs={"plane": 0}),
|
||||
Entity("P", "block", attrs={"box": [40, 40, 0, 60, 60, 20]}),
|
||||
Entity("T", "block", attrs={"box": [42, 42, 20, 58, 58, 36]}),
|
||||
Entity("T", "block", attrs={"box": [42 + dx, 42 + dy, 20, 58 + dx, 58 + dy, 36]}),
|
||||
Entity("D", "block", attrs={"box": [80, 40, 0, 100, 60, 16]})]
|
||||
edges = [Edge("kPG", "contact", "P", "G"), Edge("kPT", "contact", "T", "P"),
|
||||
Edge("kDG", "contact", "D", "G")]
|
||||
top = None
|
||||
if n_blocks >= 3:
|
||||
ents.append(Entity("U", "block", attrs={"box": [44, 44, 36, 56, 56, 48]}))
|
||||
ents.append(Entity("U", "block",
|
||||
attrs={"box": [44 + dx, 44 + dy, 36, 56 + dx, 56 + dy, 48]}))
|
||||
edges.append(Edge("kTU", "contact", "U", "T"))
|
||||
top = "U"
|
||||
vis_edges = {e.eid for e in edges}
|
||||
@@ -185,7 +192,19 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0):
|
||||
|
||||
|
||||
def _build_freedom(rng, n_cons: int, hidden: int):
|
||||
axes = list(DOF_AXES) + ["tz"] # a 7th constraint repeats tz: redundant
|
||||
# the axes are drawn, so a family spans both verdicts with the same entity
|
||||
# count: six mates that cover every axis lock the part, six that cover five
|
||||
# do not, and the difference is invisible from the shape of the scene
|
||||
axes = list(DOF_AXES)
|
||||
if n_cons == 7:
|
||||
rng.shuffle(axes)
|
||||
axes = axes + [rng.choice(axes)] # a redundant 7th mate, last
|
||||
else:
|
||||
if rng.random() < 0.5: # drop one, repeat another
|
||||
drop = rng.randrange(len(axes))
|
||||
dup = rng.choice([a for i, a in enumerate(axes) if i != drop])
|
||||
axes = [a for i, a in enumerate(axes) if i != drop] + [dup]
|
||||
rng.shuffle(axes)
|
||||
ents = [Entity("P", "part", attrs={"x": 0, "y": 0, "z": 0})]
|
||||
edges, visible = [], set()
|
||||
for i in range(n_cons):
|
||||
|
||||
Reference in new issue
Block a user