I'm wondering how one can apply linear regression or some other method to calculate a grade/score for an input. More specifically, I'm having multiple objects in 2D-space, with some (but not all) of them belonging together and being pairs. Sometimes an object is for itself, but sometimes two objects have a relationship similar to a form (eg "Phone:" - "01234567"). In preprocessing, I'm already evaluating which of the objects might be labels and which ones are data, so I can already generate all possible label-data combinations.
I'm searching for a possibility to find out, for a given tuple of two objects, whether they belong together or not. Normally, you could solve this using a simple metric like the distance of the two objects, but I'd like to have a model that establishes its own understanding of the relationship and maybe finds other metrics for calculating whether these two objects belong together or not. Thereby the model should be able to adapt to cases where a pair is not necessarily nearest together.
Since I don't want to feed all objects at once into the model, and hence in order of being able to compare the strength/probability of two objects having such a relationship (and manually calculating all combinations between all objects), I'm looking for an algorithm that can produce a grade/score for a given tuple. Afterwards I would then be able to select the tuple with the highest score for each object and thereby find out which objects belong form-like together.
Which method is best suited for this use case? Or are there any other suggestions on how to solve this?