This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install torch lightning scikit-learn numpy tqdm faissknn | |
import lightning.pytorch as pl | |
import numpy as np | |
import torch | |
from faissknn import FaissKNNClassifier | |
from lightning.pytorch.utilities import rank_zero_only | |
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score | |
from tqdm import tqdm | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import csv | |
import json | |
import numpy as np | |
def r_tree(points, K): | |
""" STR method for building R-Tree like structure. | |
http://stats.stackexchange.com/a/40785 | |
http://www.dtic.mil/dtic/tr/fulltext/u2/a324493.pdf (pag. 8) |