我可以使用什么匹配算法?

What matching algorithm could I use?

我需要一些帮助,因为我不知道我可以使用什么算法来执行以下操作(我使用 python):

============================================= =======

我想使用一种匹配算法来检测具有相同饮品偏好和相近年龄的用户。继续这个例子,Steve 和 Maria 会被匹配在一起,但 Juan 不会。我应该使用哪一个?

我同意@klutt 的观点,您的任务非常模糊。我想到了两种方法,但不知道有关您的问题的更多详细信息确实限制了我可以在答案中提供的对您有帮助的详细信息。我正在解释这个问题,就好像你正在接受原始文本并且可能想要处理更多具有非常相似的语义和句法结构的句子。

一种算法方法: 假设您的单词选择在语义上是静态的(Maria is 23 ... Steve is 25),我们可以解析每个句子并识别像 isandsame 这样的标记,基本上对文本进行词法分析......从这里,你可以继续考虑你将如何进行匹配等等......但这相当复杂......

神经网络方法: 如果您以句子的形式接收原始文本,那么使用自上而下的算法方法无法直接解决这个问题。 您可以采用神经网络的方法来训练模型来解决您的问题,但是您似乎要问的又是相当复杂的,因为每个句子中都有多个在语义上不相关的“事实”。例如,您的第二句话指出 Maria 是 23 岁,但在该句子的末尾对 Steve 和 Maria 进行了比较。你的第一句话只将史蒂夫确定为 25 岁。 即使您将原始文本分块成句子,您也必须拥有非常精细的神经网络架构和大量训练数据才能远远接近您的目标。


现在,这两种解决方案都非常复杂......但是如果您想创建一个应用程序来收集这些数据(通过表单或提示)并将其放入结构化格式(如 json 或 xml 对象)来组织数据并将其存储在内存中(可能写出到数据库或文件以进行持久存储),这可能是一个很好的下降途径。

这也可以作为如何思考数据的一个很好的教训。如果你有成千上万的句子,只是为了定量目的需要组织的原始数据(经典的定性 -> 定量问题),这是一回事。如果您要收集这些数据,那就是另一回事了。如果你要收集数据,有一个程序来收集和组织姓名、年龄和饮酒偏好(然后在某些数据结构中组织这些数据),那么我们可以谈谈匹配算法。

我还要在这里补充一点,如果您确实有结构化数据,Collaborative filtering(Shridhar 提到)是一个很好的起点。

Collaborative filtering最适合您的需求。

In the newer, narrower sense, collaborative filtering is a method of making automatic predictions (filtering) about the interests of a user by collecting preferences or taste information from many users (collaborating). The underlying assumption of the collaborative filtering approach is that if a person A has the same opinion as a person B on an issue, A is more likely to have B's opinion on a different issue than that of a randomly chosen person. For example, a collaborative filtering recommendation system for television tastes could make predictions about which television show a user should like given a partial list of that user's tastes (likes or dislikes).[3] Note that these predictions are specific to the user, but use information gleaned from many users. This differs from the simpler approach of giving an average (non-specific) score for each item of interest, for example based on its number of votes.