kaknikhil commented on a change in pull request #441: Kmeans: simplified
silhouette per point for k-means
URL: https://github.com/apache/madlib/pull/441#discussion_r324931455
##########
File path: src/modules/linalg/metric.cpp
##########
@@ -368,28 +368,33 @@ closest_column::run(AnyType& args) {
*/
AnyType
closest_columns::run(AnyType& args) {
- MappedMatrix M = args[0].getAs<MappedMatrix>();
- MappedColumnVector x = args[1].getAs<MappedColumnVector>();
- uint32_t num = args[2].getAs<uint32_t>();
- FunctionHandle dist = args[3].getAs<FunctionHandle>()
- .unsetFunctionCallOptions(FunctionHandle::GarbageCollectionAfterCall);
- string dist_fname = args[4].getAs<char *>();
-
- std::string fname = dist_fn_name(dist_fname);
-
- std::vector<std::tuple<Index, double> > result(num);
- closestColumnsAndDistancesShortcut(M, x, dist, fname, result.begin(),
- result.end());
-
- MutableArrayHandle<int32_t> indices = allocateArray<int32_t,
- dbal::FunctionContext, dbal::DoNotZero, dbal::ThrowBadAlloc>(num);
- MutableArrayHandle<double> distances = allocateArray<double,
- dbal::FunctionContext, dbal::DoNotZero, dbal::ThrowBadAlloc>(num);
- for (uint32_t i = 0; i < num; ++i)
- std::tie(indices[i], distances[i]) = result[i];
-
- AnyType tuple;
- return tuple << indices << distances;
+
+ try{
Review comment:
why did we add a try catch block ? Are we expecting something to fail ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services