<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Retrieve and modify latent feature vectors on the fly ? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25988#M18252</link>
    <description>&lt;P&gt;Yes, it becomes a new "row" in Y. The candidate filter is something else. This line of code is like a callback notifying the implementation that a new item exists. New users also cause a new row in X, but there is no equivalent 'candidate filter' for users because the same types of operations (recommend, etc.) are not supported for users.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Mar 2015 09:02:40 GMT</pubDate>
    <dc:creator>srowen</dc:creator>
    <dc:date>2015-03-29T09:02:40Z</dc:date>
    <item>
      <title>Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/20846#M18241</link>
      <description>&lt;P&gt;Sean,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;We are investigating the ways to retrieve and modify the latent feature vectors on the fly...&lt;BR /&gt;One practical case is to resolve "cold start" problem.&lt;BR /&gt;For example, given a new item without any user-item associations, we want to "approximate" the item's latent vector.&lt;BR /&gt;An idea is taking the new item and comparing it's similarity (attribute based similarity, not latent feature similarity) to other items. Then, get the k-NN items' latent vectors to approximate the new items' "latent" vector.&amp;nbsp;&amp;nbsp; Basically, it's a k-NN based approach.&lt;BR /&gt;There could be other approaches. Anyway, let say, the new item's latent vector is estimated somehow. Then, we want to "insert" this new entry to existing item latent vectors (Y matrix). I understand there is no end-point API to do that. However, is it feasible to work around, say, using the Java jar level (computation/serving&amp;nbsp; jar) to getY and then modify Y matrix and "save" it back ? Any suggestions are welcome.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks.&lt;BR /&gt;Jason&lt;/P&gt;</description>
      <pubDate>Sat, 25 Oct 2014 23:19:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/20846#M18241</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2014-10-25T23:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/20872#M18242</link>
      <description>&lt;P&gt;It is not hard to expose, but seems like an internal implementation detail. The implementation already solves the cold start problem in a different way with fold-in. One issue with what you're suggesting is that there is no notion of attributes in the model. I assume you mean you have that externally. I understand the logic but it's a fairly different recommender model that you're making then. I think I'd direct you to just hack the code a bit. But I can keep this in mind in case several other use cases pop up that would make it make sense to just let the item vectors be set externally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The oryx2 design is much more decomposed so you could put in another process that feeds any item/user updates you want onto a queue of updates. But this is a ways from being ready.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Oct 2014 19:46:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/20872#M18242</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2014-10-26T19:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22408#M18243</link>
      <description>&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To follow up this, I would like to get your suggestion to hack the code a bit.&lt;/P&gt;&lt;P&gt;The goal is getting the latent features for items and users and where is a good starting point?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 05:00:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22408#M18243</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2014-12-07T05:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22412#M18244</link>
      <description>&lt;P&gt;I think you can perhaps see in the servlets under als-serving/ how they access the data structure for a generation, which includes a map from IDs to float[] (latent feature vectors) in memory. You could just clone how one of the servlets works and is initialized, and change it to return feature vectors.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Dec 2014 12:09:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22412#M18244</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2014-12-07T12:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22522#M18245</link>
      <description>&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Ya, I figured it out and is able to get latent features for users using some functions call (e.g., getCurrentGeneration(),&amp;nbsp;getX(),&amp;nbsp;getIDMapping() )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems latent vector&amp;nbsp;retrieval is fine. I cannot figure out the way to append a latent vector to Matrix X. Say, there is a new user, we have an external routine figuring out his latent vector (based on kNN of user profiles and latent features from Oryx). Now, I want to "append" the new latent vector to Matrix X and also idMapping. Any guidance about how to perform this is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 01:35:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22522#M18245</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2014-12-10T01:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22524#M18246</link>
      <description>&lt;P&gt;It's a bit complex due to all the locks (2.x is simpler in this regard) but you should be able to trace the logic from something like PreferenceServlet, which can add new users/items to the data structures.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 06:24:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22524#M18246</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2014-12-10T06:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22546#M18247</link>
      <description>&lt;P&gt;PreferenceServlet adds user-item preferences.&lt;/P&gt;&lt;P&gt;For cold-start users, there are no such info.&lt;/P&gt;&lt;P&gt;I am wondering if there are the ways to "add" latent vectors (X matrix) directly without breaking other related data structure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2014 17:25:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22546#M18247</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2014-12-10T17:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22569#M18248</link>
      <description>&lt;P&gt;When you add a user-item association, you have at least 1 data point for the user and item!&lt;/P&gt;&lt;P&gt;Before that, you have no info at all. You can't make any recommendations no matter what approach you use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add feature vectors directly, sure, but how would you know what to add?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 10:34:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22569#M18248</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2014-12-11T10:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22591#M18249</link>
      <description>&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are trying to handle the cold start user case.&lt;/P&gt;&lt;P&gt;This implies there is no known user-item association.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our approach is using users' profile.&lt;/P&gt;&lt;P&gt;(1) Given a new user u, find the kNN users based on profile similarity.&lt;/P&gt;&lt;P&gt;(2) Use these kNN users's latent vectors (from X matrix) to approximate the latent feature for new user u.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, the scenario is that we "already" know the latent feature to add. Question becomes "how to add the feature vector directly to Oryx"?&lt;/P&gt;&lt;P&gt;I am afraid to break internal structure and break approximation and re-scoring logic. That's why I am looking for your guidance/suggestions in the given scenario that we know what latent vector to "add"...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One "work around" I am thinking is that maybe I can simulate a dummy user-item association for the new user and add that dummy preference to Oryx.&amp;nbsp;&amp;nbsp; And, then, after kNN based latent vector computation, I "modify" (not "add") the latent vector of that new user from existing X matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 16:48:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22591#M18249</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2014-12-11T16:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22592#M18250</link>
      <description>&lt;P&gt;This may be semantics. If you have no data, you can't make any recommendation, so we must be talking about starting from some data. In the normal case there is only user-item interaction data, but you have this side information you're incorporating before the first interaction. OK. You can modify the code to simply add the new entry to the map containing IDs and feature vectors. What's the issue with that? I assume you're already modifying the code. Yes you need to be careful about the locks but there is not much else to know.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 16:57:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/22592#M18250</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2014-12-11T16:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25987#M18251</link>
      <description>&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;And, sorry for the late response.&lt;/P&gt;&lt;P&gt;I was trying to implement a kNN based approach to approximate the latent features for a cold start new user.&lt;/P&gt;&lt;P&gt;Then, now, I started to dig into the Oryx to see where to insert the new user's latent features into X matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following your hints, I checked setPreference code and I have two questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1) I noticed that a code line as below and traced the related codes. I do not get why there is a CandidateFilter involved and "where" the item will be added to. Will it "append" a new entry to Y matrix in order to host the latent feature for the new item ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (newItem) {&lt;BR /&gt;&amp;nbsp; generation.getCandidateFilter().addItem(itemID);&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L692)" target="_blank"&gt;https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L692)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(2) Follwing the question in (1), why there is no similar process to "newUser". Say, if there is a user-item association and the user-ID does not exist in the model, why there are statements such as.... &lt;STRONG&gt;if (newUser) { // do something }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2015 05:16:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25987#M18251</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2015-03-29T05:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25988#M18252</link>
      <description>&lt;P&gt;Yes, it becomes a new "row" in Y. The candidate filter is something else. This line of code is like a callback notifying the implementation that a new item exists. New users also cause a new row in X, but there is no equivalent 'candidate filter' for users because the same types of operations (recommend, etc.) are not supported for users.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2015 09:02:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25988#M18252</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2015-03-29T09:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25989#M18253</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reagarding what you mentioned "New users also cause a new row in X", just want to confirm with what I traced (please let me know if my following understading is not right)... Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My tracing indicates that...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1) The "new X feature vector" is added in&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L735" target="_blank"&gt;https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L735&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(2) The feature is updated in the following with foldIn&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L697" target="_blank"&gt;https://github.com/cloudera/oryx/blob/master/als-serving/src/main/java/com/cloudera/oryx/als/serving/ServerRecommender.java#L697&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(3) I do not need to worry about "candidate filter", because it's used for item..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2015 15:59:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25989#M18253</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2015-03-29T15:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25990#M18254</link>
      <description>&lt;P&gt;Yes, that's right.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2015 16:12:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/25990#M18254</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2015-03-29T16:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/26403#M18255</link>
      <description>&lt;P&gt;Sean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more thing to follow up... about Lock..&lt;/P&gt;&lt;P&gt;For example, I want to write an entry to X matrix, so I make something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lock writeLock = generation.getXLock().writeLock();&lt;BR /&gt;writeLock.lock();&lt;/P&gt;&lt;P&gt;// write to X matrix&lt;/P&gt;&lt;P&gt;writeLock.unlock();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1) My understanding is that then writeLock.lock() can avoid&amp;nbsp;simultaneous write from other writer. Right ?&lt;/P&gt;&lt;P&gt;(2) How about readLock ? Can you explian the siatuation to use readLock?&lt;/P&gt;&lt;P&gt;Lock readLock = generation.getXLock().readLock();&lt;BR /&gt;readLock.lock();&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 15:20:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/26403#M18255</guid>
      <dc:creator>Jason.Chen</dc:creator>
      <dc:date>2015-04-10T15:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve and modify latent feature vectors on the fly ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/26404#M18256</link>
      <description>&lt;P&gt;This is just Java's locking library, it's not specific to the project. This is a lock that supports many readers at one time, but, only one writer at a time (and no readers while a writer has the write lock). You have to acquire the write lock to mutate the shared state, but also need to acquire the read lock to read it -- but, you won't exclude other readers.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 15:54:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Retrieve-and-modify-latent-feature-vectors-on-the-fly/m-p/26404#M18256</guid>
      <dc:creator>srowen</dc:creator>
      <dc:date>2015-04-10T15:54:58Z</dc:date>
    </item>
  </channel>
</rss>

