From cc0e579da7d38043ab0cdba48da5b9da38b871d9 Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Fri, 10 Sep 2021 21:23:40 +0000 Subject: [PATCH 1/7] finished grouping --- libcuml-libcudf-groupby/CMakeLists.txt | 21 + libcuml-libcudf-groupby/README.md | 18 + libcuml-libcudf-groupby/src/process_csv.cpp | 51 ++ libcuml-libcudf-groupby/test.csv | 722 ++++++++++++++++++++ 4 files changed, 812 insertions(+) create mode 100644 libcuml-libcudf-groupby/CMakeLists.txt create mode 100644 libcuml-libcudf-groupby/README.md create mode 100644 libcuml-libcudf-groupby/src/process_csv.cpp create mode 100644 libcuml-libcudf-groupby/test.csv diff --git a/libcuml-libcudf-groupby/CMakeLists.txt b/libcuml-libcudf-groupby/CMakeLists.txt new file mode 100644 index 0000000..aef477c --- /dev/null +++ b/libcuml-libcudf-groupby/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.18) + +project(basic_example VERSION 0.0.1 LANGUAGES CXX CUDA) + +set(CPM_DOWNLOAD_VERSION v0.32.2) +file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/${CPM_DOWNLOAD_VERSION}/get_cpm.cmake ${CMAKE_BINARY_DIR}/cmake/get_cpm.cmake) +include(${CMAKE_BINARY_DIR}/cmake/get_cpm.cmake) + +set(CUDF_TAG branch-21.10) +CPMFindPackage(NAME cudf + GIT_REPOSITORY https://github.com/rapidsai/cudf + GIT_TAG ${CUDF_TAG} + GIT_SHALLOW TRUE + SOURCE_SUBDIR cpp +) + + +# Configure your project here +add_executable(basic_example src/process_csv.cpp) +target_link_libraries(basic_example PRIVATE cudf::cudf) +target_compile_features(basic_example PRIVATE cxx_std_17) diff --git a/libcuml-libcudf-groupby/README.md b/libcuml-libcudf-groupby/README.md new file mode 100644 index 0000000..7b6748b --- /dev/null +++ b/libcuml-libcudf-groupby/README.md @@ -0,0 +1,18 @@ +# libcuml and libcudf groupby + +This C++ example demonstrates running a `libcuml` regression model on groups from a `libcudf` `groupby` operation + +## Compile and execute + +```bash +# Configure project +cmake -S . -B build/ +# Build +cmake --build build/ --parallel $PARALLEL_LEVEL +# Execute +build/libcudf_example +``` + +If your machine does not come with a pre-built libcudf binary, expect the +first build to take some time, as it would build libcudf on the host machine. +It may be sped up by configuring the proper `PARALLEL_LEVEL` number. diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp new file mode 100644 index 0000000..7597717 --- /dev/null +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +cudf::io::table_with_metadata read_csv(std::string const& file_path) +{ + auto source_info = cudf::io::source_info(file_path); + auto builder = cudf::io::csv_reader_options::builder(source_info); + auto options = builder.build(); + return cudf::io::read_csv(options); +} + +void write_csv(cudf::table_view const& tbl_view, std::string const& file_path) +{ + auto sink_info = cudf::io::sink_info(file_path); + auto builder = cudf::io::csv_writer_options::builder(sink_info, tbl_view); + auto options = builder.build(); + cudf::io::write_csv(options); +} + +std::unique_ptr cuml_regression_on_groupby(cudf::table_view stock_info_table) +{ + // Schema: | Timestamp | Name | X | Y + auto keys = cudf::table_view{{stock_info_table.column(1)}}; // name + + // Compute the average of each company's closing price with entire column + cudf::groupby::groupby grpby_obj(keys); + + cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(stock_info_table.select({2,3})); + return std::make_unique(stock_info_table.select({2,3})); +} + +int main(int argc, char** argv) +{ + // Read data + auto stock_table_with_metadata = read_csv("test.csv"); + + // Process + auto result = cuml_regression_on_groupby(*stock_table_with_metadata.tbl); + + // Write out result + write_csv(*result, "test_out.csv"); + + return 0; +} diff --git a/libcuml-libcudf-groupby/test.csv b/libcuml-libcudf-groupby/test.csv new file mode 100644 index 0000000..8c28ade --- /dev/null +++ b/libcuml-libcudf-groupby/test.csv @@ -0,0 +1,722 @@ +timestamp,name,x,y +2000-01-01T00:00:00.000000000Z,Jerry,-0.725651255,0.809144301 +2000-01-01T01:00:00.000000000Z,Ingrid,0.724376755,0.079878908 +2000-01-01T02:00:00.000000000Z,Norbert,-0.121853522,0.23203875 +2000-01-01T03:00:00.000000000Z,Hannah,0.942580783,0.960442692 +2000-01-01T04:00:00.000000000Z,Bob,0.14344122,0.65414634 +2000-01-01T05:00:00.000000000Z,Norbert,0.089906993,-0.118327421 +2000-01-01T06:00:00.000000000Z,Norbert,0.260825986,-0.252676137 +2000-01-01T07:00:00.000000000Z,Wendy,0.54938695,-0.083619934 +2000-01-01T08:00:00.000000000Z,Ursula,0.518484771,0.184568059 +2000-01-01T09:00:00.000000000Z,Alice,0.857044264,0.09400193 +2000-01-01T10:00:00.000000000Z,Norbert,0.037111759,-0.403574738 +2000-01-01T11:00:00.000000000Z,Frank,0.750616027,0.321422013 +2000-01-01T12:00:00.000000000Z,Dan,-0.095991879,0.794457816 +2000-01-01T13:00:00.000000000Z,Laura,-0.422566198,0.426812626 +2000-01-01T14:00:00.000000000Z,Hannah,-0.213330723,0.230573787 +2000-01-01T15:00:00.000000000Z,Kevin,0.804998226,-0.942640248 +2000-01-01T16:00:00.000000000Z,George,-0.253046107,-0.51170777 +2000-01-01T17:00:00.000000000Z,Dan,0.407655327,0.667905696 +2000-01-01T18:00:00.000000000Z,Wendy,-0.82417165,-0.277391076 +2000-01-01T19:00:00.000000000Z,Quinn,-0.713642469,0.670084912 +2000-01-01T20:00:00.000000000Z,Ray,-0.01469764,-0.260630578 +2000-01-01T21:00:00.000000000Z,Wendy,-0.827552373,-0.095904868 +2000-01-01T22:00:00.000000000Z,Ray,-0.458136083,-0.546017757 +2000-01-01T23:00:00.000000000Z,Zelda,0.389294061,-0.623495834 +2000-01-02T00:00:00.000000000Z,Alice,-0.055878903,-0.758457911 +2000-01-02T01:00:00.000000000Z,Alice,-0.220606554,-0.304748548 +2000-01-02T02:00:00.000000000Z,Kevin,-0.661213891,0.340846995 +2000-01-02T03:00:00.000000000Z,Laura,0.664811502,0.539368391 +2000-01-02T04:00:00.000000000Z,Dan,0.233039161,-0.868308119 +2000-01-02T05:00:00.000000000Z,Sarah,0.74868316,-0.190158066 +2000-01-02T06:00:00.000000000Z,Quinn,-0.895270826,-0.365417309 +2000-01-02T07:00:00.000000000Z,Sarah,-0.583947671,0.146374071 +2000-01-02T08:00:00.000000000Z,Tim,0.495926828,0.825330221 +2000-01-02T09:00:00.000000000Z,Jerry,-0.945643495,0.658849865 +2000-01-02T10:00:00.000000000Z,Wendy,-0.910714918,-0.575940447 +2000-01-02T11:00:00.000000000Z,Frank,-0.515248216,0.101218403 +2000-01-02T12:00:00.000000000Z,Laura,0.00213344,-0.337775577 +2000-01-02T13:00:00.000000000Z,Edith,-0.704094464,0.639494176 +2000-01-02T14:00:00.000000000Z,Ursula,0.83496987,0.12904471 +2000-01-02T15:00:00.000000000Z,Sarah,-0.065794265,-0.038618653 +2000-01-02T16:00:00.000000000Z,Kevin,-0.80448378,0.436383719 +2000-01-02T17:00:00.000000000Z,Tim,-0.681919122,-0.595318788 +2000-01-02T18:00:00.000000000Z,Xavier,0.255720886,0.841695402 +2000-01-02T19:00:00.000000000Z,Quinn,-0.965804382,0.681595486 +2000-01-02T20:00:00.000000000Z,Norbert,-0.90686103,0.763587656 +2000-01-02T21:00:00.000000000Z,Charlie,0.829301744,-0.656583373 +2000-01-02T22:00:00.000000000Z,Edith,0.803958958,0.683385678 +2000-01-02T23:00:00.000000000Z,Laura,-0.322535698,0.370567051 +2000-01-03T00:00:00.000000000Z,Dan,-0.346915778,-0.230772538 +2000-01-03T01:00:00.000000000Z,Edith,-0.949148676,0.666034493 +2000-01-03T02:00:00.000000000Z,Sarah,0.232597915,-0.239081875 +2000-01-03T03:00:00.000000000Z,Norbert,-0.55002416,-0.025579657 +2000-01-03T04:00:00.000000000Z,Dan,-0.12041877,0.64085898 +2000-01-03T05:00:00.000000000Z,Jerry,0.4037315,0.956853129 +2000-01-03T06:00:00.000000000Z,Victor,0.817953661,0.38570566 +2000-01-03T07:00:00.000000000Z,Ursula,-0.976781316,-0.680851798 +2000-01-03T08:00:00.000000000Z,Dan,-0.175173743,0.567485654 +2000-01-03T09:00:00.000000000Z,Yvonne,-0.362302167,0.254232826 +2000-01-03T10:00:00.000000000Z,Kevin,-0.359326577,-0.616336174 +2000-01-03T11:00:00.000000000Z,Ingrid,0.833494271,-0.821537089 +2000-01-03T12:00:00.000000000Z,Ray,-0.95718637,-0.118344952 +2000-01-03T13:00:00.000000000Z,Wendy,-0.892602854,0.343945585 +2000-01-03T14:00:00.000000000Z,Wendy,-0.284998766,0.184852808 +2000-01-03T15:00:00.000000000Z,Norbert,0.650359152,-0.560076032 +2000-01-03T16:00:00.000000000Z,George,0.19732109,0.28472015 +2000-01-03T17:00:00.000000000Z,Jerry,0.169320631,-0.964101827 +2000-01-03T18:00:00.000000000Z,Quinn,-0.630871463,0.042032248 +2000-01-03T19:00:00.000000000Z,Alice,0.108369243,0.588134887 +2000-01-03T20:00:00.000000000Z,Ingrid,-0.125200939,0.201487536 +2000-01-03T21:00:00.000000000Z,Xavier,-0.683505643,-0.738259017 +2000-01-03T22:00:00.000000000Z,George,0.194040317,0.284800284 +2000-01-03T23:00:00.000000000Z,Frank,0.359588242,-0.783856142 +2000-01-04T00:00:00.000000000Z,Xavier,-0.968040083,0.227798198 +2000-01-04T01:00:00.000000000Z,Ingrid,-0.274130536,0.239548191 +2000-01-04T02:00:00.000000000Z,Jerry,-0.258201864,-0.818299273 +2000-01-04T03:00:00.000000000Z,Oliver,0.394988191,-0.526190834 +2000-01-04T04:00:00.000000000Z,Alice,-0.161746306,0.712368746 +2000-01-04T05:00:00.000000000Z,Quinn,-0.100220272,-0.930035663 +2000-01-04T06:00:00.000000000Z,Jerry,0.946106984,0.0011056 +2000-01-04T07:00:00.000000000Z,Edith,-0.961981469,-0.781997194 +2000-01-04T08:00:00.000000000Z,Tim,0.147356945,0.42901334 +2000-01-04T09:00:00.000000000Z,Quinn,-0.535175442,0.202329259 +2000-01-04T10:00:00.000000000Z,Norbert,-0.3466746,-0.621657973 +2000-01-04T11:00:00.000000000Z,Patricia,0.962332315,0.788944453 +2000-01-04T12:00:00.000000000Z,Jerry,0.75409136,-0.116201947 +2000-01-04T13:00:00.000000000Z,Hannah,-0.094058576,0.337139567 +2000-01-04T14:00:00.000000000Z,Ingrid,-0.139977646,0.288188476 +2000-01-04T15:00:00.000000000Z,Hannah,-0.235448898,-0.83432021 +2000-01-04T16:00:00.000000000Z,George,-0.262083656,0.91364131 +2000-01-04T17:00:00.000000000Z,Hannah,0.640475987,-0.458988384 +2000-01-04T18:00:00.000000000Z,Alice,-0.724599217,-0.33561405 +2000-01-04T19:00:00.000000000Z,Laura,-0.504897275,-0.712337433 +2000-01-04T20:00:00.000000000Z,Quinn,-0.751678389,0.268733438 +2000-01-04T21:00:00.000000000Z,Hannah,0.565156068,0.504377087 +2000-01-04T22:00:00.000000000Z,Ray,-0.915228646,-0.114583143 +2000-01-04T23:00:00.000000000Z,Kevin,0.850670219,0.052099101 +2000-01-05T00:00:00.000000000Z,Oliver,0.004306439,-0.279452549 +2000-01-05T01:00:00.000000000Z,Charlie,0.841107362,-0.844157164 +2000-01-05T02:00:00.000000000Z,Dan,-0.562306771,-0.353136133 +2000-01-05T03:00:00.000000000Z,Ray,-0.670853839,0.784124244 +2000-01-05T04:00:00.000000000Z,Norbert,0.525883026,0.13534494 +2000-01-05T05:00:00.000000000Z,Zelda,0.311708828,-0.96761064 +2000-01-05T06:00:00.000000000Z,Norbert,-0.364418819,0.115434379 +2000-01-05T07:00:00.000000000Z,Charlie,0.163925943,-0.885641298 +2000-01-05T08:00:00.000000000Z,Bob,-0.16275815,-0.181630444 +2000-01-05T09:00:00.000000000Z,Ray,-0.940551848,-0.931072083 +2000-01-05T10:00:00.000000000Z,Dan,0.088540507,0.316596536 +2000-01-05T11:00:00.000000000Z,Jerry,-0.890278294,-0.925497948 +2000-01-05T12:00:00.000000000Z,Oliver,-0.977626813,-0.491750963 +2000-01-05T13:00:00.000000000Z,Quinn,0.161738673,-0.182010297 +2000-01-05T14:00:00.000000000Z,Ray,-0.48631602,-0.175851657 +2000-01-05T15:00:00.000000000Z,George,-0.653821033,-0.459756871 +2000-01-05T16:00:00.000000000Z,Jerry,0.708197637,-0.63116343 +2000-01-05T17:00:00.000000000Z,Kevin,-0.474478848,0.389479984 +2000-01-05T18:00:00.000000000Z,Patricia,-0.985401781,-0.760694187 +2000-01-05T19:00:00.000000000Z,Kevin,-0.31113188,0.797393669 +2000-01-05T20:00:00.000000000Z,Ursula,0.130462084,0.604733093 +2000-01-05T21:00:00.000000000Z,Quinn,0.588444199,-0.027581225 +2000-01-05T22:00:00.000000000Z,George,-0.620053299,0.340132696 +2000-01-05T23:00:00.000000000Z,Sarah,0.523008837,0.979446024 +2000-01-06T00:00:00.000000000Z,Ingrid,-0.161707249,0.561804909 +2000-01-06T01:00:00.000000000Z,Sarah,0.684120504,0.126570996 +2000-01-06T02:00:00.000000000Z,Ray,0.206180519,0.015048192 +2000-01-06T03:00:00.000000000Z,Victor,-0.866831764,-0.552739639 +2000-01-06T04:00:00.000000000Z,Zelda,0.990013608,-0.548410981 +2000-01-06T05:00:00.000000000Z,George,0.861618662,-0.06734038 +2000-01-06T06:00:00.000000000Z,Yvonne,-0.74659483,-0.744343991 +2000-01-06T07:00:00.000000000Z,Sarah,0.486758635,-0.153045448 +2000-01-06T08:00:00.000000000Z,Quinn,-0.815669611,0.585215156 +2000-01-06T09:00:00.000000000Z,Quinn,-0.180749775,0.300407902 +2000-01-06T10:00:00.000000000Z,Jerry,0.334560691,0.553183362 +2000-01-06T11:00:00.000000000Z,Hannah,0.150313516,-0.580809445 +2000-01-06T12:00:00.000000000Z,Zelda,0.611333749,0.734110775 +2000-01-06T13:00:00.000000000Z,Norbert,-0.523798311,0.788244014 +2000-01-06T14:00:00.000000000Z,Patricia,-0.187990754,-0.476188555 +2000-01-06T15:00:00.000000000Z,Bob,0.268087319,0.179782943 +2000-01-06T16:00:00.000000000Z,Yvonne,0.881849429,0.104399693 +2000-01-06T17:00:00.000000000Z,Patricia,0.057463329,0.450369796 +2000-01-06T18:00:00.000000000Z,Norbert,-0.926586199,0.562392965 +2000-01-06T19:00:00.000000000Z,George,-0.587372544,-0.27483887 +2000-01-06T20:00:00.000000000Z,Hannah,0.96837304,0.418888202 +2000-01-06T21:00:00.000000000Z,Alice,0.592901493,-0.315277844 +2000-01-06T22:00:00.000000000Z,Sarah,-0.46649401,0.703000762 +2000-01-06T23:00:00.000000000Z,Wendy,0.637493503,-0.098089441 +2000-01-07T00:00:00.000000000Z,Jerry,-0.05033583,0.393741272 +2000-01-07T01:00:00.000000000Z,Oliver,0.918055167,-0.655293771 +2000-01-07T02:00:00.000000000Z,Alice,0.63148802,0.160873494 +2000-01-07T03:00:00.000000000Z,Michael,0.872080665,0.419211368 +2000-01-07T04:00:00.000000000Z,Frank,0.953169387,-0.256584368 +2000-01-07T05:00:00.000000000Z,Ingrid,-0.220217877,0.829542049 +2000-01-07T06:00:00.000000000Z,Tim,-0.877499433,-0.976668619 +2000-01-07T07:00:00.000000000Z,Victor,0.485456695,-0.199698774 +2000-01-07T08:00:00.000000000Z,Zelda,-0.927581133,0.4253806 +2000-01-07T09:00:00.000000000Z,Tim,-0.467193197,0.979031899 +2000-01-07T10:00:00.000000000Z,Oliver,0.348607406,-0.243676099 +2000-01-07T11:00:00.000000000Z,Yvonne,-0.076574675,-0.00565902 +2000-01-07T12:00:00.000000000Z,Ingrid,0.381255231,-0.881771508 +2000-01-07T13:00:00.000000000Z,Hannah,-0.582048491,0.901719855 +2000-01-07T14:00:00.000000000Z,Zelda,-0.506276447,-0.529662571 +2000-01-07T15:00:00.000000000Z,Ray,0.423979093,0.370795039 +2000-01-07T16:00:00.000000000Z,Jerry,-0.904758765,-0.783301051 +2000-01-07T17:00:00.000000000Z,Patricia,-0.568381285,-0.359259593 +2000-01-07T18:00:00.000000000Z,Kevin,-0.519527217,0.035860025 +2000-01-07T19:00:00.000000000Z,Yvonne,-0.174206517,0.10678805 +2000-01-07T20:00:00.000000000Z,Zelda,-0.952976852,0.821893725 +2000-01-07T21:00:00.000000000Z,Ursula,0.212787837,0.006605404 +2000-01-07T22:00:00.000000000Z,Tim,0.248165926,0.318319111 +2000-01-07T23:00:00.000000000Z,Ray,0.694721769,-0.416354435 +2000-01-08T00:00:00.000000000Z,Hannah,-0.583921584,0.616558536 +2000-01-08T01:00:00.000000000Z,Bob,0.492087993,0.822621265 +2000-01-08T02:00:00.000000000Z,Ingrid,0.659882333,-0.67125323 +2000-01-08T03:00:00.000000000Z,Ursula,0.29706899,-0.474004951 +2000-01-08T04:00:00.000000000Z,Yvonne,0.236282734,-0.172630939 +2000-01-08T05:00:00.000000000Z,Michael,0.445461669,-0.465530984 +2000-01-08T06:00:00.000000000Z,Quinn,-0.358387629,-0.207498975 +2000-01-08T07:00:00.000000000Z,Frank,0.362661269,0.018709601 +2000-01-08T08:00:00.000000000Z,Sarah,-0.231678616,0.687251608 +2000-01-08T09:00:00.000000000Z,Michael,0.042238985,0.11267688 +2000-01-08T10:00:00.000000000Z,Edith,0.715806923,-0.374575848 +2000-01-08T11:00:00.000000000Z,Edith,0.706718611,0.758083093 +2000-01-08T12:00:00.000000000Z,Michael,-0.843369843,0.563702711 +2000-01-08T13:00:00.000000000Z,Edith,-0.51698696,0.78083253 +2000-01-08T14:00:00.000000000Z,Michael,0.800683376,-0.88356044 +2000-01-08T15:00:00.000000000Z,George,0.990192375,-0.158330503 +2000-01-08T16:00:00.000000000Z,Oliver,0.045516331,-0.299692888 +2000-01-08T17:00:00.000000000Z,Xavier,0.58504598,-0.803117469 +2000-01-08T18:00:00.000000000Z,Ursula,-0.400155745,-0.135123859 +2000-01-08T19:00:00.000000000Z,Oliver,-0.96919945,0.808885193 +2000-01-08T20:00:00.000000000Z,Zelda,0.492538237,-0.098603406 +2000-01-08T21:00:00.000000000Z,Ray,0.819533846,-0.133577279 +2000-01-08T22:00:00.000000000Z,Michael,-0.338272424,0.604694219 +2000-01-08T23:00:00.000000000Z,Norbert,-0.325302644,0.286659531 +2000-01-09T00:00:00.000000000Z,Wendy,-0.575464024,0.628382128 +2000-01-09T01:00:00.000000000Z,Kevin,0.442444148,0.724428927 +2000-01-09T02:00:00.000000000Z,Edith,-0.529420252,-0.422357219 +2000-01-09T03:00:00.000000000Z,Xavier,0.333178662,-0.191592137 +2000-01-09T04:00:00.000000000Z,Dan,-0.753891769,-0.279654095 +2000-01-09T05:00:00.000000000Z,Victor,0.03506808,0.662712306 +2000-01-09T06:00:00.000000000Z,Oliver,0.432660132,-0.52711771 +2000-01-09T07:00:00.000000000Z,Ingrid,-0.173528941,0.59573419 +2000-01-09T08:00:00.000000000Z,Xavier,0.209000071,0.674383874 +2000-01-09T09:00:00.000000000Z,Dan,0.976343387,-0.693057596 +2000-01-09T10:00:00.000000000Z,Norbert,0.048982231,-0.685989337 +2000-01-09T11:00:00.000000000Z,Edith,-0.713486097,0.11845597 +2000-01-09T12:00:00.000000000Z,George,-0.045243262,0.765048964 +2000-01-09T13:00:00.000000000Z,Edith,0.634411861,0.703882018 +2000-01-09T14:00:00.000000000Z,Alice,0.374738642,0.289107578 +2000-01-09T15:00:00.000000000Z,Jerry,0.538172785,-0.825734577 +2000-01-09T16:00:00.000000000Z,Charlie,0.122400184,-0.394449963 +2000-01-09T17:00:00.000000000Z,Bob,0.088084382,-0.680194547 +2000-01-09T18:00:00.000000000Z,Laura,0.772757063,-0.414369823 +2000-01-09T19:00:00.000000000Z,Alice,-0.129464888,0.201023698 +2000-01-09T20:00:00.000000000Z,Ingrid,0.12138887,0.488046213 +2000-01-09T21:00:00.000000000Z,Laura,0.018848186,-0.267155212 +2000-01-09T22:00:00.000000000Z,Charlie,0.696512977,0.79045162 +2000-01-09T23:00:00.000000000Z,Wendy,0.820744372,0.431863734 +2000-01-10T00:00:00.000000000Z,Victor,-0.137081312,0.259126044 +2000-01-10T01:00:00.000000000Z,Ingrid,-0.638580933,-0.761117634 +2000-01-10T02:00:00.000000000Z,Laura,0.569177013,0.580052173 +2000-01-10T03:00:00.000000000Z,Victor,-0.59878307,-0.583059109 +2000-01-10T04:00:00.000000000Z,Ray,-0.040448838,-0.111178575 +2000-01-10T05:00:00.000000000Z,Laura,0.924168908,0.595126708 +2000-01-10T06:00:00.000000000Z,Bob,0.387648882,0.114112508 +2000-01-10T07:00:00.000000000Z,George,-0.790538437,0.797383018 +2000-01-10T08:00:00.000000000Z,Bob,0.560802985,-0.666413874 +2000-01-10T09:00:00.000000000Z,George,-0.345718668,0.402190594 +2000-01-10T10:00:00.000000000Z,Sarah,0.060888817,-0.705271761 +2000-01-10T11:00:00.000000000Z,Dan,0.712448833,-0.592547903 +2000-01-10T12:00:00.000000000Z,Sarah,-0.941175153,-0.365686133 +2000-01-10T13:00:00.000000000Z,Ingrid,-0.657775076,-0.29396709 +2000-01-10T14:00:00.000000000Z,Quinn,-0.955170316,-0.841782029 +2000-01-10T15:00:00.000000000Z,Jerry,0.729705576,0.039371645 +2000-01-10T16:00:00.000000000Z,Jerry,0.776708899,-0.085631976 +2000-01-10T17:00:00.000000000Z,Ray,0.687683972,0.60063161 +2000-01-10T18:00:00.000000000Z,Dan,0.727503467,0.899171386 +2000-01-10T19:00:00.000000000Z,Ursula,0.239412048,-0.61334528 +2000-01-10T20:00:00.000000000Z,Charlie,0.863218739,-0.863059642 +2000-01-10T21:00:00.000000000Z,Laura,-0.97089725,0.201217541 +2000-01-10T22:00:00.000000000Z,Charlie,-0.859060041,-0.813713448 +2000-01-10T23:00:00.000000000Z,Bob,0.349893881,0.209518609 +2000-01-11T00:00:00.000000000Z,Frank,0.046895494,0.375303852 +2000-01-11T01:00:00.000000000Z,Charlie,-0.830162695,0.836749229 +2000-01-11T02:00:00.000000000Z,Quinn,-0.43374249,0.709045063 +2000-01-11T03:00:00.000000000Z,Ray,0.825048267,0.520276228 +2000-01-11T04:00:00.000000000Z,Kevin,-0.815045419,0.408528821 +2000-01-11T05:00:00.000000000Z,Ingrid,-0.348285458,0.930986804 +2000-01-11T06:00:00.000000000Z,Michael,-0.564888238,-0.498937509 +2000-01-11T07:00:00.000000000Z,Patricia,0.836948019,0.684542446 +2000-01-11T08:00:00.000000000Z,Wendy,0.22930114,-0.641064372 +2000-01-11T09:00:00.000000000Z,Quinn,0.369624689,-0.526934352 +2000-01-11T10:00:00.000000000Z,Yvonne,-0.505937256,0.093036209 +2000-01-11T11:00:00.000000000Z,George,0.773909619,-0.731979142 +2000-01-11T12:00:00.000000000Z,Alice,0.357582575,-0.69896089 +2000-01-11T13:00:00.000000000Z,Laura,0.294515883,0.276792839 +2000-01-11T14:00:00.000000000Z,Ingrid,0.379395921,-0.468129476 +2000-01-11T15:00:00.000000000Z,Dan,0.66861005,0.495182337 +2000-01-11T16:00:00.000000000Z,Tim,0.272539908,0.364115992 +2000-01-11T17:00:00.000000000Z,Alice,0.624350976,0.754877696 +2000-01-11T18:00:00.000000000Z,Jerry,-0.02692278,0.913727404 +2000-01-11T19:00:00.000000000Z,Norbert,-0.151739954,0.304635039 +2000-01-11T20:00:00.000000000Z,Michael,-0.860954155,0.856056409 +2000-01-11T21:00:00.000000000Z,Dan,0.676718253,-0.66047146 +2000-01-11T22:00:00.000000000Z,Frank,0.35192887,0.806826852 +2000-01-11T23:00:00.000000000Z,Ray,-0.322415394,0.074473201 +2000-01-12T00:00:00.000000000Z,Yvonne,-0.179510086,-0.804883838 +2000-01-12T01:00:00.000000000Z,Laura,0.298320723,0.411509298 +2000-01-12T02:00:00.000000000Z,George,0.97589387,0.44949671 +2000-01-12T03:00:00.000000000Z,Jerry,0.747028833,0.162891283 +2000-01-12T04:00:00.000000000Z,Ursula,0.643098395,0.221449609 +2000-01-12T05:00:00.000000000Z,Quinn,-0.999764639,-0.065009691 +2000-01-12T06:00:00.000000000Z,Laura,0.94796442,-0.70352206 +2000-01-12T07:00:00.000000000Z,Kevin,-0.441840309,-0.708515427 +2000-01-12T08:00:00.000000000Z,Yvonne,-0.034999828,-0.491816371 +2000-01-12T09:00:00.000000000Z,Sarah,0.441763646,0.112913943 +2000-01-12T10:00:00.000000000Z,Dan,-0.57392946,-0.462078375 +2000-01-12T11:00:00.000000000Z,Xavier,0.946253363,-0.020806171 +2000-01-12T12:00:00.000000000Z,Charlie,0.938499597,0.398346671 +2000-01-12T13:00:00.000000000Z,Frank,-0.493445993,0.517699509 +2000-01-12T14:00:00.000000000Z,Bob,-0.296769202,0.859710177 +2000-01-12T15:00:00.000000000Z,Laura,-0.850020531,-0.229671037 +2000-01-12T16:00:00.000000000Z,Oliver,-0.5560211,-0.055419339 +2000-01-12T17:00:00.000000000Z,Ursula,-0.066550195,0.389147512 +2000-01-12T18:00:00.000000000Z,Bob,0.026519256,0.432145692 +2000-01-12T19:00:00.000000000Z,Ingrid,0.725311831,0.179591924 +2000-01-12T20:00:00.000000000Z,Kevin,-0.568751762,0.735987217 +2000-01-12T21:00:00.000000000Z,Oliver,-0.974505922,-0.617949723 +2000-01-12T22:00:00.000000000Z,Patricia,-0.441331225,-0.254801205 +2000-01-12T23:00:00.000000000Z,Ray,-0.331626087,-0.355681792 +2000-01-13T00:00:00.000000000Z,Tim,-0.626334808,-0.318145319 +2000-01-13T01:00:00.000000000Z,Oliver,-0.600896199,-0.553415491 +2000-01-13T02:00:00.000000000Z,Victor,0.287915317,-0.142296216 +2000-01-13T03:00:00.000000000Z,Yvonne,-0.467743348,0.722156599 +2000-01-13T04:00:00.000000000Z,Victor,-0.077113727,0.939364158 +2000-01-13T05:00:00.000000000Z,Michael,0.985722559,-0.469295651 +2000-01-13T06:00:00.000000000Z,Alice,-0.431919781,-0.867920299 +2000-01-13T07:00:00.000000000Z,Norbert,-0.549563144,-0.003490502 +2000-01-13T08:00:00.000000000Z,Kevin,0.761495462,0.313195919 +2000-01-13T09:00:00.000000000Z,Wendy,0.895397984,0.827411362 +2000-01-13T10:00:00.000000000Z,Edith,0.751486306,-0.021948644 +2000-01-13T11:00:00.000000000Z,Charlie,0.917069552,0.395793577 +2000-01-13T12:00:00.000000000Z,Xavier,-0.405193885,-0.198624457 +2000-01-13T13:00:00.000000000Z,Oliver,-0.818851374,0.600797214 +2000-01-13T14:00:00.000000000Z,Ray,-0.210373417,0.843899582 +2000-01-13T15:00:00.000000000Z,George,-0.396033683,0.623556774 +2000-01-13T16:00:00.000000000Z,Laura,-0.747382958,-0.309533831 +2000-01-13T17:00:00.000000000Z,Victor,-0.385022204,-0.821141381 +2000-01-13T18:00:00.000000000Z,Ray,-0.620682429,0.789333419 +2000-01-13T19:00:00.000000000Z,Kevin,-0.563114693,0.70402621 +2000-01-13T20:00:00.000000000Z,Tim,-0.792350141,0.186614282 +2000-01-13T21:00:00.000000000Z,Charlie,0.923424453,-0.696335967 +2000-01-13T22:00:00.000000000Z,Kevin,0.25157779,0.099025797 +2000-01-13T23:00:00.000000000Z,Kevin,-0.410248985,-0.383068972 +2000-01-14T00:00:00.000000000Z,Ray,-0.60658185,-0.659994974 +2000-01-14T01:00:00.000000000Z,Norbert,0.117803121,0.442984784 +2000-01-14T02:00:00.000000000Z,Frank,-0.213717412,-0.943254454 +2000-01-14T03:00:00.000000000Z,Michael,-0.872283977,-0.445721886 +2000-01-14T04:00:00.000000000Z,Zelda,-0.970191291,-0.808886757 +2000-01-14T05:00:00.000000000Z,Victor,0.046089956,0.821793351 +2000-01-14T06:00:00.000000000Z,Alice,0.163593988,-0.484110827 +2000-01-14T07:00:00.000000000Z,Ingrid,0.412715284,0.886806855 +2000-01-14T08:00:00.000000000Z,Ray,0.72667235,0.631154925 +2000-01-14T09:00:00.000000000Z,Victor,-0.511943436,0.200893411 +2000-01-14T10:00:00.000000000Z,Norbert,0.340676564,0.566105299 +2000-01-14T11:00:00.000000000Z,Ray,0.305098101,-0.752769494 +2000-01-14T12:00:00.000000000Z,Charlie,-0.922436449,0.125341712 +2000-01-14T13:00:00.000000000Z,Hannah,-0.602017535,-0.899302776 +2000-01-14T14:00:00.000000000Z,Bob,0.387131305,0.746808742 +2000-01-14T15:00:00.000000000Z,Ursula,-0.345147333,-0.916502068 +2000-01-14T16:00:00.000000000Z,Jerry,0.323641655,0.302136081 +2000-01-14T17:00:00.000000000Z,Charlie,-0.54923104,-0.164274294 +2000-01-14T18:00:00.000000000Z,Xavier,-0.676585094,0.171844548 +2000-01-14T19:00:00.000000000Z,Dan,0.656220802,0.174524446 +2000-01-14T20:00:00.000000000Z,Alice,-0.197326516,-0.263954692 +2000-01-14T21:00:00.000000000Z,Xavier,-0.372934415,-0.829834619 +2000-01-14T22:00:00.000000000Z,Tim,-0.573040164,0.069688596 +2000-01-14T23:00:00.000000000Z,Quinn,-0.067945179,-0.527242248 +2000-01-15T00:00:00.000000000Z,Victor,-0.955255789,0.662410755 +2000-01-15T01:00:00.000000000Z,Yvonne,0.415988487,-0.832812392 +2000-01-15T02:00:00.000000000Z,Dan,0.593444652,-0.7307585 +2000-01-15T03:00:00.000000000Z,Kevin,-0.246746711,-0.87059359 +2000-01-15T04:00:00.000000000Z,Ray,-0.324997187,-0.748648808 +2000-01-15T05:00:00.000000000Z,Jerry,0.543800502,0.035358073 +2000-01-15T06:00:00.000000000Z,Jerry,0.964143544,-0.222120318 +2000-01-15T07:00:00.000000000Z,Jerry,-0.754105549,0.06968864 +2000-01-15T08:00:00.000000000Z,Sarah,-0.770298695,-0.037156306 +2000-01-15T09:00:00.000000000Z,Laura,0.560738268,0.537741849 +2000-01-15T10:00:00.000000000Z,Ursula,-0.158582567,0.954099136 +2000-01-15T11:00:00.000000000Z,Norbert,0.426290677,-0.788440151 +2000-01-15T12:00:00.000000000Z,Alice,-0.261455882,0.529117459 +2000-01-15T13:00:00.000000000Z,Laura,0.461372891,-0.623705015 +2000-01-15T14:00:00.000000000Z,Ursula,0.729408838,0.571332713 +2000-01-15T15:00:00.000000000Z,Oliver,-0.239020504,-0.201011967 +2000-01-15T16:00:00.000000000Z,Ray,0.472366859,0.450088378 +2000-01-15T17:00:00.000000000Z,Jerry,0.533082823,0.6868473 +2000-01-15T18:00:00.000000000Z,Xavier,0.196016872,-0.514090942 +2000-01-15T19:00:00.000000000Z,Jerry,0.09875317,-0.912550578 +2000-01-15T20:00:00.000000000Z,Ursula,-0.409743072,-0.553053062 +2000-01-15T21:00:00.000000000Z,Patricia,0.725555369,-0.613665538 +2000-01-15T22:00:00.000000000Z,Quinn,0.48476817,-0.190454889 +2000-01-15T23:00:00.000000000Z,Alice,0.67595494,0.144644178 +2000-01-16T00:00:00.000000000Z,Quinn,0.180503853,-0.642714173 +2000-01-16T01:00:00.000000000Z,Quinn,-0.037667738,-0.944372526 +2000-01-16T02:00:00.000000000Z,Yvonne,0.808262072,-0.473409731 +2000-01-16T03:00:00.000000000Z,George,-0.93532024,0.117754192 +2000-01-16T04:00:00.000000000Z,Kevin,-0.751864264,0.150781172 +2000-01-16T05:00:00.000000000Z,Frank,-0.816510388,0.211110391 +2000-01-16T06:00:00.000000000Z,Oliver,0.071417637,-0.354575305 +2000-01-16T07:00:00.000000000Z,Michael,-0.253680049,-0.578096395 +2000-01-16T08:00:00.000000000Z,Yvonne,-0.480367386,-0.80533603 +2000-01-16T09:00:00.000000000Z,Wendy,-0.719686801,-0.930730011 +2000-01-16T10:00:00.000000000Z,Yvonne,0.500332772,0.587192099 +2000-01-16T11:00:00.000000000Z,Oliver,0.975957997,0.268817165 +2000-01-16T12:00:00.000000000Z,Oliver,-0.830742466,0.003021245 +2000-01-16T13:00:00.000000000Z,George,0.314592451,0.648282667 +2000-01-16T14:00:00.000000000Z,Patricia,0.458834517,0.534123757 +2000-01-16T15:00:00.000000000Z,Patricia,0.108011373,-0.894255296 +2000-01-16T16:00:00.000000000Z,Michael,-0.050047142,0.093614771 +2000-01-16T17:00:00.000000000Z,Ursula,0.928515198,0.775120798 +2000-01-16T18:00:00.000000000Z,Edith,0.941560355,-0.830164346 +2000-01-16T19:00:00.000000000Z,Charlie,-0.241632897,0.322340927 +2000-01-16T20:00:00.000000000Z,Zelda,-0.153116163,-0.063196708 +2000-01-16T21:00:00.000000000Z,Hannah,-0.783526218,0.818222093 +2000-01-16T22:00:00.000000000Z,Norbert,-0.922890783,-0.969755562 +2000-01-16T23:00:00.000000000Z,Laura,0.820462604,0.883342778 +2000-01-17T00:00:00.000000000Z,Ingrid,-0.80161345,-0.021329352 +2000-01-17T01:00:00.000000000Z,Victor,-0.462127459,0.979938015 +2000-01-17T02:00:00.000000000Z,Hannah,0.839325719,0.446819347 +2000-01-17T03:00:00.000000000Z,Dan,-0.147124501,0.786967991 +2000-01-17T04:00:00.000000000Z,Ursula,0.172922465,0.62100577 +2000-01-17T05:00:00.000000000Z,Michael,0.057349124,-0.440006789 +2000-01-17T06:00:00.000000000Z,Victor,-0.668285585,0.999647014 +2000-01-17T07:00:00.000000000Z,Yvonne,0.002647376,-0.017344558 +2000-01-17T08:00:00.000000000Z,Laura,-0.051658805,-0.894844096 +2000-01-17T09:00:00.000000000Z,Zelda,-0.798157805,-0.647029133 +2000-01-17T10:00:00.000000000Z,Ingrid,-0.83309881,-0.329951729 +2000-01-17T11:00:00.000000000Z,Ray,-0.813017061,0.676097575 +2000-01-17T12:00:00.000000000Z,Hannah,-0.21055804,0.65880375 +2000-01-17T13:00:00.000000000Z,Laura,-0.083743566,-0.745883459 +2000-01-17T14:00:00.000000000Z,Edith,0.509067881,0.281637686 +2000-01-17T15:00:00.000000000Z,Quinn,0.454274719,0.514519469 +2000-01-17T16:00:00.000000000Z,Ingrid,-0.981286833,0.093474638 +2000-01-17T17:00:00.000000000Z,Zelda,0.848823469,-0.972470824 +2000-01-17T18:00:00.000000000Z,Xavier,0.312587416,0.786763765 +2000-01-17T19:00:00.000000000Z,Wendy,0.075815635,0.103147741 +2000-01-17T20:00:00.000000000Z,Victor,-0.052323508,-0.920652902 +2000-01-17T21:00:00.000000000Z,Norbert,-0.338299581,0.183863611 +2000-01-17T22:00:00.000000000Z,Ursula,0.479012039,-0.37283211 +2000-01-17T23:00:00.000000000Z,Quinn,-0.508222407,0.925321337 +2000-01-18T00:00:00.000000000Z,Dan,0.596197184,0.267040465 +2000-01-18T01:00:00.000000000Z,Alice,-0.956050373,0.358610764 +2000-01-18T02:00:00.000000000Z,George,-0.325921989,0.150330883 +2000-01-18T03:00:00.000000000Z,Oliver,-0.969155283,0.746993597 +2000-01-18T04:00:00.000000000Z,Patricia,0.925369216,-0.366100442 +2000-01-18T05:00:00.000000000Z,Jerry,0.09555669,-0.964862726 +2000-01-18T06:00:00.000000000Z,Ursula,0.833787271,-0.281901488 +2000-01-18T07:00:00.000000000Z,Frank,0.624135754,-0.364063126 +2000-01-18T08:00:00.000000000Z,Ingrid,0.48579064,-0.375554364 +2000-01-18T09:00:00.000000000Z,Edith,-0.348090034,0.71248562 +2000-01-18T10:00:00.000000000Z,George,0.189368864,0.466896093 +2000-01-18T11:00:00.000000000Z,Kevin,0.820659242,0.816862395 +2000-01-18T12:00:00.000000000Z,Charlie,0.033295221,-0.281452346 +2000-01-18T13:00:00.000000000Z,Tim,0.363017853,0.983507404 +2000-01-18T14:00:00.000000000Z,Kevin,0.359397901,0.342799829 +2000-01-18T15:00:00.000000000Z,Norbert,-0.088617129,-0.93097097 +2000-01-18T16:00:00.000000000Z,Laura,-0.668200882,-0.412563961 +2000-01-18T17:00:00.000000000Z,Edith,0.427624421,0.270994384 +2000-01-18T18:00:00.000000000Z,George,-0.271505622,-0.360100978 +2000-01-18T19:00:00.000000000Z,Patricia,0.823847341,0.517380106 +2000-01-18T20:00:00.000000000Z,Ursula,-0.293165642,0.085601624 +2000-01-18T21:00:00.000000000Z,Tim,0.0455554,0.281152159 +2000-01-18T22:00:00.000000000Z,Victor,0.108626095,-0.530728733 +2000-01-18T23:00:00.000000000Z,Kevin,-0.059030331,-0.026613047 +2000-01-19T00:00:00.000000000Z,Bob,-0.84965082,-0.503121754 +2000-01-19T01:00:00.000000000Z,Edith,-0.013015823,0.74015866 +2000-01-19T02:00:00.000000000Z,Patricia,-0.49112993,0.264629988 +2000-01-19T03:00:00.000000000Z,George,-0.951198581,-0.317921856 +2000-01-19T04:00:00.000000000Z,Michael,0.290770131,0.196876672 +2000-01-19T05:00:00.000000000Z,Ray,-0.650177369,-0.380630699 +2000-01-19T06:00:00.000000000Z,Norbert,-0.595324892,0.692650627 +2000-01-19T07:00:00.000000000Z,Jerry,0.763909975,0.656235629 +2000-01-19T08:00:00.000000000Z,Yvonne,-0.980432535,-0.845132725 +2000-01-19T09:00:00.000000000Z,Jerry,-0.362342509,0.144650067 +2000-01-19T10:00:00.000000000Z,Xavier,-0.980183085,0.258303203 +2000-01-19T11:00:00.000000000Z,Charlie,0.218697787,-0.685616276 +2000-01-19T12:00:00.000000000Z,Charlie,-0.94005091,0.755403326 +2000-01-19T13:00:00.000000000Z,Laura,0.703145358,0.767100358 +2000-01-19T14:00:00.000000000Z,Kevin,0.21151274,0.964010083 +2000-01-19T15:00:00.000000000Z,Victor,-0.304124561,-0.277224316 +2000-01-19T16:00:00.000000000Z,Yvonne,0.26083936,0.997839099 +2000-01-19T17:00:00.000000000Z,Michael,-0.672595187,0.947795422 +2000-01-19T18:00:00.000000000Z,Patricia,-0.421051793,-0.271862112 +2000-01-19T19:00:00.000000000Z,Edith,0.316882361,-0.111721963 +2000-01-19T20:00:00.000000000Z,Charlie,-0.11436915,0.895076139 +2000-01-19T21:00:00.000000000Z,Xavier,0.904197074,0.170511376 +2000-01-19T22:00:00.000000000Z,Tim,0.344319442,0.368124793 +2000-01-19T23:00:00.000000000Z,Zelda,0.499073111,0.013279806 +2000-01-20T00:00:00.000000000Z,Michael,-0.621344539,0.27813039 +2000-01-20T01:00:00.000000000Z,Zelda,-0.788425375,-0.857221945 +2000-01-20T02:00:00.000000000Z,Xavier,0.049819927,-0.342336983 +2000-01-20T03:00:00.000000000Z,Michael,-0.181293515,-0.585107547 +2000-01-20T04:00:00.000000000Z,Alice,0.197152763,-0.165380151 +2000-01-20T05:00:00.000000000Z,Patricia,0.733844135,0.697831363 +2000-01-20T06:00:00.000000000Z,Alice,-0.643348296,-0.700157074 +2000-01-20T07:00:00.000000000Z,Xavier,0.083596281,-0.339667694 +2000-01-20T08:00:00.000000000Z,Ray,-0.047444024,-0.069543815 +2000-01-20T09:00:00.000000000Z,Alice,0.351610244,0.674081042 +2000-01-20T10:00:00.000000000Z,Ursula,-0.745715987,0.749803277 +2000-01-20T11:00:00.000000000Z,Hannah,0.57163067,0.270958555 +2000-01-20T12:00:00.000000000Z,Bob,-0.973975753,0.483996865 +2000-01-20T13:00:00.000000000Z,Xavier,0.121835181,0.526170536 +2000-01-20T14:00:00.000000000Z,Victor,0.05465341,0.069405992 +2000-01-20T15:00:00.000000000Z,Charlie,0.692075832,0.424759123 +2000-01-20T16:00:00.000000000Z,Victor,0.262514954,0.435643234 +2000-01-20T17:00:00.000000000Z,Alice,-0.422003855,0.472611739 +2000-01-20T18:00:00.000000000Z,Yvonne,-0.644115157,-0.446494059 +2000-01-20T19:00:00.000000000Z,Ursula,-0.950002043,-0.367474223 +2000-01-20T20:00:00.000000000Z,Oliver,0.146814173,-0.889912513 +2000-01-20T21:00:00.000000000Z,Kevin,0.247119665,0.839064546 +2000-01-20T22:00:00.000000000Z,Patricia,0.603846442,0.944158808 +2000-01-20T23:00:00.000000000Z,Ursula,-0.496933565,-0.045850255 +2000-01-21T00:00:00.000000000Z,Hannah,-0.975512116,0.559214306 +2000-01-21T01:00:00.000000000Z,Yvonne,0.057619735,0.040770418 +2000-01-21T02:00:00.000000000Z,Frank,-0.612520908,0.292968408 +2000-01-21T03:00:00.000000000Z,Hannah,0.409654909,0.472669829 +2000-01-21T04:00:00.000000000Z,Ursula,0.078742084,-0.486671231 +2000-01-21T05:00:00.000000000Z,Victor,0.94216223,-0.117037255 +2000-01-21T06:00:00.000000000Z,Bob,-0.905340962,0.848551133 +2000-01-21T07:00:00.000000000Z,Alice,-0.09976526,0.743088397 +2000-01-21T08:00:00.000000000Z,Patricia,-0.20269696,-0.6885576 +2000-01-21T09:00:00.000000000Z,Dan,-0.222466572,0.534224045 +2000-01-21T10:00:00.000000000Z,Charlie,0.805020074,-0.398303214 +2000-01-21T11:00:00.000000000Z,Norbert,-0.144840586,-0.40845228 +2000-01-21T12:00:00.000000000Z,Frank,0.700941815,-0.529287052 +2000-01-21T13:00:00.000000000Z,Charlie,-0.126233924,0.688472825 +2000-01-21T14:00:00.000000000Z,Tim,-0.963485723,-0.017073572 +2000-01-21T15:00:00.000000000Z,Yvonne,-0.814497099,-0.524951984 +2000-01-21T16:00:00.000000000Z,Xavier,0.973400172,-0.914831495 +2000-01-21T17:00:00.000000000Z,Ingrid,-0.474329733,-0.05007073 +2000-01-21T18:00:00.000000000Z,Ingrid,0.655913343,-0.253903931 +2000-01-21T19:00:00.000000000Z,Frank,-0.620343832,-0.906407569 +2000-01-21T20:00:00.000000000Z,Zelda,0.498765277,-0.598153435 +2000-01-21T21:00:00.000000000Z,Bob,0.256865313,-0.34039864 +2000-01-21T22:00:00.000000000Z,Hannah,-0.421470387,-0.530121701 +2000-01-21T23:00:00.000000000Z,Xavier,-0.35789538,-0.475953478 +2000-01-22T00:00:00.000000000Z,Xavier,0.552851323,0.089245181 +2000-01-22T01:00:00.000000000Z,Ray,0.039013304,0.336068874 +2000-01-22T02:00:00.000000000Z,Kevin,0.881547074,0.153564248 +2000-01-22T03:00:00.000000000Z,Michael,-0.844069467,0.441158673 +2000-01-22T04:00:00.000000000Z,Yvonne,-0.102696931,-0.746484668 +2000-01-22T05:00:00.000000000Z,Norbert,0.264189747,-0.984494687 +2000-01-22T06:00:00.000000000Z,Ingrid,0.647063743,0.587015389 +2000-01-22T07:00:00.000000000Z,Sarah,-0.737489917,-0.592890857 +2000-01-22T08:00:00.000000000Z,Alice,-0.085845812,0.038061085 +2000-01-22T09:00:00.000000000Z,Patricia,-0.275811851,-0.372520061 +2000-01-22T10:00:00.000000000Z,Tim,0.708879439,-0.820255486 +2000-01-22T11:00:00.000000000Z,Sarah,0.96135678,-0.847739768 +2000-01-22T12:00:00.000000000Z,Frank,-0.833188757,0.39480147 +2000-01-22T13:00:00.000000000Z,Laura,-0.556289623,-0.193507237 +2000-01-22T14:00:00.000000000Z,Oliver,0.746397105,0.854731036 +2000-01-22T15:00:00.000000000Z,Kevin,0.855083879,0.084929989 +2000-01-22T16:00:00.000000000Z,Hannah,-0.884092253,-0.271095953 +2000-01-22T17:00:00.000000000Z,Norbert,-0.380658883,0.657306568 +2000-01-22T18:00:00.000000000Z,Zelda,0.353471396,-0.335465807 +2000-01-22T19:00:00.000000000Z,George,-0.094882949,0.566134676 +2000-01-22T20:00:00.000000000Z,Bob,-0.629728592,-0.919249998 +2000-01-22T21:00:00.000000000Z,Dan,-0.968574394,-0.720591286 +2000-01-22T22:00:00.000000000Z,Frank,-0.461466768,-0.561823928 +2000-01-22T23:00:00.000000000Z,Patricia,-0.66086539,0.301115585 +2000-01-23T00:00:00.000000000Z,Jerry,0.756245367,0.769512654 +2000-01-23T01:00:00.000000000Z,Bob,-0.269194915,-0.189657732 +2000-01-23T02:00:00.000000000Z,Quinn,0.073489082,-0.958094025 +2000-01-23T03:00:00.000000000Z,Victor,-0.46738778,0.33056278 +2000-01-23T04:00:00.000000000Z,Bob,0.256510512,-0.751568825 +2000-01-23T05:00:00.000000000Z,Yvonne,-0.185059114,-0.762082778 +2000-01-23T06:00:00.000000000Z,Ursula,0.866617847,-0.880670189 +2000-01-23T07:00:00.000000000Z,Ray,-0.195422627,-0.781578341 +2000-01-23T08:00:00.000000000Z,Dan,0.330439626,-0.797006053 +2000-01-23T09:00:00.000000000Z,Victor,0.406749568,-0.26522142 +2000-01-23T10:00:00.000000000Z,George,-0.368500788,-0.161617097 +2000-01-23T11:00:00.000000000Z,Edith,0.20202377,0.950731036 +2000-01-23T12:00:00.000000000Z,Norbert,0.392761243,0.718681895 +2000-01-23T13:00:00.000000000Z,Jerry,-0.910608671,-0.281405285 +2000-01-23T14:00:00.000000000Z,Ray,-0.642290853,0.809510669 +2000-01-23T15:00:00.000000000Z,Tim,0.372245822,0.96748799 +2000-01-23T16:00:00.000000000Z,Edith,0.650311142,-0.123078661 +2000-01-23T17:00:00.000000000Z,Laura,0.428468676,0.978155697 +2000-01-23T18:00:00.000000000Z,Kevin,-0.070044321,-0.299304707 +2000-01-23T19:00:00.000000000Z,Zelda,0.619404607,-0.589562313 +2000-01-23T20:00:00.000000000Z,Hannah,-0.088984212,-0.12435044 +2000-01-23T21:00:00.000000000Z,Ursula,-0.544227152,0.414055237 +2000-01-23T22:00:00.000000000Z,Dan,0.072923601,-0.775476752 +2000-01-23T23:00:00.000000000Z,Charlie,0.695497237,0.829414372 +2000-01-24T00:00:00.000000000Z,Oliver,0.017904649,0.878208367 +2000-01-24T01:00:00.000000000Z,Bob,-0.373792005,0.281489833 +2000-01-24T02:00:00.000000000Z,Ursula,0.332669017,0.505455775 +2000-01-24T03:00:00.000000000Z,Hannah,0.506859577,0.19602744 +2000-01-24T04:00:00.000000000Z,Tim,-0.273618629,0.922534761 +2000-01-24T05:00:00.000000000Z,Ingrid,0.862970793,0.710658814 +2000-01-24T06:00:00.000000000Z,Charlie,-0.071126891,-0.300164278 +2000-01-24T07:00:00.000000000Z,Alice,0.997020512,-0.966347067 +2000-01-24T08:00:00.000000000Z,Charlie,0.955716667,0.21773558 +2000-01-24T09:00:00.000000000Z,George,0.609443113,0.609489501 +2000-01-24T10:00:00.000000000Z,Quinn,-0.442480566,0.106426361 +2000-01-24T11:00:00.000000000Z,Edith,-0.071013224,0.264496375 +2000-01-24T12:00:00.000000000Z,Wendy,-0.80793844,0.91552242 +2000-01-24T13:00:00.000000000Z,George,-0.391693539,-0.807909328 +2000-01-24T14:00:00.000000000Z,Jerry,-0.923695252,0.197132193 +2000-01-24T15:00:00.000000000Z,Sarah,0.208911575,0.942126179 +2000-01-24T16:00:00.000000000Z,Frank,-0.415389266,0.904367291 +2000-01-24T17:00:00.000000000Z,Jerry,-0.647799597,0.733838945 +2000-01-24T18:00:00.000000000Z,Tim,0.167807021,0.017598793 +2000-01-24T19:00:00.000000000Z,Hannah,-0.433542127,0.180439463 +2000-01-24T20:00:00.000000000Z,Tim,-0.356757335,-0.960500645 +2000-01-24T21:00:00.000000000Z,Ursula,-0.053272273,0.915169991 +2000-01-24T22:00:00.000000000Z,Alice,0.85902769,0.751094646 +2000-01-24T23:00:00.000000000Z,George,-0.403109749,0.508574562 +2000-01-25T00:00:00.000000000Z,Ray,0.142650653,0.232289933 +2000-01-25T01:00:00.000000000Z,Jerry,-0.078954486,0.729671238 +2000-01-25T02:00:00.000000000Z,Hannah,-0.022377729,-0.448298428 +2000-01-25T03:00:00.000000000Z,Ray,-0.847346359,0.657612067 +2000-01-25T04:00:00.000000000Z,Bob,0.193972078,-0.255171118 +2000-01-25T05:00:00.000000000Z,Norbert,0.351073292,0.073400323 +2000-01-25T06:00:00.000000000Z,George,0.511554166,-0.658415743 +2000-01-25T07:00:00.000000000Z,Bob,0.9177303,-0.221449792 +2000-01-25T08:00:00.000000000Z,Oliver,0.479895774,0.081785521 +2000-01-25T09:00:00.000000000Z,Sarah,-0.811631851,0.32597123 +2000-01-25T10:00:00.000000000Z,Norbert,-0.038490943,-0.013812504 +2000-01-25T11:00:00.000000000Z,Hannah,0.213741393,-0.154210246 +2000-01-25T12:00:00.000000000Z,Oliver,-0.401760683,0.011064583 +2000-01-25T13:00:00.000000000Z,Frank,0.164654033,-0.736885342 +2000-01-25T14:00:00.000000000Z,Alice,0.487668955,-0.84620881 +2000-01-25T15:00:00.000000000Z,Michael,0.763816028,-0.895024489 +2000-01-25T16:00:00.000000000Z,Oliver,-0.684762274,0.222806272 +2000-01-25T17:00:00.000000000Z,Kevin,-0.036978903,-0.652371397 +2000-01-25T18:00:00.000000000Z,Oliver,-0.677145984,-0.631781607 +2000-01-25T19:00:00.000000000Z,Alice,-0.58307716,0.429830129 +2000-01-25T20:00:00.000000000Z,Sarah,-0.612509673,0.030766844 +2000-01-25T21:00:00.000000000Z,Wendy,-0.42483707,-0.454160532 +2000-01-25T22:00:00.000000000Z,Victor,0.08888761,-0.648365665 +2000-01-25T23:00:00.000000000Z,Laura,-0.148059313,0.90509587 +2000-01-26T00:00:00.000000000Z,Bob,-0.700766139,-0.584641059 +2000-01-26T01:00:00.000000000Z,Edith,0.718054175,0.943948879 +2000-01-26T02:00:00.000000000Z,Charlie,-0.121458969,0.785964909 +2000-01-26T03:00:00.000000000Z,Yvonne,0.18285203,0.738449826 +2000-01-26T04:00:00.000000000Z,Zelda,0.274830113,0.234639128 +2000-01-26T05:00:00.000000000Z,George,0.399446996,0.844164999 +2000-01-26T06:00:00.000000000Z,Kevin,-0.10482326,0.037121863 +2000-01-26T07:00:00.000000000Z,Alice,0.098627533,-0.076455575 +2000-01-26T08:00:00.000000000Z,Ray,0.731537029,-0.518718383 +2000-01-26T09:00:00.000000000Z,Ursula,-0.066827043,-0.711514576 +2000-01-26T10:00:00.000000000Z,Edith,0.263471066,0.756067048 +2000-01-26T11:00:00.000000000Z,Oliver,0.134540297,0.993781782 +2000-01-26T12:00:00.000000000Z,Oliver,0.409374844,-0.169107378 +2000-01-26T13:00:00.000000000Z,Ingrid,0.258402973,0.750334049 +2000-01-26T14:00:00.000000000Z,Charlie,0.320840105,-0.49899438 +2000-01-26T15:00:00.000000000Z,Frank,-0.811849213,0.214090277 +2000-01-26T16:00:00.000000000Z,Sarah,-0.865637825,0.816046534 +2000-01-26T17:00:00.000000000Z,Tim,-0.977544152,0.4313925 +2000-01-26T18:00:00.000000000Z,Jerry,0.36113265,-0.555395121 +2000-01-26T19:00:00.000000000Z,Wendy,-0.940055524,0.308502769 +2000-01-26T20:00:00.000000000Z,Xavier,0.415577658,0.370807606 +2000-01-26T21:00:00.000000000Z,Frank,0.21518375,-0.382526293 +2000-01-26T22:00:00.000000000Z,Hannah,-0.115632704,-0.089425788 +2000-01-26T23:00:00.000000000Z,Zelda,0.07751338,-0.970601159 +2000-01-27T00:00:00.000000000Z,Charlie,-0.924066046,-0.74853676 +2000-01-27T01:00:00.000000000Z,George,0.475705025,0.958790015 +2000-01-27T02:00:00.000000000Z,Tim,-0.278556162,-0.59173474 +2000-01-27T03:00:00.000000000Z,Norbert,0.707987048,-0.160445341 +2000-01-27T04:00:00.000000000Z,Xavier,0.292569954,-0.845887585 +2000-01-27T05:00:00.000000000Z,Yvonne,-0.867689361,0.350845329 +2000-01-27T06:00:00.000000000Z,Bob,-0.573169357,0.827561507 +2000-01-27T07:00:00.000000000Z,Quinn,-0.887472048,0.984414339 +2000-01-27T08:00:00.000000000Z,Michael,0.803813521,-0.913467498 +2000-01-27T09:00:00.000000000Z,Michael,-0.834626129,-0.638811246 +2000-01-27T10:00:00.000000000Z,Yvonne,-0.687702489,-0.923094115 +2000-01-27T11:00:00.000000000Z,Hannah,0.695328619,0.689758518 +2000-01-27T12:00:00.000000000Z,Ursula,-0.846628822,-0.290054582 +2000-01-27T13:00:00.000000000Z,Kevin,-0.18863443,-0.294528895 +2000-01-27T14:00:00.000000000Z,Victor,0.627338091,0.774661152 +2000-01-27T15:00:00.000000000Z,Michael,0.038883513,0.927364797 +2000-01-27T16:00:00.000000000Z,Norbert,-0.940626566,0.116483476 +2000-01-27T17:00:00.000000000Z,Patricia,0.221282374,0.802522731 +2000-01-27T18:00:00.000000000Z,Laura,-0.683674866,-0.842425249 +2000-01-27T19:00:00.000000000Z,Hannah,0.160361432,0.703202652 +2000-01-27T20:00:00.000000000Z,Kevin,-0.295808827,0.966841826 +2000-01-27T21:00:00.000000000Z,Norbert,-0.993904738,-0.093285288 +2000-01-27T22:00:00.000000000Z,Charlie,0.883151679,-0.504362574 +2000-01-27T23:00:00.000000000Z,Laura,-0.151249327,0.128296159 +2000-01-28T00:00:00.000000000Z,Ingrid,0.475738785,-0.303578177 +2000-01-28T01:00:00.000000000Z,Quinn,0.964717004,0.164450439 +2000-01-28T02:00:00.000000000Z,Yvonne,0.43486581,-0.427828092 +2000-01-28T03:00:00.000000000Z,Wendy,0.549095537,-0.404569589 +2000-01-28T04:00:00.000000000Z,Zelda,0.42046495,0.907975876 +2000-01-28T05:00:00.000000000Z,Jerry,-0.362268406,-0.895707943 +2000-01-28T06:00:00.000000000Z,Alice,0.293878056,-0.372216358 +2000-01-28T07:00:00.000000000Z,Quinn,0.870454081,-0.554424762 +2000-01-28T08:00:00.000000000Z,Yvonne,0.314547167,0.188663026 +2000-01-28T09:00:00.000000000Z,Ingrid,0.028290035,-0.26554434 +2000-01-28T10:00:00.000000000Z,Sarah,0.052253731,-0.305999064 +2000-01-28T11:00:00.000000000Z,Frank,0.057196054,0.052900153 +2000-01-28T12:00:00.000000000Z,Norbert,-0.689937046,-0.517041358 +2000-01-28T13:00:00.000000000Z,Ursula,0.943741264,0.127693317 +2000-01-28T14:00:00.000000000Z,Ingrid,-0.933616315,0.217928424 +2000-01-28T15:00:00.000000000Z,Zelda,0.783137331,-0.419662878 +2000-01-28T16:00:00.000000000Z,Tim,-0.520734932,-0.480285197 +2000-01-28T17:00:00.000000000Z,Hannah,0.098923614,-0.011089353 +2000-01-28T18:00:00.000000000Z,Oliver,-0.411496931,0.269436279 +2000-01-28T19:00:00.000000000Z,George,-0.253324299,-0.53746999 +2000-01-28T20:00:00.000000000Z,Ursula,0.805771142,0.252659292 +2000-01-28T21:00:00.000000000Z,Victor,-0.687056666,0.078150911 +2000-01-28T22:00:00.000000000Z,Edith,-0.044938655,-0.738363807 +2000-01-28T23:00:00.000000000Z,Xavier,0.080644647,0.445047382 +2000-01-29T00:00:00.000000000Z,Quinn,0.623386956,0.262640868 +2000-01-29T01:00:00.000000000Z,Kevin,-0.398473087,0.72164514 +2000-01-29T02:00:00.000000000Z,Quinn,-0.776258448,-0.868802384 +2000-01-29T03:00:00.000000000Z,Bob,-0.363628601,-0.250277699 +2000-01-29T04:00:00.000000000Z,Laura,0.405406224,-0.020127099 +2000-01-29T05:00:00.000000000Z,Dan,0.035778642,0.176485866 +2000-01-29T06:00:00.000000000Z,Victor,0.167715787,-0.21246581 +2000-01-29T07:00:00.000000000Z,Ingrid,-0.572048167,0.4494268 +2000-01-29T08:00:00.000000000Z,Oliver,-0.4834275,0.245105749 +2000-01-29T09:00:00.000000000Z,Quinn,0.212686868,0.453479757 +2000-01-29T10:00:00.000000000Z,Ursula,-0.54117154,-0.559343849 +2000-01-29T11:00:00.000000000Z,Edith,0.427720261,-0.683864033 +2000-01-29T12:00:00.000000000Z,Ursula,0.603136005,0.493397108 +2000-01-29T13:00:00.000000000Z,Kevin,-0.518970867,0.703658245 +2000-01-29T14:00:00.000000000Z,Ursula,-0.206058167,-0.915477015 +2000-01-29T15:00:00.000000000Z,Yvonne,0.184683134,0.864548086 +2000-01-29T16:00:00.000000000Z,Yvonne,-0.448420053,0.188462223 +2000-01-29T17:00:00.000000000Z,Ursula,0.46565391,-0.459661455 +2000-01-29T18:00:00.000000000Z,Ursula,0.654634223,-0.609221417 +2000-01-29T19:00:00.000000000Z,Wendy,-0.03948086,-0.170619419 +2000-01-29T20:00:00.000000000Z,Alice,0.819333644,0.899245215 +2000-01-29T21:00:00.000000000Z,Hannah,-0.523689947,-0.630733442 +2000-01-29T22:00:00.000000000Z,Oliver,-0.555963935,-0.154753642 +2000-01-29T23:00:00.000000000Z,Alice,-0.28482686,-0.59739053 +2000-01-30T00:00:00.000000000Z,Hannah,-0.128244957,0.291839333 +2000-01-30T01:00:00.000000000Z,Yvonne,0.375546779,-0.347745139 +2000-01-30T02:00:00.000000000Z,Ingrid,-0.683113988,0.802770684 +2000-01-30T03:00:00.000000000Z,Michael,-0.076789029,0.189393569 +2000-01-30T04:00:00.000000000Z,Jerry,0.733714437,0.955664152 +2000-01-30T05:00:00.000000000Z,Edith,-0.550249709,-0.232524978 +2000-01-30T06:00:00.000000000Z,Xavier,0.09146218,0.647952553 +2000-01-30T07:00:00.000000000Z,Dan,0.575087503,-0.509529314 +2000-01-30T08:00:00.000000000Z,Laura,0.300876497,0.399257488 +2000-01-30T09:00:00.000000000Z,Tim,-0.596949271,0.542514541 +2000-01-30T10:00:00.000000000Z,George,-0.359433857,-0.614951974 +2000-01-30T11:00:00.000000000Z,Victor,0.770480395,0.843507212 +2000-01-30T12:00:00.000000000Z,Hannah,0.327231522,0.287151638 +2000-01-30T13:00:00.000000000Z,Norbert,0.359995242,0.0100073 +2000-01-30T14:00:00.000000000Z,Bob,0.397201413,0.650979547 +2000-01-30T15:00:00.000000000Z,Sarah,-0.475431873,0.7067306 +2000-01-30T16:00:00.000000000Z,Norbert,0.885200874,0.298909482 +2000-01-30T17:00:00.000000000Z,Wendy,0.914901062,0.827093206 +2000-01-30T18:00:00.000000000Z,Sarah,-0.347523932,-0.337183364 +2000-01-30T19:00:00.000000000Z,Tim,-0.151775582,0.136192907 +2000-01-30T20:00:00.000000000Z,Bob,-0.825988998,0.950155143 +2000-01-30T21:00:00.000000000Z,Alice,-0.040300885,-0.927964964 +2000-01-30T22:00:00.000000000Z,Laura,0.284126891,-0.622967163 +2000-01-30T23:00:00.000000000Z,Kevin,-0.029501578,0.680247483 +2000-01-31T00:00:00.000000000Z,Victor,0.640233147,-0.285471859 From f8408f1ce9422d68205c696463fcd79318ac75f4 Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Fri, 10 Sep 2021 21:26:33 +0000 Subject: [PATCH 2/7] updated stable_name --- libcuml-libcudf-groupby/src/process_csv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index 7597717..d479f5e 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -39,10 +39,10 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view stock_i int main(int argc, char** argv) { // Read data - auto stock_table_with_metadata = read_csv("test.csv"); + auto sample_table = read_csv("test.csv"); // Process - auto result = cuml_regression_on_groupby(*stock_table_with_metadata.tbl); + auto result = cuml_regression_on_groupby(*sample_table.tbl); // Write out result write_csv(*result, "test_out.csv"); From 9ab3665f0b8341c567dfea67688233d520d4063a Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Mon, 13 Sep 2021 22:50:36 +0000 Subject: [PATCH 3/7] added basic data transformation example --- libcuml-libcudf-groupby/src/process_csv.cpp | 25 ++++++++++++++++----- libcuml-libcudf-groupby/test2.csv | 7 ++++++ libcuml-libcudf-groupby/test_out.csv | 6 +++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 libcuml-libcudf-groupby/test2.csv create mode 100644 libcuml-libcudf-groupby/test_out.csv diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index d479f5e..4ed9b16 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -1,6 +1,9 @@ #include #include #include +#include +#include +#include #include #include @@ -24,22 +27,34 @@ void write_csv(cudf::table_view const& tbl_view, std::string const& file_path) cudf::io::write_csv(options); } -std::unique_ptr cuml_regression_on_groupby(cudf::table_view stock_info_table) + +std::unique_ptr generate_grouped_arr(cudf::table_view values, cudf::size_type start, cudf::size_type end) +{ + auto sliced_table = cudf::slice(values, {start, end}).front(); + auto [_, transposed_table] = cudf::transpose(sliced_table); + + return cudf::interleave_columns(transposed_table); +} + +std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_table) { // Schema: | Timestamp | Name | X | Y - auto keys = cudf::table_view{{stock_info_table.column(1)}}; // name + auto keys = cudf::table_view{{input_table.column(0)}}; // name // Compute the average of each company's closing price with entire column cudf::groupby::groupby grpby_obj(keys); - cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(stock_info_table.select({2,3})); - return std::make_unique(stock_info_table.select({2,3})); + cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(input_table.select({1,2})); + + auto values_view = (gb_groups.values)->view(); + auto interleaved = generate_grouped_arr(values_view, 0, 3); + return std::make_unique(cudf::table_view({interleaved->view()}).select({0})); } int main(int argc, char** argv) { // Read data - auto sample_table = read_csv("test.csv"); + auto sample_table = read_csv("test2.csv"); // Process auto result = cuml_regression_on_groupby(*sample_table.tbl); diff --git a/libcuml-libcudf-groupby/test2.csv b/libcuml-libcudf-groupby/test2.csv new file mode 100644 index 0000000..28151e8 --- /dev/null +++ b/libcuml-libcudf-groupby/test2.csv @@ -0,0 +1,7 @@ +key,value1,value2 +1,8,9 +1,8,9 +1,8,9 +2,8,9 +2,8,9 + diff --git a/libcuml-libcudf-groupby/test_out.csv b/libcuml-libcudf-groupby/test_out.csv new file mode 100644 index 0000000..0a26988 --- /dev/null +++ b/libcuml-libcudf-groupby/test_out.csv @@ -0,0 +1,6 @@ +8 +8 +8 +9 +9 +9 From bd469a856d0d85e189f5cdbe3dd8e166fecafb36 Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Thu, 16 Sep 2021 22:12:21 +0000 Subject: [PATCH 4/7] cuml debug --- libcuml-libcudf-groupby/CMakeLists.txt | 12 +++- libcuml-libcudf-groupby/README.md | 2 +- libcuml-libcudf-groupby/src/process_csv.cpp | 63 +++++++++++++++++++++ libcuml-libcudf-groupby/test2.csv | 10 ++-- libcuml-libcudf-groupby/test_out.csv | 12 ++-- 5 files changed, 86 insertions(+), 13 deletions(-) diff --git a/libcuml-libcudf-groupby/CMakeLists.txt b/libcuml-libcudf-groupby/CMakeLists.txt index aef477c..ace6106 100644 --- a/libcuml-libcudf-groupby/CMakeLists.txt +++ b/libcuml-libcudf-groupby/CMakeLists.txt @@ -14,8 +14,18 @@ CPMFindPackage(NAME cudf SOURCE_SUBDIR cpp ) +set(CUDF_TAG branch-21.10) +CPMFindPackage(NAME cuml + GIT_REPOSITORY https://github.com/rapidsai/cuml + GIT_TAG ${CUDF_TAG} + GIT_SHALLOW TRUE + SOURCE_SUBDIR cpp +) # Configure your project here add_executable(basic_example src/process_csv.cpp) -target_link_libraries(basic_example PRIVATE cudf::cudf) +target_link_libraries(basic_example PRIVATE + cudf::cudf + cuml::cuml++ +) target_compile_features(basic_example PRIVATE cxx_std_17) diff --git a/libcuml-libcudf-groupby/README.md b/libcuml-libcudf-groupby/README.md index 7b6748b..478d535 100644 --- a/libcuml-libcudf-groupby/README.md +++ b/libcuml-libcudf-groupby/README.md @@ -10,7 +10,7 @@ cmake -S . -B build/ # Build cmake --build build/ --parallel $PARALLEL_LEVEL # Execute -build/libcudf_example +build/basic_example ``` If your machine does not come with a pre-built libcudf binary, expect the diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index 4ed9b16..03b0746 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -6,11 +6,40 @@ #include #include +#include +#include + #include #include #include #include +#include +#include + +#include +#include +#include + + + +#ifndef CUDA_RT_CALL +#define CUDA_RT_CALL(call) \ + { \ + cudaError_t cudaStatus = call; \ + if (cudaSuccess != cudaStatus) \ + fprintf(stderr, \ + "ERROR: CUDA RT call \"%s\" in line %d of file %s failed with " \ + "%s (%d).\n", \ + #call, \ + __LINE__, \ + __FILE__, \ + cudaGetErrorString(cudaStatus), \ + cudaStatus); \ + } +#endif // CUDA_RT_CALL + + cudf::io::table_with_metadata read_csv(std::string const& file_path) { auto source_info = cudf::io::source_info(file_path); @@ -48,6 +77,40 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_t auto values_view = (gb_groups.values)->view(); auto interleaved = generate_grouped_arr(values_view, 0, 3); + + raft::handle_t handle; + cudaStream_t stream = rmm::cuda_stream_default.value(); + CUDA_RT_CALL(cudaStreamCreate(&stream)); + handle.set_stream(stream); + + // matrix pointer + float *matrix_pointer = interleaved->mutable_view().data(); + int n_rows = 3; + int n_cols = 2; + +/* + rmm::device_uvector labels(3, rmm::cuda_stream_default); + thrust::uninitialized_fill(thrust::cuda::par.on(stream), labels.begin(), labels.end(), 0); + + rmm::device_uvector coef(2, rmm::cuda_stream_default); + thrust::uninitialized_fill(thrust::cuda::par.on(stream), coef.begin(), coef.end(), 0); + + rmm::device_uvector intercept(1, rmm::cuda_stream_default); + thrust::uninitialized_fill(thrust::cuda::par.on(stream), intercept.begin(), intercept.end(), 0); +*/ + thrust::device_ptr labels = thrust::device_malloc(10); + thrust::device_ptr coef = thrust::device_malloc(10); + // thrust::device_ptr intercept = thrust::device_malloc(10); + thrust::size_type intercept_size = 1; + thrust::device_vector intercept(1, 0.0); + float *intercept_ptr = thrust::raw_pointer_cast(intercept.data()); + + + bool fit_intercept = false; + bool normalize = false; + + ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, labels.get(), coef.get(), intercept_ptr, fit_intercept, normalize); + return std::make_unique(cudf::table_view({interleaved->view()}).select({0})); } diff --git a/libcuml-libcudf-groupby/test2.csv b/libcuml-libcudf-groupby/test2.csv index 28151e8..de72fb3 100644 --- a/libcuml-libcudf-groupby/test2.csv +++ b/libcuml-libcudf-groupby/test2.csv @@ -1,7 +1,7 @@ key,value1,value2 -1,8,9 -1,8,9 -1,8,9 -2,8,9 -2,8,9 +1,8.5,9.5 +1,7.5,9.2 +1,8.2,9.3 +2,8.1,9.1 +2,8,7 diff --git a/libcuml-libcudf-groupby/test_out.csv b/libcuml-libcudf-groupby/test_out.csv index 0a26988..2fd810d 100644 --- a/libcuml-libcudf-groupby/test_out.csv +++ b/libcuml-libcudf-groupby/test_out.csv @@ -1,6 +1,6 @@ -8 -8 -8 -9 -9 -9 +8.5 +7.5 +8.2 +9.5 +9.2 +9.3 From 37e1853845f17ce01ca39eba54feee29519cf29b Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Fri, 17 Sep 2021 20:17:01 +0000 Subject: [PATCH 5/7] updated to work on multiple groups --- libcuml-libcudf-groupby/src/process_csv.cpp | 48 +++++++++------------ libcuml-libcudf-groupby/test2.csv | 10 ++--- libcuml-libcudf-groupby/test_out.csv | 12 +++--- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index 03b0746..e6b9164 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -8,11 +8,13 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -23,6 +25,7 @@ + #ifndef CUDA_RT_CALL #define CUDA_RT_CALL(call) \ { \ @@ -70,47 +73,38 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_t // Schema: | Timestamp | Name | X | Y auto keys = cudf::table_view{{input_table.column(0)}}; // name - // Compute the average of each company's closing price with entire column cudf::groupby::groupby grpby_obj(keys); - cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(input_table.select({1,2})); - auto values_view = (gb_groups.values)->view(); + auto interleaved = generate_grouped_arr(values_view, 0, 3); + // cuml setup + int n_cols = 2; raft::handle_t handle; cudaStream_t stream = rmm::cuda_stream_default.value(); CUDA_RT_CALL(cudaStreamCreate(&stream)); handle.set_stream(stream); - // matrix pointer - float *matrix_pointer = interleaved->mutable_view().data(); - int n_rows = 3; - int n_cols = 2; - -/* - rmm::device_uvector labels(3, rmm::cuda_stream_default); - thrust::uninitialized_fill(thrust::cuda::par.on(stream), labels.begin(), labels.end(), 0); - - rmm::device_uvector coef(2, rmm::cuda_stream_default); - thrust::uninitialized_fill(thrust::cuda::par.on(stream), coef.begin(), coef.end(), 0); + // looping through each group + for (int i = 1; i < gb_groups.offsets.size(); i++) { + cudf::size_type offset1 = gb_groups.offsets[i-1], offset2 = gb_groups.offsets[i]; + auto interleaved = generate_grouped_arr(values_view, offset1, offset2); + double *matrix_pointer = interleaved->mutable_view().data(); - rmm::device_uvector intercept(1, rmm::cuda_stream_default); - thrust::uninitialized_fill(thrust::cuda::par.on(stream), intercept.begin(), intercept.end(), 0); -*/ - thrust::device_ptr labels = thrust::device_malloc(10); - thrust::device_ptr coef = thrust::device_malloc(10); - // thrust::device_ptr intercept = thrust::device_malloc(10); - thrust::size_type intercept_size = 1; - thrust::device_vector intercept(1, 0.0); - float *intercept_ptr = thrust::raw_pointer_cast(intercept.data()); + // original values + raft::print_device_vector("values", matrix_pointer, (offset2 - offset1) * n_cols, std::cout); + int n_rows = (offset2 - offset1) * n_cols; + thrust::device_ptr labels = thrust::device_malloc(n_rows); + thrust::device_ptr coef = thrust::device_malloc(n_cols); + double intercept; + ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, labels.get(), coef.get(), &intercept, false, false); - bool fit_intercept = false; - bool normalize = false; + // values overrwritten by olsFit (if the line above is commented out then the same value will be written out) + raft::print_device_vector("values", matrix_pointer, (offset2 - offset1) * n_cols, std::cout); + } - ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, labels.get(), coef.get(), intercept_ptr, fit_intercept, normalize); - return std::make_unique(cudf::table_view({interleaved->view()}).select({0})); } diff --git a/libcuml-libcudf-groupby/test2.csv b/libcuml-libcudf-groupby/test2.csv index de72fb3..ce978a0 100644 --- a/libcuml-libcudf-groupby/test2.csv +++ b/libcuml-libcudf-groupby/test2.csv @@ -1,7 +1,7 @@ key,value1,value2 -1,8.5,9.5 -1,7.5,9.2 -1,8.2,9.3 -2,8.1,9.1 -2,8,7 +1,8.0,9.0 +1,7.0,9.0 +1,8.0,9.0 +2,8.0,9.0 +2,8.0,7.0 diff --git a/libcuml-libcudf-groupby/test_out.csv b/libcuml-libcudf-groupby/test_out.csv index 2fd810d..4104a40 100644 --- a/libcuml-libcudf-groupby/test_out.csv +++ b/libcuml-libcudf-groupby/test_out.csv @@ -1,6 +1,6 @@ -8.5 -7.5 -8.2 -9.5 -9.2 -9.3 +8.0 +7.0 +8.0 +9.0 +9.0 +9.0 From 11394ef398d5e63bf6a09b0e1d7a2caddd450845 Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Fri, 17 Sep 2021 20:47:55 +0000 Subject: [PATCH 6/7] v1 done --- libcuml-libcudf-groupby/src/process_csv.cpp | 18 +++++++++--------- libcuml-libcudf-groupby/test2.csv | 12 ++++++------ libcuml-libcudf-groupby/test_out.csv | 9 ++++++--- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index e6b9164..2f3326c 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -70,11 +70,11 @@ std::unique_ptr generate_grouped_arr(cudf::table_view values, cudf std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_table) { - // Schema: | Timestamp | Name | X | Y + // Schema: Name | X | Y | target auto keys = cudf::table_view{{input_table.column(0)}}; // name cudf::groupby::groupby grpby_obj(keys); - cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(input_table.select({1,2})); + cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(input_table.select({1,2,3})); auto values_view = (gb_groups.values)->view(); auto interleaved = generate_grouped_arr(values_view, 0, 3); @@ -89,20 +89,20 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_t // looping through each group for (int i = 1; i < gb_groups.offsets.size(); i++) { cudf::size_type offset1 = gb_groups.offsets[i-1], offset2 = gb_groups.offsets[i]; + int n_rows = offset2 - offset1; + auto interleaved = generate_grouped_arr(values_view, offset1, offset2); double *matrix_pointer = interleaved->mutable_view().data(); // original values - raft::print_device_vector("values", matrix_pointer, (offset2 - offset1) * n_cols, std::cout); - - int n_rows = (offset2 - offset1) * n_cols; - thrust::device_ptr labels = thrust::device_malloc(n_rows); + raft::print_device_vector("values", matrix_pointer, n_rows * n_cols, std::cout); thrust::device_ptr coef = thrust::device_malloc(n_cols); double intercept; - ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, labels.get(), coef.get(), &intercept, false, false); - // values overrwritten by olsFit (if the line above is commented out then the same value will be written out) - raft::print_device_vector("values", matrix_pointer, (offset2 - offset1) * n_cols, std::cout); + // label is stored in matrix_pointer + n_rows * n_cols + ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, matrix_pointer + n_rows * n_cols, coef.get(), &intercept, false, true); + + raft::print_device_vector("coef", coef.get(), n_cols, std::cout); } return std::make_unique(cudf::table_view({interleaved->view()}).select({0})); diff --git a/libcuml-libcudf-groupby/test2.csv b/libcuml-libcudf-groupby/test2.csv index ce978a0..340650a 100644 --- a/libcuml-libcudf-groupby/test2.csv +++ b/libcuml-libcudf-groupby/test2.csv @@ -1,7 +1,7 @@ -key,value1,value2 -1,8.0,9.0 -1,7.0,9.0 -1,8.0,9.0 -2,8.0,9.0 -2,8.0,7.0 +key,value1,value2,target +1,8.0,10.0,20.0 +1,7.0,15.0,16.0 +1,8.0,35.0,35.0 +2,8.0,12.0,100.0 +2,8.0,8.0,8.0 diff --git a/libcuml-libcudf-groupby/test_out.csv b/libcuml-libcudf-groupby/test_out.csv index 4104a40..5a664df 100644 --- a/libcuml-libcudf-groupby/test_out.csv +++ b/libcuml-libcudf-groupby/test_out.csv @@ -1,6 +1,9 @@ 8.0 7.0 8.0 -9.0 -9.0 -9.0 +10.0 +15.0 +35.0 +20.0 +16.0 +35.0 From 363fdddc08c1cfee915c647ba3140dcfe28958c9 Mon Sep 17 00:00:00 2001 From: Shane Ding Date: Wed, 29 Sep 2021 22:52:16 +0000 Subject: [PATCH 7/7] updated files --- .../src/debug_printers.hpp | 96 ++++++++++++ libcuml-libcudf-groupby/src/process_csv.cpp | 25 +++- libcuml-libcudf-groupby/src/process_csv.cu | 139 ++++++++++++++++++ 3 files changed, 255 insertions(+), 5 deletions(-) create mode 100644 libcuml-libcudf-groupby/src/debug_printers.hpp create mode 100644 libcuml-libcudf-groupby/src/process_csv.cu diff --git a/libcuml-libcudf-groupby/src/debug_printers.hpp b/libcuml-libcudf-groupby/src/debug_printers.hpp new file mode 100644 index 0000000..a855b89 --- /dev/null +++ b/libcuml-libcudf-groupby/src/debug_printers.hpp @@ -0,0 +1,96 @@ +#pragma once + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace cuspatial { +namespace debug { + +template +void print(std::vector const& vec, + std::ostream& os = std::cout, + std::string const& delimiter = ",") +{ + std::vector f64s(vec.size()); + std::copy(vec.begin(), vec.end(), f64s.begin()); + os << "size: " << vec.size() << " [" << std::endl << " "; + std::copy(f64s.begin(), f64s.end(), std::ostream_iterator(os, delimiter.data())); + os << std::endl << "]" << std::endl; +} + +template +void print(rmm::device_vector const& vec, + std::ostream& os = std::cout, + std::string const& delimiter = ",", + cudaStream_t stream = 0) +{ + CUDA_TRY(cudaStreamSynchronize(stream)); + std::vector hvec(vec.size()); + std::fill(hvec.begin(), hvec.end(), T{0}); + thrust::copy(vec.begin(), vec.end(), hvec.begin()); + print(hvec, os, delimiter); +} + +template +void print(rmm::device_uvector const& uvec, + std::ostream& os = std::cout, + std::string const& delimiter = ",", + cudaStream_t stream = 0) +{ + rmm::device_vector dvec(uvec.size()); + std::fill(dvec.begin(), dvec.end(), T{0}); + thrust::copy(rmm::exec_policy(stream)->on(stream), uvec.begin(), uvec.end(), dvec.begin()); + print(dvec, os, delimiter, stream); +} + +template +void print(rmm::device_buffer const& buf, + std::ostream& os = std::cout, + std::string const& delimiter = ",", + cudaStream_t stream = 0) +{ + auto ptr = thrust::device_pointer_cast(buf.data()); + rmm::device_vector dvec(buf.size() / sizeof(T)); + thrust::fill(dvec.begin(), dvec.end(), T{0}); + thrust::copy(rmm::exec_policy(stream)->on(stream), ptr, ptr + dvec.size(), dvec.begin()); + print(dvec, os, delimiter, stream); +} + +template +void print(cudf::column_view const& col, + std::ostream& os = std::cout, + std::string const& delimiter = ",", + cudaStream_t stream = 0) +{ + rmm::device_vector dvec(col.size()); + std::fill(dvec.begin(), dvec.end(), T{0}); + thrust::copy(rmm::exec_policy(stream)->on(stream), col.begin(), col.end(), dvec.begin()); + print(dvec, os, delimiter, stream); +} + +template +void print(thrust::device_ptr const& ptr, + cudf::size_type size, + std::ostream& os = std::cout, + std::string const& delimiter = ",", + cudaStream_t stream = 0) +{ + rmm::device_vector dvec(size); + std::fill(dvec.begin(), dvec.end(), T{0}); + thrust::copy(rmm::exec_policy(stream)->on(stream), ptr, ptr + size, dvec.begin()); + print(dvec, os, delimiter, stream); +} +} // namespace debug +} // namespace cuspatial diff --git a/libcuml-libcudf-groupby/src/process_csv.cpp b/libcuml-libcudf-groupby/src/process_csv.cpp index 2f3326c..7890354 100644 --- a/libcuml-libcudf-groupby/src/process_csv.cpp +++ b/libcuml-libcudf-groupby/src/process_csv.cpp @@ -5,6 +5,8 @@ #include #include #include +#include + #include #include @@ -22,6 +24,7 @@ #include #include #include +#include @@ -86,8 +89,15 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_t CUDA_RT_CALL(cudaStreamCreate(&stream)); handle.set_stream(stream); + //thrust::device_vector coef1(gb_groups.offsets.size() - 1); + //thrust::device_vector coef2(gb_groups.offsets.size() - 1); // looping through each group + + auto coef1 = cudf::make_numeric_column(cudf::data_type{cudf::type_id::FLOAT64}, (gb_groups.offsets.size() - 1) * 2); + auto coef2 = cudf::make_numeric_column(cudf::data_type{cudf::type_id::FLOAT64}, gb_groups.offsets.size() - 1); + for (int i = 1; i < gb_groups.offsets.size(); i++) { + cudf::size_type offset1 = gb_groups.offsets[i-1], offset2 = gb_groups.offsets[i]; int n_rows = offset2 - offset1; @@ -95,17 +105,22 @@ std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_t double *matrix_pointer = interleaved->mutable_view().data(); // original values - raft::print_device_vector("values", matrix_pointer, n_rows * n_cols, std::cout); + raft::print_device_vector("values", matrix_pointer, n_rows * (n_cols + 1), std::cout); thrust::device_ptr coef = thrust::device_malloc(n_cols); double intercept; // label is stored in matrix_pointer + n_rows * n_cols - ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, matrix_pointer + n_rows * n_cols, coef.get(), &intercept, false, true); - + ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, matrix_pointer + n_rows * n_cols, coef.get(), &intercept, false, false); + // raft::print_device_vector("values", matrix_pointer, n_rows * (n_cols + 1), std::cout); + + // loops through n_cols + thrust::copy(thrust::device, coef.get(), coef.get()+2, coef1->mutable_view().data() + i - 1); + //thrust::copy(coef.get()+1, coef.get()+2, coef2->mutable_view().data() + i - 1); + raft::print_device_vector("coef", coef.get(), n_cols, std::cout); } - - return std::make_unique(cudf::table_view({interleaved->view()}).select({0})); + //raft::print_device_vector("coef", coef1.data().get(), gb_groups.offsets.size() - 1, std::cout); + return std::make_unique(cudf::table_view({coef1->view()}).select({0})); } int main(int argc, char** argv) diff --git a/libcuml-libcudf-groupby/src/process_csv.cu b/libcuml-libcudf-groupby/src/process_csv.cu new file mode 100644 index 0000000..4690c9a --- /dev/null +++ b/libcuml-libcudf-groupby/src/process_csv.cu @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include "debug_printers.hpp" + +#include +#include + +#include +#include +#include +#include + + + + +#ifndef CUDA_RT_CALL +#define CUDA_RT_CALL(call) \ + { \ + cudaError_t cudaStatus = call; \ + if (cudaSuccess != cudaStatus) \ + fprintf(stderr, \ + "ERROR: CUDA RT call \"%s\" in line %d of file %s failed with " \ + "%s (%d).\n", \ + #call, \ + __LINE__, \ + __FILE__, \ + cudaGetErrorString(cudaStatus), \ + cudaStatus); \ + } +#endif // CUDA_RT_CALL + + +cudf::io::table_with_metadata read_csv(std::string const& file_path) +{ + auto source_info = cudf::io::source_info(file_path); + auto builder = cudf::io::csv_reader_options::builder(source_info); + auto options = builder.build(); + return cudf::io::read_csv(options); +} + +void write_csv(cudf::table_view const& tbl_view, std::string const& file_path) +{ + auto sink_info = cudf::io::sink_info(file_path); + auto builder = cudf::io::csv_writer_options::builder(sink_info, tbl_view); + auto options = builder.build(); + cudf::io::write_csv(options); +} + + +std::unique_ptr generate_grouped_arr(cudf::table_view values, cudf::size_type start, cudf::size_type end) +{ + auto sliced_table = cudf::slice(values, {start, end}).front(); + auto [_, transposed_table] = cudf::transpose(sliced_table); + + return cudf::interleave_columns(transposed_table); +} + +std::unique_ptr cuml_regression_on_groupby(cudf::table_view input_table) +{ + // Schema: Name | X | Y | target + auto keys = cudf::table_view{{input_table.column(0)}}; // name + + cudf::groupby::groupby grpby_obj(keys); + cudf::groupby::groupby::groups gb_groups = grpby_obj.get_groups(input_table.select({1,2,3})); + auto values_view = (gb_groups.values)->view(); + + auto interleaved = generate_grouped_arr(values_view, 0, 3); + + // cuml setup + int n_cols = 2; + raft::handle_t handle; + cudaStream_t stream = rmm::cuda_stream_default.value(); + CUDA_RT_CALL(cudaStreamCreate(&stream)); + handle.set_stream(stream); + + //thrust::device_vector coef1(gb_groups.offsets.size() - 1); + //thrust::device_vector coef2(gb_groups.offsets.size() - 1); + // looping through each group + + auto coef1 = cudf::make_numeric_column(cudf::data_type{cudf::type_id::FLOAT64}, (gb_groups.offsets.size() - 1) * 2); + auto coef2 = cudf::make_numeric_column(cudf::data_type{cudf::type_id::FLOAT64}, gb_groups.offsets.size() - 1); + + for (int i = 1; i < gb_groups.offsets.size(); i++) { + + cudf::size_type offset1 = gb_groups.offsets[i-1], offset2 = gb_groups.offsets[i]; + int n_rows = offset2 - offset1; + + auto interleaved = generate_grouped_arr(values_view, offset1, offset2); + double *matrix_pointer = interleaved->mutable_view().data(); + + // original values + raft::print_device_vector("values", matrix_pointer, n_rows * (n_cols + 1), std::cout); + thrust::device_ptr coef = thrust::device_malloc(n_cols); + double intercept; + + // label is stored in matrix_pointer + n_rows * n_cols + ML::GLM::olsFit(handle, matrix_pointer, n_rows, n_cols, matrix_pointer + n_rows * n_cols, coef.get(), &intercept, false, false); + // raft::print_device_vector("values", matrix_pointer, n_rows * (n_cols + 1), std::cout); + + // loops through n_cols + thrust::copy(thrust::device, coef.get(), coef.get()+2, coef1->mutable_view().data() + i - 1); + //thrust::copy(coef.get()+1, coef.get()+2, coef2->mutable_view().data() + i - 1); + + raft::print_device_vector("coef", coef.get(), n_cols, std::cout); + } + //raft::print_device_vector("coef", coef1.data().get(), gb_groups.offsets.size() - 1, std::cout); + return std::make_unique(cudf::table_view({coef1->view()}).select({0})); +} + +int main(int argc, char** argv) +{ + // Read data + auto sample_table = read_csv("test2.csv"); + + // Process + auto result = cuml_regression_on_groupby(*sample_table.tbl); + + // Write out result + write_csv(*result, "test_out.csv"); + + return 0; +}