- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use kdtree_knn_classification to do a 2d k-nearest neighbour search on in-memory data. However i am getting an unhandled exception in the algorithm.compute() function. Attached is my code snippet. Is something wrong with my usage? Unfortunately i am not able to figure out from the documentation and the examples. Please help! I am using daal 2021.1.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Instead of
algorithm.parameter.nClasses = 1;
use
algorithm.parameter.resultsToEvaluate = classifier::none;
algorithm.parameter.resultsToCompute = kdtree_knn_classification::computeDistances | kdtree_knn_classification::computeIndicesOfNeighbors;
and delete line
algorithm.input.set(classifier::training::labels, trainLabel);
to enable plain knn search without classification. Despite on your task, you might drop distances (kdtree_knn_classification::computeDistances) or indices (kdtree_knn_classification::computeIndicesOfNeighbors).
If classification is also needed, return label input line, delete line with resultsToEvaluate and add nClasses > 1:
algorithm.parameter.nClasses = nClasses;
Kind regards,
Alexander.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting in Intel® oneAPI Data Analytics Library & Intel® Data Analytics Acceleration Library Forum.
Please share the operating system details.
Have you tried running the kdtree_knn_dense_batch sample of daal 2021.1.1 available with oneAPI base toolkit on linux . We were able to run it successfully without any issues, so the error you mentioned might be code related.
Here are the steps to build and run that sample using c++ compiler on linux:
1) Setting up oneAPI environment via setvars.sh script:
source <install_directory>/setvars.sh
2) DAAL kdtree sample is present in the below folder:
<install_directory>/dal/2021.1.1/examples/daal/cpp/source/k_nearest_neighbors/
3) Use the makefile to build and run the DAAL examples, You can try any of the below commands:
cd <install_directory>/dal/2021.1.1/examples/daal/cpp/
4) make libintel64 example=kdtree_knn_ dense_batch
[Now, it will build by Intel(R) oneAPI DPC++ Compiler (as default) and run pca example for 64-bit applications and do static linking]
OR
make sointel64 example= kdtree_knn_ dense_batch
[build by Intel(R) oneAPI Compiler (as default) and run all examples for Intel(R)64 processor family applications, dynamic linking
Please refer the following link for further details :
https://oneapi-src.github.io/oneDAL/getstarted.html#
Get back to us in case of any issues.
Thank you,
Raeesa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your reply.
I am using windows 10 enterprise and visual studio17 version 15.9.13.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Instead of
algorithm.parameter.nClasses = 1;
use
algorithm.parameter.resultsToEvaluate = classifier::none;
algorithm.parameter.resultsToCompute = kdtree_knn_classification::computeDistances | kdtree_knn_classification::computeIndicesOfNeighbors;
and delete line
algorithm.input.set(classifier::training::labels, trainLabel);
to enable plain knn search without classification. Despite on your task, you might drop distances (kdtree_knn_classification::computeDistances) or indices (kdtree_knn_classification::computeIndicesOfNeighbors).
If classification is also needed, return label input line, delete line with resultsToEvaluate and add nClasses > 1:
algorithm.parameter.nClasses = nClasses;
Kind regards,
Alexander.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alexander,
Thanks for your solution. Setting algorithm.parameter.resultsToEvaluate = classifier::none worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Glad to know that your issue got resolved. We are discontinuing monitoring this thread.Please raise a new thread in case of any further issues.
Thanks,
Raeesa
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page