[
https://issues.apache.org/jira/browse/MAHOUT-1135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542171#comment-13542171
]
Dan Filimon commented on MAHOUT-1135:
-------------------------------------
I guess you're referring to the creation cost of the Pair?
This is true, but I don't know how much more expensive creating a Pair is. I do
agree with you that we need a MutablePair as well because the current Pair
implementation is immutable.
Therefore, once a WeightedVector is created, updating the weights or indices
would not result in the creation of a new pair.
And, one more thing, we need to deal with Centroid (extends WeightedVector).
Centroid doesn't add any data members, it just adds a Welford-style update()
method mainly.
Since Centroid is only used by streaming k-means, ball k-means, we could make
it extend DecoratedVector<Pair<...>> and see how the performance compares.
And anyway, I think it's useful to have this base class everyone else will
extend to not reinvent the wheel every single time.
> Unify decorated vectors in DecoratedVector<T>
> ---------------------------------------------
>
> Key: MAHOUT-1135
> URL: https://issues.apache.org/jira/browse/MAHOUT-1135
> Project: Mahout
> Issue Type: Wish
> Components: Math
> Affects Versions: 1.0
> Reporter: Dan Filimon
> Priority: Minor
> Labels: improvement, vector
>
> I'm finding the current Vector classes in Mahout a bit confusing.
> The vector implementation are just fine, I'm talking more about the decorated
> vectors:
> WeightedVector
> MatrixSlice
> NamedVector
> I propose using a single DecoratedVector<T> type that can easily be extended.
> For example, right now MatrixSlice doesn't even implement the Vector
> interface.
> So,
> WeightedVector -> DecoratedVector<Pair<Integer, Double>>
> MatrixSlice -> DecoratedVector<Integer>
> NamedVector -> DecoratedVector<String>
> We could even keep the names (maybe changing MatrixSlice to something like
> IndexedVector though?) by extending DecoratedVector<T>.
> I'd be willing to fix this if people think it's a good idea.
> What about it? :)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira