# An algorithm to find differences between routing paths

I need to come up with an algorithm that finds differences in the sequence of each product's routing (or sequence of processes). There are several processes aligned together and each process's been operated under specified equipment.

For example,

if there are four processes(A - B - C - D) until the final product and in each process, there are several types of equipment (for example, a1, a2, a3, a4) that operate process A.

The routing for each product can be shown below:

Process A B C D
Product1 a1 b3 c3 d2
product2 a2 b1 c2 d1
product3 a1 b2 c1 d1
product4 a1 b1 c2 d3
product5(defective) a2 b4 c3 d2
product6 a1 b3 c2 d3
product7 a1 b2 c2 d3

If it turned out product 5 to be a defective product, we may conclude that in the B process, the equipment b4 has most likely caused an issue to the product5.

I want the equipment b4 to be the output of this algorithm and maybe the most possible causes of the defective product 5.

Approach 1:

I label-encoded to each piece of equipment by column to implement an equipment learning model and calculate shapeley values for each column to see what process caused an issue. The problem is that in some cases there are few defective products that cause an extreme data imbalance between normal and faulty products' routing

So, approach 1 seems not very positive on this problem.

If you could suggest other feasible algorithms what would it be?

• I don't understand what the table is representing or what an entry like "a1" indicates. Can you state the problem clearly in the general case, without forcing us to reverse-engineer the problem statement from an example? I don't understand why you can conclude that b4 has caused the issue or what the general rule is.
– D.W.
Commented Jun 14, 2021 at 4:37
• I don't understand what your question is. You ask us to suggest feasible algorithms, but for what task? We need a clear statement of the problem. Often a good way to do that is to list the inputs to the algorithm and the desired output, with a specification of what criteria a correct output must satisfy. Can you edit your question to clarify these points?
– D.W.
Commented Jun 14, 2021 at 4:37
• @D.W. Sorry for the confusion. I edited some. Please let me know if more information is required. Commented Jun 14, 2021 at 4:46
• Is this a business question or a computer science question? Commented Aug 29, 2021 at 0:00