给定输入和期望的输出,找出所需的转换

发布于 2024-08-04 11:23:00 字数 423 浏览 6 评论 0原文

我想要一个程序能够实现我在​​标题中所说的功能。

我意识到这是一个相当模糊的问题。我还意识到,弄清楚如何将任何输入转换为任何输出几乎是不可能的,但处理一些简单的情况似乎应该是可行的。

提供一个具体的例子(用Python):

>>> def find_transform(start, desired):
>>>     # Insert magic here

>>> find_trasform([1,2,3], [3,2,1])
"reverse"

>>> find_trasform([1,2,3,4], [[1,2], [3,4]])
"divide 2"

我怀疑有一个官方的词来形容这类事情,但我不知道它是什么。

I want a program that does what I said in the title.

I realize that this is a pretty vague problem. I also realize that figuring out how to transform any input into any output is nearly impossible, but it seems like handling some simple cases should be feasible.

To provide a concrete example (in Python):

>>> def find_transform(start, desired):
>>>     # Insert magic here

>>> find_trasform([1,2,3], [3,2,1])
"reverse"

>>> find_trasform([1,2,3,4], [[1,2], [3,4]])
"divide 2"

I suspect there's an official word for this sort of thing, but I don't know what it is.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只等公子 2024-08-11 11:23:00

这个术语叫做数据映射。这是一个广阔的领域,可以满足多种目的,包括您的目的。

用于此类任务的工具很难掌握,因此不要指望这很容易。对于这种特定情况,您将寻找数据驱动的映射方法。这些涉及结合启发式统计来查找相关关系。

值得庆幸的是,您的示例在数学上得到了很好的表达,并且对于数据集的每个元素都保持正确。因此,您可以通过尝试分析配对元素之间的数学关系并尝试验证剩余对上找到的任何关系来开始解决此问题。

编辑:最后一个示例添加了一个新维度。所以这也必须是可观察到的。如果你坚持组之间的渐进关系,就像那里的情况一样(首先在组 1 和 2 之间建立关系,然后在组 2 和 3 之间建立关系),一切都会好起来的。它甚至可能有助于更快地证明关系,因为您不需要经常递归。但集合之间更复杂的关系可能会迫使您处理更复杂的问题。尽量保持简单。

Well, the term is called Data Mapping. It's a vast field that can serve a few purposes, including yours.

The tools for such a task are hard to master, so don't expect this to be easy. For this specific case, you will be looking for Data-Driven Mapping methodologies. These involve a combination of heuristics and statistics to find the relevant relationships.

Thankfully your examples are well expressed mathematically and will remain true for every element of the data sets. So you can start tackling this problem by trying to analyze mathematical relationships between paired elements and trying to validate any found relationships on the remaining pairs.

EDIT: The last example adds a new dimension. So this must be observable too. If you stick to a progressive relationship between sets as is the case there (first establish relationship between set 1 and 2, then between set 2 and 3) all will be well. It may even help to more quickly prove a relationship since you don't need to recurse so often. But more complex relationships between sets may force you into a much more complex problem to handle. Try to keep it simple.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文