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
sudo apt update | |
sudo apt-get install git -y | |
"${SHELL}" <(curl -L micro.mamba.pm/install.sh) << START_ARGS | |
y | |
y | |
START_ARGS |
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
# %% | |
results_path = 'local_artifacts/benchmarks/simd' | |
results_path += '/' if results_path[-1] != '/' else '' | |
branch = "PR" | |
# %% | |
from sklearn.metrics import DistanceMetric | |
from time import perf_counter | |
from functools import partial | |
from itertools import product |
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
from sklearn.metrics.pairwise import pairwise_distances | |
from scipy.sparse import csr_matrix | |
from sklearn.metrics import DistanceMetric | |
import numpy as np | |
N_FEATURES = 10 | |
N_SAMPLES = 10_000 | |
def _generate_PWD_data(n_samples_X, n_samples_Y, n_features, n_classes, n_outs=1, random_state=0): | |
rng = np.random.RandomState(random_state) |
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
# %% | |
results_path = 'local_artifacts/benchmarks/float32' | |
results_path += '/' if results_path[-1] != '/' else '' | |
branch = "main" | |
# %% | |
from sklearn.metrics import DistanceMetric | |
from scipy.sparse import csr_matrix | |
from time import perf_counter | |
from functools import partial |
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
# %% | |
from os import mkdir | |
from pathlib import Path | |
from os.path import join | |
branch = "PR" | |
path = Path(join("data", f"{branch}.csv")) | |
if not path.parent.exists(): | |
mkdir(path.parent) |
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
# %% | |
results_path = 'local_artifacts/benchmarks/dist' | |
results_path += '/' if results_path[-1] != '/' else '' | |
# %% | |
from sklearn.metrics._pairwise_distances_reduction import ArgKmin | |
from scipy.sparse import csr_matrix | |
from statistics import mean, stdev | |
from time import perf_counter | |
from functools import partial |
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
# %% | |
from pathlib import Path | |
results_path = 'local_artifacts/benchmarks/KNR/' | |
results_path += '/' if results_path[-1] != '/' else '' | |
Path(results_path).mkdir(parents=True, exist_ok=True) | |
results_path += "data.csv" | |
# %% | |
from slsdm import get_distance_metric |
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
results_path = "local_artifacts/benchmarks/native/quick/manhattan" | |
results_path += "/" if results_path[-1] != "/" else "" | |
from distance_metrics import get_distance_metric | |
from sklearn.metrics._dist_metrics import ManhattanDistance, ManhattanDistance32 | |
from statistics import mean, stdev | |
from time import perf_counter | |
from functools import partial | |
from itertools import product |
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
from sklearn.metrics._dist_metrics import DistanceMetric, DistanceMetric32 | |
from statistics import mean, stdev | |
from time import perf_counter | |
from functools import partial | |
from itertools import product | |
from pathlib import Path | |
import numpy as np | |
import csv | |
results_path = 'local_artifacts/benchmarks/native/quick' |
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
import numpy as np | |
from scipy import sparse as sp | |
def generate_data(n_samples, n_features, n_classes=2, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
rng = np.random.RandomState(random_state) | |
if X_density < 1: | |
X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
else: | |
X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) | |
y = np.round(rng.randint(n_classes,size=(n_samples,))).astype(dtype) |
NewerOlder