Skip to content

Instantly share code, notes, and snippets.

@myui
Created July 16, 2015 11:36
Show Gist options
  • Save myui/ae5641704e6fdafed33a to your computer and use it in GitHub Desktop.
Save myui/ae5641704e6fdafed33a to your computer and use it in GitHub Desktop.
each_top_k.sql
create table similarities
as
SELECT
each_top_k(
10, t2.id, angular_similarity(t2.features, t1.features),
t2.id,
t1.id,
t1.y
) as (rank, similarity, base_id, neighbor_id, y)
FROM
test_hivemall t2
LEFT OUTER JOIN train_hivemall t1
-- CROSS JOIN train_hivemall t1
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment