Hi,
Does this support the possibility that user/item id can be negative?
I am reading through the source code of
org.apache.mahout.cf.taste.impl.model.AbstractIDMigrator. The hash() function
is trying to convert a string id to a long id like this. It’s quite possible
that the long id returned is a negative one, when the leading bit is 1:)
protected final long hash(String value) {
byte[] md5hash;
synchronized (md5Digest) {
md5hash = md5Digest.digest(value.getBytes(Charsets.UTF_8));
md5Digest.reset();
}
long hash = 0L;
for (int i = 0; i < 8; i++) {
hash = hash << 8 | md5hash[i] & 0x00000000000000FFL;
}
return hash;
}
Hi Ted,
I am running the in memory version of GenericItemBasedRecommender and
SVDRecommender, i.e. I am using them in my Java code.
Hi Pat,
Not all user id are negative. Input file sample:
...
-10000250,6929,1
-10000250,7059,1
-10000250,7654,1
-10000250,8094,1
-10000250,9486,1
-10000250,9563,3
10018000,11080,1
10018000,11176,1
10018000,11196,1
10018000,12220,1
10018000,12447,1
10018000,13213,1
...
Item based recommender output sample:
User,Brand,Scoring
-10000250,12352,5.0
-10000250,14261,5.0
-10000250,15934,4.309238
-10000250,16463,3.0
-10000250,3627,1.0
1025250,29099,1.0
1025250,18741,1.0
1025250,14261,1.0
…
SVD recommender output sample:
User,Brand,Scoring
-10000250,3627,3.9108906
-10000250,27791,3.8262475
-10000250,251,3.744943
-10000250,20979,3.5778444
-10000250,14482,3.5494242
1025250,27791,2.2692947
1025250,251,1.9651389
1025250,14482,1.9196383
1025250,12220,1.9153352
...
Thank you,
Peng Zhang
M: +86 186-1658-7856
[email protected]
On Aug 6, 2014, at 7:26 AM, Pat Ferrel <[email protected]> wrote:
> Are they ALL negative? Maybe only the non-negatives are working or there are
> some conditions where negatives work. I certainly wouldn’t count on it
> because I’ll bet it isn’t working as it should.
>
>
> On Aug 5, 2014, at 4:03 PM, Ted Dunning <[email protected]> wrote:
>
> On Tue, Aug 5, 2014 at 3:21 AM, Peng Zhang <[email protected]> wrote:
>
>> But today I am trying to use negative user id and item id, and they are
>> working well with the item recommender and dvd recommender.
>>
>
> Which programs are you using?
>