# 归一化恢复
def normalized_back(y_train_tag, max_value, min_value):
    # 假设 args.tag_len 是已知的,且 min_value 和 max_value 已经计算得到
    y_train_restored = y_train_tag.astype(float)  # 将整数转换为浮点数
    y_train_restored = y_train_restored * (max_value - min_value)  # 恢复原始的比例
    y_train_restored = y_train_restored + min_value  # 恢复原始的最小
    return y_train_restored
 
# crf 用到的tag标签
min_value = np.min(y_train)
max_value = np.max(y_train)
normalized_y_train = (y_train - min_value) / (max_value - min_value)
# y标签 ,需要投射到 整数上的crf的标签
y_train_tag = (np.array(normalized_y_train) * (args.tag_len - 1)).astype(int)  # 假设这是你的原始NumPy数组
y_train_tag = torch.tensor(y_train_tag, dtype=torch.float32).to(device)
 
# 归一化恢复  这个是 投射到100个标签回溯 
def normalized_back(y_train_tag, max_value, min_value):
    # 假设 args.tag_len 是已知的,且 min_value 和 max_value 已经计算得到
    y_train_restored = y_train_tag.astype(float)  # 将整数转换为浮点数
    y_train_restored = y_train_restored / (args.tag_len - 1)  # 逆转归一化的过程
    y_train_restored = y_train_restored * (max_value - min_value)  # 恢复原始的比例
    y_train_restored = y_train_restored + min_value  # 恢复原始的最小
    return y_train_restored