You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Jeff Eastman <jd...@windwardsolutions.com> on 2010/04/27 23:54:22 UTC

NamedVector Run Amok?

Hi Sean,

I was under the impression that the recently refactored NamedVectors 
would be just another kind of Vector and that they would not need to 
show up in method signatures unless there really was a requirement for 
that explicit type. What I see now in many places in the clustering code 
is stuff like:

  public static List<List<SoftCluster>> clusterPoints(List<NamedVector> 
points, ...)

and,

     List<NamedVector> points = new ArrayList<NamedVector>();
     for (VectorWritable sample : sampleData) {
       points.add((NamedVector) sample.get());
     }

in places where there should not be such a requirement. You think it 
correct to do it this way or is this the result of change-all run amok?

Jeff

Re: NamedVector Run Amok?

Posted by Jeff Eastman <jd...@windwardsolutions.com>.
None of the clustering needs vectors to be named, not any more anyway. 
I've changed all the NamedVector types back to Vector outside of /math 
and the tests still run ok. FuzzyKMeans has a dependency on names in the 
unit tests. I'm still working on that but it is not significant. I will 
commit my changes once I'm done.

Just wanted to check,
Jeff

On 4/27/10 3:04 PM, Sean Owen wrote:
> It should only have been used in places where the Vector needed a name
> -- where getName() or setName() was called. That was the intent at
> least.
>
> This code snippet looks familiar; aren't the members of this
> collection used as NamedVector later?
>
> Well to be sure you can change any occurrences back to Vector if they
> don't need to be NamedVector. Try it and see if you don't get a
> compile error. If you don't I made a mistake and you can surely just
> fix it, or point me at it so I can fix it.
>
> On Tue, Apr 27, 2010 at 10:54 PM, Jeff Eastman
> <jd...@windwardsolutions.com>  wrote:
>    
>> Hi Sean,
>>
>> I was under the impression that the recently refactored NamedVectors would
>> be just another kind of Vector and that they would not need to show up in
>> method signatures unless there really was a requirement for that explicit
>> type. What I see now in many places in the clustering code is stuff like:
>>
>>   public static List<List<SoftCluster>>  clusterPoints(List<NamedVector>
>> points, ...)
>>
>> and,
>>
>>     List<NamedVector>  points = new ArrayList<NamedVector>();
>>     for (VectorWritable sample : sampleData) {
>>       points.add((NamedVector) sample.get());
>>     }
>>
>> in places where there should not be such a requirement. You think it correct
>> to do it this way or is this the result of change-all run amok?
>>
>> Jeff
>>
>>      
>    


Re: NamedVector Run Amok?

Posted by Sean Owen <sr...@gmail.com>.
It should only have been used in places where the Vector needed a name
-- where getName() or setName() was called. That was the intent at
least.

This code snippet looks familiar; aren't the members of this
collection used as NamedVector later?

Well to be sure you can change any occurrences back to Vector if they
don't need to be NamedVector. Try it and see if you don't get a
compile error. If you don't I made a mistake and you can surely just
fix it, or point me at it so I can fix it.

On Tue, Apr 27, 2010 at 10:54 PM, Jeff Eastman
<jd...@windwardsolutions.com> wrote:
> Hi Sean,
>
> I was under the impression that the recently refactored NamedVectors would
> be just another kind of Vector and that they would not need to show up in
> method signatures unless there really was a requirement for that explicit
> type. What I see now in many places in the clustering code is stuff like:
>
>  public static List<List<SoftCluster>> clusterPoints(List<NamedVector>
> points, ...)
>
> and,
>
>    List<NamedVector> points = new ArrayList<NamedVector>();
>    for (VectorWritable sample : sampleData) {
>      points.add((NamedVector) sample.get());
>    }
>
> in places where there should not be such a requirement. You think it correct
> to do it this way or is this the result of change-all run amok?
>
> Jeff
>