# Path: hub_toolbox/approximate.py
# VALID_HR = ["MP", "MPG", "LS", "NICDM", "DSL", None]
# VALID_SAMPLE = ['random', 'kmeans++', 'lsh', 'hnsw', None]
# VALID_METRICS = ['sqeuclidean', 'cosine', 'precomputed']
# VALID_PREDICTORS = ['knn']
#         X = X[ind, :]
#         X = check_array(X, dtype=np.float32, warn_on_dtype=True,
#                         estimator='ApproximateHubnessReduction')
#         X = check_array(X, dtype=np.float32, warn_on_dtype=True,
#                         estimator='ApproximateHubnessReduction')
# def enforce_finite_distances(arr):
# def _load_shared_data(X_train_=None, X_test_=None,
#                       ind_train_=None, ind_test_=None,
#                       D_train_=None, D_test_=None,
#                       D_sec_=None, ann_index_=None,
#                       counter_=None):
# def _shared_lsh(X_train_, ind_train_, D_train_, lsh_index_, num_probes,
#                 counter_=None):
# def _shared_lsh_trafo(X_train_, X_test_, ind_test_, D_test_,
#                       lsh_index_, num_probes, counter_=None):
# def _lsh_filt(i, k, metric, verbose):
# def _lsh_trafo(i, k, metric, verbose):
# def _mp_hnsw(i, n_train, n_test, n_samples, verbose):
# def _mp_lsh(i, n_train, n_test, n_samples, verbose):
# def _mp_full(i, n_train, n_test, n_samples, verbose):
# def kmeanspp(X, n_clusters, x_squared_norms=None, random_state=None,
#              n_local_trials=None, return_ind=True, metric='sqeuclidean'):
#     def __init__(self, hr_algorithm='mp', n_neighbors=5, n_samples=100,
#                  sampling_algorithm='random', metric='sqeuclidean',
#                  predictor='knn',
#                  random_state=None, n_jobs=1, verbose=0, **kwargs):
#     def _times(self, action, times_start, times_end):
#     def _sparse_distance_matrix(self, X_test):
#     def _X_norm_squared_if_sqeuclidean(self, X):
#     def _random_sampling(self, X, y=None):
#     def _kmeanspp_sampling(self, X, y=None):
#     def _hnsw_filtering(self, X, k):
#     def _hnsw_trafo(self, X, k):
#     def _lsh_filtering(self, X, k):
#     def _lsh_trafo(self, X, k):
#     def _fit_without_hr(self, X, y=None):
#     def _transform_without_hr(self, X):
#     def _fit_mp(self, X, y=None):
#     def _transform_mp(self, X):
#     def _fit_mpg(self, X, y=None):
#     def _transform_mpg(self, X):
#     def _fit_ls(self, X, y=None):
#     def _transform_ls(self, X):
#     def _fit_dsl(self, X, y=None):
#     def _transform_dsl(self, X):
#     def _predict_knn(self, X):
#     def fit(self, X, y=None):
#     def transform(self, X):
#     def predict(self, X):
# class SuQHR(BaseEstimator, TransformerMixin):
# class ApproximateHubnessReduction(SuQHR):


import unittest
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from hub_toolbox import approximate
from sklearn.metrics.classification import accuracy_score
        n_features = n_informative
        test_size = int(n_samples * .2)
        X, y = make_classification(
            n_samples=n_samples,
            n_features=n_features,
            n_informative=n_informative,
            n_redundant=0, n_repeated=0, n_classes=2,
            n_clusters_per_class=10, random_state=2847356)
        X_train, X_test, y_train, y_test = train_test_split(
            X.astype(np.float32), y.astype(np.int32), test_size=test_size)
        self.X_train = X_train
        self.X_test = X_test
        self.y_train = y_train
        self.y_test = y_test

        self.hr_algorithms = ['LS', 'NICDM', 'MP', 'MPG', 'DSL', None, 'NoNe']
        self.n_neighbors = 5
        self.n_samples = 100
        self.sampling_algorithms = ['random', 'kmeans++', 'LSH', 'HNSW',
                                    None, 'nOnE']
        self.metrics = ['sqeuclidean', 'cosine']
        self.n_jobs = [-1, 1]
        self.verbose = 0
        self.accu_time = 0.

    def tearDown(self):
        print(f'Accumulated time: {self.accu_time} seconds.')

    def _approximate_hr(self, hr_algorithm, sampling_algorithm,
                        metric, n_jobs):

# Path: hub_toolbox/approximate.py
# VALID_HR = ["MP", "MPG", "LS", "NICDM", "DSL", None]
# VALID_SAMPLE = ['random', 'kmeans++', 'lsh', 'hnsw', None]
# VALID_METRICS = ['sqeuclidean', 'cosine', 'precomputed']
# VALID_PREDICTORS = ['knn']
#         X = X[ind, :]
#         X = check_array(X, dtype=np.float32, warn_on_dtype=True,
#                         estimator='ApproximateHubnessReduction')
#         X = check_array(X, dtype=np.float32, warn_on_dtype=True,
#                         estimator='ApproximateHubnessReduction')
# def enforce_finite_distances(arr):
# def _load_shared_data(X_train_=None, X_test_=None,
#                       ind_train_=None, ind_test_=None,
#                       D_train_=None, D_test_=None,
#                       D_sec_=None, ann_index_=None,
#                       counter_=None):
# def _shared_lsh(X_train_, ind_train_, D_train_, lsh_index_, num_probes,
#                 counter_=None):
# def _shared_lsh_trafo(X_train_, X_test_, ind_test_, D_test_,
#                       lsh_index_, num_probes, counter_=None):
# def _lsh_filt(i, k, metric, verbose):
# def _lsh_trafo(i, k, metric, verbose):
# def _mp_hnsw(i, n_train, n_test, n_samples, verbose):
# def _mp_lsh(i, n_train, n_test, n_samples, verbose):
# def _mp_full(i, n_train, n_test, n_samples, verbose):
# def kmeanspp(X, n_clusters, x_squared_norms=None, random_state=None,
#              n_local_trials=None, return_ind=True, metric='sqeuclidean'):
#     def __init__(self, hr_algorithm='mp', n_neighbors=5, n_samples=100,
#                  sampling_algorithm='random', metric='sqeuclidean',
#                  predictor='knn',
#                  random_state=None, n_jobs=1, verbose=0, **kwargs):
#     def _times(self, action, times_start, times_end):
#     def _sparse_distance_matrix(self, X_test):
#     def _X_norm_squared_if_sqeuclidean(self, X):
#     def _random_sampling(self, X, y=None):
#     def _kmeanspp_sampling(self, X, y=None):
#     def _hnsw_filtering(self, X, k):
#     def _hnsw_trafo(self, X, k):
#     def _lsh_filtering(self, X, k):
#     def _lsh_trafo(self, X, k):
#     def _fit_without_hr(self, X, y=None):
#     def _transform_without_hr(self, X):
#     def _fit_mp(self, X, y=None):
#     def _transform_mp(self, X):
#     def _fit_mpg(self, X, y=None):
#     def _transform_mpg(self, X):
#     def _fit_ls(self, X, y=None):
#     def _transform_ls(self, X):
#     def _fit_dsl(self, X, y=None):
#     def _transform_dsl(self, X):
#     def _predict_knn(self, X):
#     def fit(self, X, y=None):
#     def transform(self, X):
#     def predict(self, X):
# class SuQHR(BaseEstimator, TransformerMixin):
# class ApproximateHubnessReduction(SuQHR):


# Path: tests/approximate_test.py
import unittest
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from hub_toolbox import approximate
from sklearn.metrics.classification import accuracy_score

        n_features = n_informative
        test_size = int(n_samples * .2)
        X, y = make_classification(
            n_samples=n_samples,
            n_features=n_features,
            n_informative=n_informative,
            n_redundant=0, n_repeated=0, n_classes=2,
            n_clusters_per_class=10, random_state=2847356)
        X_train, X_test, y_train, y_test = train_test_split(
            X.astype(np.float32), y.astype(np.int32), test_size=test_size)
        self.X_train = X_train
        self.X_test = X_test
        self.y_train = y_train
        self.y_test = y_test

        self.hr_algorithms = ['LS', 'NICDM', 'MP', 'MPG', 'DSL', None, 'NoNe']
        self.n_neighbors = 5
        self.n_samples = 100
        self.sampling_algorithms = ['random', 'kmeans++', 'LSH', 'HNSW',
                                    None, 'nOnE']
        self.metrics = ['sqeuclidean', 'cosine']
        self.n_jobs = [-1, 1]
        self.verbose = 0
        self.accu_time = 0.

    def tearDown(self):
        print(f'Accumulated time: {self.accu_time} seconds.')

    def _approximate_hr(self, hr_algorithm, sampling_algorithm,
                        metric, n_jobs):

        hr = approximate.SuQHR(hr_algorithm=hr_algorithm,