This file contains 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.sparse.csgraph import laplacian | |
from sklearn.utils import check_random_state | |
from scipy.sparse import coo_matrix | |
from numpy.testing import assert_array_almost_equal | |
RNG = check_random_state(0) | |
def test_loss_sdml(): | |
n_samples = 10 |
This file contains 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 metric_learn import MLKR | |
from sklearn.utils import check_random_state | |
import numpy as np | |
from losses import _loss_non_optimized, _loss_optimized | |
from collections import defaultdict | |
from sklearn.datasets import make_regression | |
for n_features in [5, 100]: | |
print('n_features={}'.format(n_features)) |
This file contains 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.sparse.csgraph import laplacian | |
from sklearn.utils import check_random_state | |
from scipy.sparse import coo_matrix | |
from numpy.testing import assert_allclose | |
RNG = check_random_state(0) | |
def test_loss_sdml_uncertainties(): | |
n_samples = 10 |
This file contains 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 sklearn.utils.extmath import softmax | |
from sklearn.kernel_approximation import RBFSampler | |
from sklearn_extra.kernel_approximation import Fastfood | |
seed = 42 | |
rng = np.random.RandomState(seed) | |
D = 20 |