Buckets:
| import pandas as pd, numpy as np | |
| df = pd.read_parquet("/domains/omnibrain-multi/index_timeseries.parquet") | |
| print("="*76) | |
| print("验证 reg refines src 的机制") | |
| print("="*76) | |
| # 每个 region 是否只在单一 source 出现 | |
| g = df.groupby(df.region.fillna("__NA__"))["source"].nunique() | |
| print(f"region 类总数: {len(g)}") | |
| print(f"跨多个 source 的 region: {(g>1).sum()}") | |
| if (g>1).any(): | |
| print(" 跨源 region:", g[g>1].to_dict()) | |
| print() | |
| print("各 source 的 region 集合(是否重名):") | |
| seen = {} | |
| for src, s in df.groupby("source"): | |
| r = set(s.region.dropna().unique()) | |
| print(f" {src:<22} {len(r):>3} 个 region") | |
| seen[src] = r | |
| srcs = list(seen) | |
| for i in range(len(srcs)): | |
| for j in range(i+1, len(srcs)): | |
| inter = seen[srcs[i]] & seen[srcs[j]] | |
| if inter: | |
| print(f" ⚠️ 重名 {srcs[i]} ∩ {srcs[j]} = {sorted(inter)[:5]} ({len(inter)} 个)") | |
| print() | |
| print("="*76) | |
| print("species × modality 交叉(为何不可交换)") | |
| print("="*76) | |
| ct = pd.crosstab(df.species, df.modality) | |
| print(ct.to_string()) | |
| print() | |
| print(" → 人类同时有两种模态,所以 species 与 modality 不可比") | |
| print() | |
| print("="*76) | |
| print("poset 覆盖关系(cover relations)") | |
| print("="*76) | |
| A = ["source","species","modality","region","domain_l1"] | |
| def refines(a,b): | |
| d = pd.DataFrame({"a":a.fillna("__NA__"),"b":b.fillna("__NA__")}) | |
| return (d.groupby("a")["b"].nunique()>1).sum()==0 | |
| mat = {} | |
| for x in A: | |
| for y in A: | |
| if x!=y: mat[(x,y)] = refines(df[x], df[y]) | |
| # cover: a < b 且没有 c 使 a < c < b | |
| covers = [] | |
| for x in A: | |
| for y in A: | |
| if x==y: continue | |
| if not mat.get((x,y)): continue | |
| if mat.get((y,x)): continue # 等价 | |
| # 检查是否有中间元 | |
| mid = [z for z in A if z not in (x,y) | |
| and mat.get((x,z)) and mat.get((z,y)) | |
| and not mat.get((z,x)) and not mat.get((y,z))] | |
| if not mid: | |
| covers.append((x,y)) | |
| for a,b in sorted(covers): | |
| print(f" {a:<11} < {b}") | |
Xet Storage Details
- Size:
- 2.04 kB
- Xet hash:
- 9ddb8718f72cd2c8a707fbf7c36ef6cb5fc762294f7e596b4d2accae87ed1079
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.