I understand. Even though I don't have feed files, we're using MongoDB as
the main data source, I can update database for the "old" or "out of stock"
items...

So even in the case of ghost items or those I want to exclude and use
Rescorer, I still need to update the in memory model, right? As far I
understand it's not enough to update the feed, unless It's being
refreshed... Is there a way to store additional optional data along with
userId <-> itemId? The only solution I see now is to extend
GenericPreference and add additional properties like isOld, price (for other
purposes), is this a correct approach?

PS: Thanks guys for your time!

On Mon, Oct 17, 2011 at 2:35 AM, Sean Owen <[email protected]> wrote:

> In general this DataModel is not modifiable, which is why you're
> having to hack at it. The idea is to update the underlying data,
> ideally -- for example, the file containing the data, perhaps by using
> update (delta) files.
>
> Your approach works though. There is not a better way to do it, if
> this is what you're doing.
>
> As Ted mentioned, keep data on items that are real and valid, just out
> of stock or old or something. You can filter them using a Rescorer so
> that they don't end up in the output.
>
> You can do the same thing for ghost data, if you like. That at least
> means you have an immediate way of filtering and can wait for a data
> reload or update rather than do it every time on the fly.
>
> On Mon, Oct 17, 2011 at 2:58 AM, Octavian Covalschi
> <[email protected]> wrote:
> > Hi there.
> >
> > We have the taste war running and we are trying to accomplish a realtime
> > functionality by removing/adding user items on the fly. So far adding and
> > removing items for particular users has been working fine for us and
> > recommendations are being changed on the fly.. though it's still in
> beta...
> > The last piece is to remove an item from ALL users, it's necessary when
> the
> > item is removed from the system... So far I've got this:
> >
> > public void removeItemFromAllUsers(long itemId) throws
> NoSuchItemException {
> >        PreferenceArray prefArray = ((GenericDataModel)
> > delegate).getPreferencesForItem(itemId);
> >
> >        if (prefArray.length() > 0) {
> >            FastByIDMap<PreferenceArray> rawData = ((GenericDataModel)
> > delegate).getRawUserData();
> >
> >            for (Preference pr : prefArray) {
> >                PreferenceArray prefs = rawData.get(pr.getUserID());
> >
> >                rawData.remove(pr.getUserID());
> >
> >                if (prefs.length() > 1) {
> >                    PreferenceArray newPrefs = new
> > GenericUserPreferenceArray(length - 1);
> >                    for (int i = 0, j = 0; i < length; i++, j++) {
> >                        if (prefs.getItemID(i) == itemId) {
> >                            j--;
> >                        } else {
> >                            newPrefs.set(j, prefs.get(i));
> >                        }
> >                    }
> >                    rawData.put(pr.getUserID(), newPrefs);
> >                }
> >            }
> >            delegate = new GenericDataModel(rawData);
> >        }
> >    }
> >
> > I'm still pretty new with mahout and was wondering if there is a better
> way,
> > in particular make use of getRawUserData(), which I tried but it didn't
> > help...
> >
> > Thank you in advance.
> >
>

Reply via email to