[ 
https://issues.apache.org/jira/browse/MAHOUT-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12897662#action_12897662
 ] 

Hui Wen Han commented on MAHOUT-463:
------------------------------------



/**
 * distributed implementation of cosine similarity that does not center its data
 */
public class DistributedUncenteredCosineVectorSimilarity extends 
AbstractDistributedVectorSimilarity {

  @Override
  protected double doComputeResult(int rowA, int rowB, Iterable<Cooccurrence> 
cooccurrences, double weightOfVectorA,
      double weightOfVectorB, int numberOfColumns) {

    int n = 0;
    double sumXY = 0.0;
    double sumX2 = 0.0;
    double sumY2 = 0.0;

    for (Cooccurrence cooccurrence : cooccurrences) {
      double x = cooccurrence.getValueA();
      double y = cooccurrence.getValueB();

      sumXY += x * y;
      sumX2 += x * x;
      sumY2 += y * y;
      n++;
    }

    if (n == 0) {
      return Double.NaN;
    }
    double denominator = Math.sqrt(sumX2) * Math.sqrt(sumY2);
    if (denominator == 0.0) {
      // One or both vectors has -all- the same values;
      // can't really say much similarity under this measure
      return Double.NaN;
    }
    return sumXY / denominator;
  }

}

this one will always return 1.0

> Boolean Data can not get any recommendation by running RecommnenderJob
> ----------------------------------------------------------------------
>
>                 Key: MAHOUT-463
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-463
>             Project: Mahout
>          Issue Type: Test
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Hui Wen Han
>             Fix For: 0.4
>
>         Attachments: MAHOUT-463-2.patch, MAHOUT-463.patch
>
>
> Boolean Preference Data can not get any recommendation by run RecommnenderJob,
> but It can get data using the build in about Aprl.
> It seems that it can not get any data by running RowSimilarityJob 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to