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

Jake Mannix commented on MAHOUT-300:
------------------------------------

I'm a little concerned about correctness though:

I changed the benchmark code to reset the "result" value after each 
implementation test (so the result is then a multiple of the sum of the 
vec_i.dot(vec_(i+1)) for the dot test, and the sum of the min distances for the 
distance tests), and I get back the following, which has a little anomaly at 
the beginning, for Dense dot:

{code}
INFO: DotProduct DenseVector 
sum = 763.2092807960457  

INFO: DotProduct RandomAccessSparseVector 
sum = 588.1135274394809  

INFO: DotProduct SequentialAccessSparseVector 
sum = 596.8159785621963  



INFO: org.apache.mahout.common.distance.CosineDistanceMeasure DenseVector 
minDistance = 4762.262583384831  

INFO: org.apache.mahout.common.distance.CosineDistanceMeasure 
RandomAccessSparseVector 
minDistance = 4762.256231037734  

INFO: org.apache.mahout.common.distance.CosineDistanceMeasure 
SequentialAccessSparseVector 
minDistance = 4762.076824677951  



INFO: org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure 
DenseVector 
minDistance = 960106.3770997674  

INFO: org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure 
RandomAccessSparseVector 
minDistance = 958642.7572087944  

INFO: org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure 
SequentialAccessSparseVector 
minDistance = 959249.2711033518  



INFO: org.apache.mahout.common.distance.EuclideanDistanceMeasure DenseVector 
minDistance = 67835.12813051333  

INFO: org.apache.mahout.common.distance.EuclideanDistanceMeasure 
RandomAccessSparseVector 
minDistance = 67781.10820288945  

INFO: org.apache.mahout.common.distance.EuclideanDistanceMeasure 
SequentialAccessSparseVector 
minDistance = 67802.77780568038  



INFO: org.apache.mahout.common.distance.ManhattanDistanceMeasure DenseVector 
minDistance = 767471.8978953827  

INFO: org.apache.mahout.common.distance.ManhattanDistanceMeasure 
RandomAccessSparseVector 
minDistance = 766991.0938857986  

INFO: org.apache.mahout.common.distance.ManhattanDistanceMeasure 
SequentialAccessSparseVector 
minDistance = 767126.9510115242  



INFO: org.apache.mahout.common.distance.TanimotoDistanceMeasure DenseVector 
minDistance = 4781.060847329619  

INFO: org.apache.mahout.common.distance.TanimotoDistanceMeasure 
RandomAccessSparseVector 
minDistance = 4781.058010411256  

INFO: org.apache.mahout.common.distance.TanimotoDistanceMeasure 
SequentialAccessSparseVector 
minDistance = 4781.051812134896  
{code}

> Solve performance issues with Vector Implementations
> ----------------------------------------------------
>
>                 Key: MAHOUT-300
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-300
>             Project: Mahout
>          Issue Type: Improvement
>    Affects Versions: 0.3
>            Reporter: Robin Anil
>             Fix For: 0.3
>
>         Attachments: MAHOUT-300.patch, MAHOUT-300.patch, MAHOUT-300.patch, 
> MAHOUT-300.patch, MAHOUT-300.patch
>
>
> AbstractVector operations like times
>   public Vector times(double x) {
>     Vector result = clone();
>     Iterator<Element> iter = iterateNonZero();
>     while (iter.hasNext()) {
>       Element element = iter.next();
>       int index = element.index();
>       result.setQuick(index, element.get() * x);
>     }
>     return result;
>   }
> should be implemented as follows
>  public Vector times(double x) {
>     Vector result = clone();
>     Iterator<Element> iter = result.iterateNonZero();
>     while (iter.hasNext()) {
>       Element element = iter.next();
>       element.set(element.get() * x);
>     }
>     return result;
>   }

-- 
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