Skip to main content
edited tags
Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Tweeted twitter.com/#!/StackMma/status/533503945134469120
example appended, small improvement in layout
Source Link
pgblu
  • 249
  • 1
  • 9

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.

Seeking the function Foo

In[1]:= bar = RandomInteger[9, {6, 4}]
Out[1]= {{6, 6, 1, 5}, {4, 0, 9, 3}, {0, 4, 2, 9},
          {4, 6, 0, 6}, {2, 5, 4, 8}, {4, 1, 9, 1}}

In[2]:= Foo[%]
Out[2]= {{4, 0, 9, 3}, {0, 4, 2, 9}}

In[3]:= Foo[bar]
Out[3]= {bar[1], bar[2]}

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.

Seeking the function Foo

In[1]:= bar = RandomInteger[9, {6, 4}]
Out[1]= {{6, 6, 1, 5}, {4, 0, 9, 3}, {0, 4, 2, 9},
          {4, 6, 0, 6}, {2, 5, 4, 8}, {4, 1, 9, 1}}

In[2]:= Foo[%]
Out[2]= {{4, 0, 9, 3}, {0, 4, 2, 9}}

In[3]:= Foo[bar]
Out[3]= {bar[1], bar[2]}
added 160 characters in body
Source Link
pgblu
  • 249
  • 1
  • 9

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

I have a 444-member array of arrays called final, with each subarray containing 12 integer members. How can I do a pairwise comparison of the contents of the subarrays to find all pairs with 11 members in common ; failing that, all those with 10 in common ; etc. ?

Is there a built-in similarity measure for numeric arrays?

EDIT for clarity : I would be happy if the function returned the pair with maximum similarity, or an array of such pairs in the case of a multi-way tie.

Source Link
pgblu
  • 249
  • 1
  • 9
Loading