Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconciling primitives moved to RAFT #4583

Merged
merged 54 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d615950
Using metrics from raft
cjnolet Feb 16, 2022
142b328
Updating
cjnolet Feb 16, 2022
ad03b86
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 16, 2022
9722d08
Adding knn back
cjnolet Feb 16, 2022
8b1de6b
Updating copyrights
cjnolet Feb 16, 2022
5ea7a91
Adding specializations for knn gtests
cjnolet Feb 17, 2022
11e50ca
adding more specializations
cjnolet Feb 17, 2022
7cc8d21
More specializations
cjnolet Feb 17, 2022
e08dea6
Updating style
cjnolet Feb 17, 2022
41a1c5e
No longer building brute_force_knn prim anywhere
cjnolet Feb 18, 2022
a421dab
Fixing style
cjnolet Feb 18, 2022
bb474e2
Fixing copyright and removing a couple more distance funcs
cjnolet Feb 18, 2022
f5b3c66
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 18, 2022
dbde267
Removing prims moved over to raft
cjnolet Feb 18, 2022
80428f1
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 19, 2022
375142e
Reverting get_raft cmake
cjnolet Feb 19, 2022
8d57a72
Using distance already specialized
cjnolet Feb 19, 2022
de49049
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Feb 23, 2022
53d730a
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 1, 2022
004d215
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 17, 2022
0172a5b
Merge branch 'branch-22.04' into imp-2204-metrics_to_raft
cjnolet Mar 30, 2022
d95746a
updating get_raft
cjnolet Mar 30, 2022
3f24aea
Fixing includes
cjnolet Mar 30, 2022
1583169
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Mar 31, 2022
1ba60f5
Removing raft allocator from gram
cjnolet Mar 31, 2022
48edbc5
Merge remote-tracking branch 'rapidsai/branch-22.04' into imp-2204-me…
cjnolet Apr 5, 2022
d49a04e
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet Apr 5, 2022
0e0e693
Removing prims benchmarks which are being moved to raft
cjnolet Apr 6, 2022
bfeeafb
Fixing completeness score
cjnolet Apr 6, 2022
9985e69
Fixing completeness score for now
cjnolet Apr 6, 2022
8663dc9
Fixing get_raft.cmake
cjnolet Apr 7, 2022
74d5be0
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet May 13, 2022
0510bb5
Merge remote-tracking branch 'rapidsai/branch-22.06' into imp-2204-me…
cjnolet May 24, 2022
4571f06
Merge remote-tracking branch 'rapidsai/branch-22.08' into imp-2204-me…
cjnolet Jun 2, 2022
acee2f7
Merge remote-tracking branch 'rapidsai/branch-22.08' into imp-2204-me…
cjnolet Jun 6, 2022
756fa29
Merge branch 'branch-22.10' into imp-2204-metrics_to_raft
cjnolet Oct 3, 2022
352e6fb
emoving more files
cjnolet Oct 3, 2022
873e277
Fixing style
cjnolet Oct 3, 2022
74e1888
Merge remote-tracking branch 'rapidsai/branch-22.12' into imp-2204-me…
cjnolet Oct 14, 2022
e1fb7b7
Fixing sv test
cjnolet Oct 14, 2022
ee4b0e9
Fixing svm test
cjnolet Oct 15, 2022
2f641d6
Fixing style
cjnolet Oct 15, 2022
d05f754
Fixing more style
cjnolet Oct 15, 2022
5c27e9f
Removing gram test
cjnolet Oct 15, 2022
1e5c2be
Adding knn classify/regress tests back in
cjnolet Oct 15, 2022
c97694e
Fixing information criterion use
cjnolet Oct 15, 2022
011ebb0
Fixing bad merge
cjnolet Oct 15, 2022
1fe951b
Still fixing bad merge
cjnolet Oct 15, 2022
0d67a29
Removing duplicated labels prims
cjnolet Oct 16, 2022
a7ee4a8
Final cleanup
cjnolet Oct 16, 2022
9c0d308
Reverting get_raft.cmake
cjnolet Oct 18, 2022
edee19c
Fixing header definition and namespace for kernel gram API
cjnolet Oct 18, 2022
2a26900
Fixing style
cjnolet Oct 18, 2022
977690f
Fixing small error in v_measure
cjnolet Oct 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ function(find_and_configure_raft)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN} )

if(PKG_CLONE_ON_PIN AND NOT PKG_PINNED_TAG STREQUAL "branch-${CUML_BRANCH_VERSION_raft}")
message(STATUS "CUML: RAFT pinned tag found: ${PKG_PINNED_TAG}. Cloning raft locally.")
set(CPM_DOWNLOAD_raft ON)
endif()
set(CPM_DOWNLOAD_raft ON)

if(PKG_USE_RAFT_STATIC)
message(STATUS "CUML: Cloning raft locally to build static libraries.")
Expand Down
17 changes: 8 additions & 9 deletions cpp/src/arima/batched_arima.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

#include <common/nvtx.hpp>
#include <linalg/batched/matrix.cuh>
#include <metrics/batched/information_criterion.cuh>
#include <raft/common/nvtx.hpp>
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/handle.hpp>
#include <raft/linalg/matrix_vector_op.hpp>
#include <raft/stats/information_criterion.hpp>
#include <rmm/device_uvector.hpp>
#include <timeSeries/arima_helpers.cuh>
#include <timeSeries/fillna.cuh>
Expand Down Expand Up @@ -612,14 +612,13 @@ void information_criterion(raft::handle_t& handle,
handle, arima_mem, d_y, d_exog, batch_size, n_obs, order, params, d_ic, false, false, MLE);

/* Compute information criterion from log-likelihood and base term */
MLCommon::Metrics::Batched::information_criterion(
d_ic,
d_ic,
static_cast<MLCommon::Metrics::IC_Type>(ic_type),
order.complexity(),
batch_size,
n_obs - order.n_diff(),
stream);
raft::stats::information_criterion_batched(d_ic,
d_ic,
static_cast<raft::stats::IC_Type>(ic_type),
order.complexity(),
batch_size,
n_obs - order.n_diff(),
stream);
}

/**
Expand Down
1 change: 1 addition & 0 deletions cpp/src/hdbscan/detail/reachability.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <cuml/neighbors/knn.hpp>
#include <raft/distance/distance.hpp>
#include <raft/spatial/knn/specializations.hpp>

#include <thrust/transform.h>

Expand Down
1 change: 1 addition & 0 deletions cpp/src/hdbscan/hdbscan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "detail/condense.cuh"
#include <cuml/cluster/hdbscan.hpp>
#include <raft/spatial/knn/specializations.hpp>

#include "runner.h"

Expand Down
1 change: 1 addition & 0 deletions cpp/src/knn/knn_opg_common.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <raft/cuda_utils.cuh>
#include <raft/cudart_utils.h>
#include <raft/spatial/knn/knn.hpp>
#include <raft/spatial/knn/specializations.hpp>

#include <cstddef>
#include <memory>
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/knn/knn_sparse.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,7 @@
#include <cuml/neighbors/knn_sparse.hpp>

#include <raft/sparse/selection/knn.hpp>
#include <raft/spatial/knn/specializations.hpp>

#include <cusparse_v2.h>

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/metrics/accuracy_score.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/scores.cuh>
#include <raft/stats/accuracy.hpp>

namespace ML {

Expand All @@ -27,7 +27,7 @@ float accuracy_score_py(const raft::handle_t& handle,
const int* ref_predictions,
int n)
{
return MLCommon::Score::accuracy_score(predictions, ref_predictions, n, handle.get_stream());
return raft::stats::accuracy(predictions, ref_predictions, n, handle.get_stream());
}
} // namespace Metrics
} // namespace ML
8 changes: 4 additions & 4 deletions cpp/src/metrics/adjusted_rand_index.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/adjusted_rand_index.cuh>
#include <raft/stats/adjusted_rand_index.hpp>

namespace ML {

Expand All @@ -26,7 +26,7 @@ double adjusted_rand_index(const raft::handle_t& handle,
const int64_t* y_hat,
const int64_t n)
{
return MLCommon::Metrics::compute_adjusted_rand_index<int64_t, unsigned long long>(
return raft::stats::adjusted_rand_index<int64_t, unsigned long long>(
y, y_hat, n, handle.get_stream());
}

Expand All @@ -35,7 +35,7 @@ double adjusted_rand_index(const raft::handle_t& handle,
const int* y_hat,
const int n)
{
return MLCommon::Metrics::compute_adjusted_rand_index<int, unsigned long long>(
return raft::stats::adjusted_rand_index<int, unsigned long long>(
y, y_hat, n, handle.get_stream());
}
} // namespace Metrics
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/metrics/completeness_score.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/homogeneity_score.cuh>
#include <raft/stats/completeness_score.hpp>

namespace ML {

Expand All @@ -29,7 +29,7 @@ double completeness_score(const raft::handle_t& handle,
const int lower_class_range,
const int upper_class_range)
{
return MLCommon::Metrics::homogeneity_score(
return raft::stats::completeness_score(
y_hat, y, n, lower_class_range, upper_class_range, handle.get_stream());
}

Expand Down
7 changes: 3 additions & 4 deletions cpp/src/metrics/entropy.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/entropy.cuh>
#include <raft/stats/entropy.hpp>

namespace ML {

Expand All @@ -27,8 +27,7 @@ double entropy(const raft::handle_t& handle,
const int lower_class_range,
const int upper_class_range)
{
return MLCommon::Metrics::entropy(
y, n, lower_class_range, upper_class_range, handle.get_stream());
return raft::stats::entropy(y, n, lower_class_range, upper_class_range, handle.get_stream());
}
} // namespace Metrics
} // namespace ML
6 changes: 3 additions & 3 deletions cpp/src/metrics/homogeneity_score.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/homogeneity_score.cuh>
#include <raft/stats/homogeneity_score.hpp>

namespace ML {

Expand All @@ -29,7 +29,7 @@ double homogeneity_score(const raft::handle_t& handle,
const int lower_class_range,
const int upper_class_range)
{
return MLCommon::Metrics::homogeneity_score(
return raft::stats::homogeneity_score(
y, y_hat, n, lower_class_range, upper_class_range, handle.get_stream());
}
} // namespace Metrics
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/metrics/kl_divergence.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,20 +16,20 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/kl_divergence.cuh>
#include <raft/stats/kl_divergence.hpp>

namespace ML {

namespace Metrics {

double kl_divergence(const raft::handle_t& handle, const double* y, const double* y_hat, int n)
{
return MLCommon::Metrics::kl_divergence(y, y_hat, n, handle.get_stream());
return raft::stats::kl_divergence(y, y_hat, n, handle.get_stream());
}

float kl_divergence(const raft::handle_t& handle, const float* y, const float* y_hat, int n)
{
return MLCommon::Metrics::kl_divergence(y, y_hat, n, handle.get_stream());
return raft::stats::kl_divergence(y, y_hat, n, handle.get_stream());
}
} // namespace Metrics
} // namespace ML
6 changes: 3 additions & 3 deletions cpp/src/metrics/mutual_info_score.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
#include <raft/handle.hpp>

#include <cuml/metrics/metrics.hpp>
#include <metrics/mutual_info_score.cuh>
#include <raft/stats/mutual_info_score.hpp>

namespace ML {

Expand All @@ -31,7 +31,7 @@ double mutual_info_score(const raft::handle_t& handle,
const int lower_class_range,
const int upper_class_range)
{
return MLCommon::Metrics::mutual_info_score(
return raft::stats::mutual_info_score(
y, y_hat, n, lower_class_range, upper_class_range, handle.get_stream());
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/metrics/r2_score.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,20 +15,20 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/scores.cuh>
#include <raft/stats/r2_score.hpp>

namespace ML {

namespace Metrics {

float r2_score_py(const raft::handle_t& handle, float* y, float* y_hat, int n)
{
return MLCommon::Score::r2_score(y, y_hat, n, handle.get_stream());
return raft::stats::r2_score(y, y_hat, n, handle.get_stream());
}

double r2_score_py(const raft::handle_t& handle, double* y, double* y_hat, int n)
{
return MLCommon::Score::r2_score(y, y_hat, n, handle.get_stream());
return raft::stats::r2_score(y, y_hat, n, handle.get_stream());
}

} // namespace Metrics
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/metrics/rand_index.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,15 @@
#include <raft/handle.hpp>

#include <cuml/metrics/metrics.hpp>
#include <metrics/rand_index.cuh>
#include <raft/stats/rand_index.hpp>

namespace ML {

namespace Metrics {

double rand_index(const raft::handle_t& handle, const double* y, const double* y_hat, int n)
{
return MLCommon::Metrics::compute_rand_index(y, y_hat, (uint64_t)n, handle.get_stream());
return raft::stats::rand_index(y, y_hat, (uint64_t)n, handle.get_stream());
}
} // namespace Metrics
} // namespace ML
9 changes: 4 additions & 5 deletions cpp/src/metrics/silhouette_score.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/

#include <cuml/metrics/metrics.hpp>
#include <metrics/batched/silhouette_score.cuh>
#include <metrics/silhouette_score.cuh>
#include <raft/distance/distance_type.hpp>
#include <raft/stats/silhouette_score.hpp>

namespace ML {

Expand All @@ -32,7 +31,7 @@ double silhouette_score(const raft::handle_t& handle,
double* silScores,
raft::distance::DistanceType metric)
{
return MLCommon::Metrics::silhouette_score<double, int>(
return raft::stats::silhouette_score<double, int>(
handle, y, nRows, nCols, labels, nLabels, silScores, handle.get_stream(), metric);
}

Expand All @@ -48,7 +47,7 @@ float silhouette_score(const raft::handle_t& handle,
int chunk,
raft::distance::DistanceType metric)
{
return MLCommon::Metrics::Batched::silhouette_score<float, int, int>(
return raft::stats::silhouette_score_batched<float, int, int>(
handle, X, n_rows, n_cols, y, n_labels, scores, chunk, metric);
}

Expand All @@ -62,7 +61,7 @@ double silhouette_score(const raft::handle_t& handle,
int chunk,
raft::distance::DistanceType metric)
{
return MLCommon::Metrics::Batched::silhouette_score<double, int, int>(
return raft::stats::silhouette_score_batched<double, int, int>(
handle, X, n_rows, n_cols, y, n_labels, scores, chunk, metric);
}

Expand Down
Loading