Skip to content

Commit

Permalink
For now, removing output of all notebook cells
Browse files Browse the repository at this point in the history
  • Loading branch information
cjnolet committed May 29, 2024
1 parent 31e3365 commit 4c7c175
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 948 deletions.
5 changes: 0 additions & 5 deletions cpp/include/cuvs/cluster/kmeans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,12 @@ void predict(raft::resources const& handle,
* @param[in] params Parameters for KMeans model.
* @param[in] X New data to predict.
* [dim = n_samples x n_features]
* @param[in] sample_weight Optional weights for each observation in X.
* [len = n_samples]
* @param[in] centroids Cluster centroids. The data must be in
* row-major format.
* [dim = n_clusters x n_features]
* @param[in] normalize_weight True if the weights should be normalized
* @param[out] labels Index of the cluster each sample in X
* belongs to.
* [len = n_samples]
* @param[out] inertia Sum of squared distances of samples to
* their closest cluster center.
*/
void predict(const raft::resources& handle,
cuvs::cluster::kmeans::balanced_params const& params,
Expand Down
29 changes: 29 additions & 0 deletions docs/source/working_with_ann_indexes_c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Building an index
cuvsCagraIndex_t index;
DLManagedTensor *dataset;
// populate tensor with data
load_dataset(dataset);
cuvsResourcesCreate(&res);
Expand All @@ -34,6 +36,33 @@ Building an index
Searching an index
------------------

.. code-block:: c
#include <cuvs/neighbors/cagra.h>
cuvsResources_t res;
cuvsCagraSearchParams_t search_params;
cuvsCagraIndex_t index;
// ... build index ...
DLManagedTensor *queries;
DLManagedTensor *neighbors;
DLManagedTensor *distances;
// populate tensor with data
load_queries(queries);
cuvsResourcesCreate(&res);
cuvsCagraSearchParamsCreate(&index_params);
cuvsCagraSearch(res, search_params, index, queries, neighbors, distances);
cuvsCagraIndexDestroy(index);
cuvsCagraIndexParamsDestroy(index_params);
cuvsResourcesDestroy(res);
Serializing an index
--------------------
24 changes: 20 additions & 4 deletions docs/source/working_with_ann_indexes_cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,29 @@ Building an index
auto index = cagra::build(res, index_params, dataset);



Searching an index
------------------

.. code-block:: c++

#include <cuvs/neighbors/cagra.hpp>

using namespace cuvs::neighbors;
cagra::index index;

// ... build index ...

raft::device_matrix_view<float> queries = load_queries();
raft::device_matrix_view<uint32_t> neighbors = make_device_matrix_view<uint32_t>(n_queries, k);
raft::device_matrix_view<float> distances = make_device_matrix_view<float>(n_queries, k);
raft::device_resources res;

cagra::search_params search_params;

cagra::search(res, search_params, index, queries, neighbors, distances);

CPU/GPU interoperability
------------------------

Serializing an index
--------------------
--------------------


14 changes: 12 additions & 2 deletions docs/source/working_with_ann_indexes_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ Building an index
Searching an index
------------------

.. code-block:: python
from cuvs.neighbors import cagra
queries = load_queries()
search_params = cagra.SearchParams()
index = // ... build index ...
neighbors, distances = cagra.search(search_params, index, queries, k)
CPU/GPU interoperability
------------------------
Serializing an index
--------------------
342 changes: 33 additions & 309 deletions notebooks/VectorSearch_QuestionRetrieval.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 4c7c175

Please sign in to comment.