TensorFlow:根据特征条件变换张量

发布于 2025-01-11 14:19:56 字数 957 浏览 0 评论 0原文

非常感谢您阅读我的问题。我对 TensorFlow 很陌生,很抱歉,如果我的问题完全没有意义,我有这个回归问题:

A = Input(shape=(8))
A0 = A[:,0:4]
A1 = A[:,4:8]
A0 = layers.Dense(12)(A0)
A1 = layers.Dense(12)(A1)
Z = layers.Concatenate()([A0,A1])
Z = layers.Dense(1)(Z)
model = Model(inputs=A, outputs=Z)

其中输入有两组特征,观察 A0 && A1 即来自两个独立设备的[温度、湿度、紫外线、污染物]

  1. 如果我知道这两个集合之间存在相互依赖关系,并且我想根据 Dense()(A1) 的输出来转换 A0喜欢----> A0 取决于 [A1 ?!@?#-> 中找到的功能A0]
  2. 并且我还希望最后一层 Z 仅取决于 A0

我应该使用什么样的方法?这样的事情有意义吗?或 Tf.Cond 或 if 条件?

A0 = layers.Dense(12)(A0)
A1 = layers.Dense(12)(A1)
Z = layers.Concatenate()([A0,A1])
Z = layers.Dense(12)(Z)
Z = A0 + Z
Z = layers.Dense(1)(Z)

我正在寻找看起来更好看和优雅的东西,或者您可以指出一条路径,例如我可以查看的一些相关研究吗?

我认为我的主要问题是我什至不知道该看什么,因为它不完全是 if 条件/tf.case 问题

非常感谢您的时间

非常感谢

Thank you very much for reading my question. I'm quite new to TensorFlow so sorry if my problem doesn't completely make sense, I have this regression problem :

A = Input(shape=(8))
A0 = A[:,0:4]
A1 = A[:,4:8]
A0 = layers.Dense(12)(A0)
A1 = layers.Dense(12)(A1)
Z = layers.Concatenate()([A0,A1])
Z = layers.Dense(1)(Z)
model = Model(inputs=A, outputs=Z)

wherein the input there are two sets of features, observation A0 && A1 ie.[temperature, humidity, UV, pollutants] from two separate devices.

  1. if I knew there is an interdependency between these two sets and I want to transform A0 based on the output of Dense()(A1) something like ----> A0 depends on the features found within [A1 ?!@?#-> A0]
  2. and I also want final layer Z to only depends on A0

what kind of method should I use? would something like this make sense? or Tf.Cond or if conditions?

A0 = layers.Dense(12)(A0)
A1 = layers.Dense(12)(A1)
Z = layers.Concatenate()([A0,A1])
Z = layers.Dense(12)(Z)
Z = A0 + Z
Z = layers.Dense(1)(Z)

I'm looking for something that seems better looking and elegant, or may you please point out a path like some relevant studies that I can look at?

I think my main problem is I don't even know what to look at, as it is not exactly an if condition/tf.case problem

Thank you very much for your time

Many Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文