The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Select Most Similar Items

alidehghanalidehghan Member Posts: 5 Contributor II
edited November 2018 in Help
Hi Everyone,

I have constructed a similarity matrix (as mentioned in the paper you linked) for purchase items, and now I need to select K-Nearest Neighbors for them, but I don't know how can I select it. For example I have a matrix like it:

            Item1  Item2  Item3  Item 4  Item5
Item1    1        0.97    0.87    0.95    0.92
Item2    0.97  1        0.78    0.89    0.5
Item3    0.87  0.78    1        0.96    0.87
Item4    0.96  0.89    0.96    1        0.77
Item5    0.92  0.5      0.87    0.77    1

And "Active User" has purchased "Item1, Item4", and if consider K=2, I need to iterate on Item1 and Item4 and select most similar items (Top-N Algorithm), in my case "Item2,Item5" are chosen as candidate. I should add them to a queue and do this for next purchased item "Item4" => "Item3,Item2"

So my recommendation queue contains "Item2,Item5,Item3" and then I should order it by their similarity values "(0.97+0.89),0.92,0.96" and select K=2 items => Item2,Item3... so my recommendation for "Item1,Item4" is "Item2,Item3"

Please guide me which operators I should use to select Top-N items for a specific item...

Thanks all in advance

Answers

  • alidehghanalidehghan Member Posts: 5 Contributor II
    No Reply?
  • haddockhaddock Member Posts: 849 Maven
    Can you not tell?
  • alidehghanalidehghan Member Posts: 5 Contributor II
    Pardon me?
  • haddockhaddock Member Posts: 849 Maven
    Pardon me?
    What for?

    Not quite sure about what exactly you need, but the this may help..
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.0.8" expanded="true" name="Process">
        <process expanded="true" height="359" width="908">
          <operator activated="true" class="retrieve" compatibility="5.0.8" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="multiply" compatibility="5.0.8" expanded="true" height="94" name="Multiply" width="90" x="246" y="30"/>
          <operator activated="true" class="cross_distances" compatibility="5.0.8" expanded="true" height="94" name="Cross Distances" width="90" x="380" y="30">
            <parameter key="only_top_k" value="true"/>
            <parameter key="k" value="3"/>
          </operator>
          <operator activated="true" class="sort" compatibility="5.0.8" expanded="true" height="76" name="Sort" width="90" x="581" y="30">
            <parameter key="attribute_name" value="request"/>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Multiply" to_port="input"/>
          <connect from_op="Multiply" from_port="output 1" to_op="Cross Distances" to_port="request set"/>
          <connect from_op="Multiply" from_port="output 2" to_op="Cross Distances" to_port="reference set"/>
          <connect from_op="Cross Distances" from_port="result set" to_op="Sort" to_port="example set input"/>
          <connect from_op="Sort" from_port="example set output" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
  • alidehghanalidehghan Member Posts: 5 Contributor II
    Thanks haddock for your guide...

    Might you please tell me how can I do so with SimilarityMatrix and input items (As I described before)

    Thanks for your help
  • haddockhaddock Member Posts: 849 Maven
    Have you considered paying RM to do some consultancy?
  • alidehghanalidehghan Member Posts: 5 Contributor II
    I am just working on my thesis... This is an absolute academic job.

    So, please help me on it.
  • haddockhaddock Member Posts: 849 Maven
    You can work from my code to your answer by getting good at looping, macros, and collections. These operator groups require some work to understand, so the best thing is to get stuck in to the examples and the tutorials, if only to see whether you actually have the time that would be necessary.
Sign In or Register to comment.