repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/models/test_kimcnn.py
test_init_parameters_default
self.assertEqual
complex_expr
24
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNInitTest(unittest.TestCase): DEFAULT_KERNEL_HEIGHTS = [3, 4, 5] def test_init_parameters_default(self): vocab_size = 1000 max_seq_length = 50 model = KimCNN(vocab_s...
model.pool_sizes)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/models/test_kimcnn.py
test_init_parameters_default
self.assertEqual
complex_expr
37
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNInitTest(unittest.TestCase): DEFAULT_KERNEL_HEIGHTS = [3, 4, 5] def test_init_parameters_default(self): vocab_size = 1000 max_seq_length = 50 model = KimCNN(vocab_s...
pool.kernel_size)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/models/test_kimcnn.py
test_init_parameters_specific
self.assertEqual
complex_expr
49
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNInitTest(unittest.TestCase): DEFAULT_KERNEL_HEIGHTS = [3, 4, 5] def test_init_parameters_specific(self): vocab_size = 1000 max_seq_length = 50 num_classes = 3 ...
conv.in_channels)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/classifiers/test_classification.py
test_transformer_model_arguments_init
self.assertEqual
complex_expr
23
import os import unittest import pytest import small_text import numpy as np from importlib import reload from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_stopping import EarlyStoppin...
model_args.model)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/utils/test_classification.py
test_initialize_transformer_components
self.assertEqual
complex_expr
52
import unittest import pytest import numpy as np from unittest.mock import patch, MagicMock from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class ClassificationUtilsTest(unittest.TestCase): def test_initialize_transformer_components(self): transformer_model = TransformerModel...
kwargs['config'])
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_active_learner.py
test_init
self.assertIsNone
complex_expr
117
import unittest import numpy as np from unittest.mock import call, patch, Mock, ANY from numpy.testing import assert_array_equal from scipy import sparse from scipy.sparse import csr_matrix, vstack from small_text.active_learner import ( AbstractPoolBasedActiveLearner, ActiveLearner, PoolBasedActiveLearne...
active_learner.y)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_base.py
test_check_optional_dependency
self.assertEqual
complex_expr
18
import unittest import small_text from small_text.base import check_optional_dependency from small_text.exceptions import MissingOptionalDependencyError class OptionalDependenciesTest(unittest.TestCase): def test_check_optional_dependency(self): small_text.base.OPTIONAL_DEPENDENCIES['not_installed'] = 'm...
context.expected)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_classification.py
test_empty_result_single_label_prediction
self.assertEqual
complex_expr
20
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from sklearn.preprocessing import MultiLabelBinarizer from small_text.utils.classification import empty_result, prediction_result from tests.utils.testing import assert_csr_matrix_equal class Classifi...
prediction.dtype)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_classification.py
test_empty_result_single_label_prediction
self.assertEqual
complex_expr
21
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from sklearn.preprocessing import MultiLabelBinarizer from small_text.utils.classification import empty_result, prediction_result from tests.utils.testing import assert_csr_matrix_equal class Classifi...
prediction.shape)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_clustering.py
test_init_kmeans_plusplus_safe
self.assertEqual
complex_expr
26
import unittest import pytest import numpy as np from unittest.mock import patch from small_text.utils.clustering import init_kmeans_plusplus_safe class ClusteringUtilsTest(unittest.TestCase): @patch('small_text.utils.clustering.warnings.warn') @patch('small_text.utils.clustering.choice') @patch('small_...
indices.shape[0])
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_init_default_parameters
self.assertIsNotNone
complex_expr
27
import unittest import pytest import numpy as np from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.metrics import Metric from small_text.training.early_stopping import EarlyStopping, EarlySto...
classifier.device)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/classifiers/test_classification.py
test_transformer_model_arguments_init
self.assertEqual
complex_expr
24
import os import unittest import pytest import small_text import numpy as np from importlib import reload from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_stopping import EarlyStoppin...
model_args.config)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/classifiers/test_classification.py
test_init
self.assertIsNotNone
complex_expr
35
import os import unittest import pytest import small_text import numpy as np from importlib import reload from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_stopping import EarlyStoppin...
classifier.device)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_labels.py
test_list_to_csr
self.assertEqual
complex_expr
30
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_IGNORED, LABEL_UNLABELED from small_text.utils.labels import ( concatenate, csr_to_list, get_flattened_unique_labels, get_ignored_labels_mask, get_n...
result.data.dtype)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_fit_and_predict_proba_dropout_sampling
self.assertSequenceEqual
complex_expr
36
import unittest import pytest import numpy as np from packaging.version import parse, Version from unittest.mock import patch from unittest import mock from unittest.mock import Mock from scipy.sparse import issparse from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training...
y_pred_proba.shape)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_classification.py
test_fit_with_class_weight
self.assertIsNotNone
complex_expr
35
import unittest import pytest import warnings import numpy as np from packaging.version import parse, Version from unittest import mock from unittest.mock import patch, Mock from scipy.sparse import issparse from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_s...
clf.class_weights_)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_classification.py
test_fit_and_predict_proba_dropout_sampling
self.assertSequenceEqual
complex_expr
39
import unittest import pytest import warnings import numpy as np from packaging.version import parse, Version from unittest import mock from unittest.mock import patch, Mock from scipy.sparse import issparse from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_s...
y_pred_proba.shape)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_setfit.py
test_fit_and_predict
self.assertEqual
complex_expr
55
import unittest import pytest import numpy as np from unittest.mock import create_autospec, patch from scipy.sparse import issparse from small_text.data.datasets import TextDataset from small_text.exceptions import UnsupportedOperationException from small_text.integrations.pytorch.exceptions import PytorchNotFoundErr...
y_pred_proba.shape)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_init_default_parameters
self.assertEqual
complex_expr
37
import unittest import pytest import numpy as np from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.metrics import Metric from small_text.training.early_stopping import EarlyStopping, EarlySto...
classifier.dropout)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn_embeddings.py
test_embed
self.assertEqual
complex_expr
37
import unittest import pytest import numpy as np from unittest import mock from small_text.integrations.pytorch.exceptions import PytorchNotFoundError def default_module_selector(m): return m['fc'] class _KimCNNEmbeddingTest(object): def test_embed(self): _, train, tokenizer = trec_dataset() # us...
embeddings.shape[0])
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_datasets.py
test_dataset_len
self.assertEqual
func_call
38
import unittest import numpy as np from copy import copy from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_UNLABELED from small_text.data.datasets import is_multi_label from small_text.data.datasets import ( SklearnDataset, DatasetView, Te...
len(ds))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_datasets.py
test_datasen_len
self.assertEqual
func_call
42
import unittest import pytest import numpy as np from abc import abstractmethod from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.data.exceptions import UnsupportedOperationExcept...
len(ds))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_datasets.py
test_get_features
self.assertEqual
func_call
42
import unittest import pytest import numpy as np from abc import abstractmethod from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.data.exceptions import UnsupportedOperationExcept...
len(ds.x))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/test_datasets.py
test_get_features
self.assertEqual
func_call
39
import unittest import pytest import numpy as np from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.datasets import PytorchDatasetView from small_text.integrat...
len(ds.x))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/test_datasets.py
test_indexing
self.assertEqual
func_call
16
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class TransformersDatasetTest(unittest.TestCase): def test_indexing(self): data = random_transformer_dataset(10) dataset = TransformersDataset(data) subset = data...
len(subset))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_datatset_views.py
test_indexing_single_index
self.assertEqual
func_call
77
import unittest import numpy as np from copy import copy from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.data.datasets import ( DatasetView, SklearnDataset, SklearnDatasetView, TextDataset, TextDatasetView ) from small_text.data.exceptions import U...
len(result))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_sampling.py
test_stratified_sampling_with_gaps
self.assertEqual
func_call
20
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.data import balanced_sampling, stratified_sampling from small_text.data.sampling import _get_class_histogram from small_text.utils.labels import list_to_csr class StratifiedSamplingTest...
len(counts))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_datasets.py
test_indexing_single_index
self.assertEqual
func_call
44
import unittest import pytest import numpy as np from abc import abstractmethod from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.data.exceptions import UnsupportedOperationExcept...
len(result))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/test_datasets.py
test_indexing_single_index
self.assertEqual
func_call
41
import unittest import pytest import numpy as np from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.datasets import PytorchDatasetView from small_text.integrat...
len(result))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_active_learner.py
test_query_with_custom_representation_invalid
assert
func_call
159
import unittest import numpy as np from unittest.mock import call, patch, Mock, ANY from numpy.testing import assert_array_equal from scipy import sparse from scipy.sparse import csr_matrix, vstack from small_text.active_learner import ( AbstractPoolBasedActiveLearner, ActiveLearner, PoolBasedActiveLearne...
len(dataset)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/test_datasets.py
test_init_and_len
self.assertEqual
func_call
15
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class TransformersDatasetTest(unittest.TestCase): def test_init_and_len(self): data = random_transformer_dataset(10) dataset = TransformersDataset(data) self.ass...
len(dataset))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_sampling.py
test_stratified_sampling
self.assertEqual
func_call
20
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.data import balanced_sampling, stratified_sampling from small_text.data.sampling import _get_class_histogram from small_text.utils.labels import list_to_csr class StratifiedSamplingTest...
len(indices))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/initialization/test_strategies.py
test_random_initialization
self.assertEqual
func_call
21
import unittest import numpy as np from unittest.mock import patch from scipy.sparse import csr_matrix from small_text.data import balanced_sampling, stratified_sampling from small_text.initialization import random_initialization, \ random_initialization_stratified, random_initialization_balanced from tests.util...
len(indices))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_dataset_construction.py
test_from_arrays_with_lists
self.assertEqual
func_call
19
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from tests.utils.datasets import random_labeling, random_labels, _train_tokenizer class PytorchTextClassificationDatasetSingleLabelTest(unittest.TestCase): def test_from_arrays_with_lists...
len(dataset))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/test_dataset_construction.py
test_from_arrays_with_lists
self.assertEqual
func_call
18
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from tests.utils.datasets import random_labeling, random_labels class TransformersDatasetSingleLabelTest(unittest.TestCase): def test_from_arrays_with_lists(self): texts = [f'trai...
len(dataset))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_coresets.py
test_simple_query
self.assertEqual
func_call
39
import unittest import numpy as np from small_text.classifiers import ConfidenceEnhancedLinearSVC from small_text.data.datasets import SklearnDataset from small_text.query_strategies import ( EmptyPoolException, greedy_coreset, GreedyCoreset, lightweight_coreset, LightweightCoreset ) from tests.un...
len(indices))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_strategies.py
test_simple_query
self.assertEqual
func_call
73
import unittest import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from scipy.sparse import csr_matrix from sklearn.preprocessing import normalize from unittest.mock import patch, Mock from small_text.classifiers import ConfidenceEnhancedLinearSVC, SklearnClassifier from small...
len(indices))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_active_learner.py
test_update_with_unlabeled_instances
self.assertEqual
func_call
169
import unittest import numpy as np from unittest.mock import call, patch, Mock, ANY from numpy.testing import assert_array_equal from scipy import sparse from scipy.sparse import csr_matrix, vstack from small_text.active_learner import ( AbstractPoolBasedActiveLearner, ActiveLearner, PoolBasedActiveLearne...
len(dataset))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_active_learner.py
test_query_update_mismatch
self.assertEqual
func_call
147
import unittest import numpy as np from unittest.mock import call, patch, Mock, ANY from numpy.testing import assert_array_equal from scipy import sparse from scipy.sparse import csr_matrix, vstack from small_text.active_learner import ( AbstractPoolBasedActiveLearner, ActiveLearner, PoolBasedActiveLearne...
len(indices))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/training/test_metrics.py
test_repr
self.assertEqual
func_call
10
import unittest from small_text.training.metrics import Metric class MetricsTest(unittest.TestCase): def test_repr(self): metric = Metric('train_acc', dtype=float, lower_is_better=False) self.assertEqual('Metric(\'train_acc\', dtype=float, lower_is_better=False)',
repr(metric))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_strategies.py
test_badge_str
self.assertEqual
func_call
14
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class BADGETest(unittest.TestCase): def test_badge_str(self): strategy = BADGE(2) expected_str = 'BADGE(num_classes=2)' self.assertEqual(expected_str,
str(strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_bayesian.py
test_str
self.assertEqual
func_call
22
import unittest import numpy as np from small_text.classifiers import ConfidenceEnhancedLinearSVC from small_text.query_strategies.bayesian import BALD, _bald from tests.utils.datasets import random_sklearn_dataset from tests.utils.testing import assert_array_equal class BALDTest(unittest.TestCase): def _get_cl...
str(strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_class_balancing.py
test_class_balancer_str
self.assertEqual
func_call
24
import unittest import numpy as np from unittest import mock from small_text import ( ConfidenceEnhancedLinearSVC, RandomSampling, SklearnClassifier, SklearnDataset ) from small_text.data.sampling import _get_class_histogram from small_text.query_strategies.class_balancing import ClassBalancer, _get_r...
str(strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_coresets.py
test_str
self.assertEqual
func_call
37
import unittest import numpy as np from small_text.classifiers import ConfidenceEnhancedLinearSVC from small_text.data.datasets import SklearnDataset from small_text.query_strategies import ( EmptyPoolException, greedy_coreset, GreedyCoreset, lightweight_coreset, LightweightCoreset ) from tests.un...
str(strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_annotations.py
test_deprecate_function
self.assertTrue
func_call
25
import unittest from packaging import version from unittest.mock import patch from small_text.utils.annotations import ( deprecated, experimental, DeprecationError, ExperimentalWarning ) class DeprecationUtilsTest(unittest.TestCase): def test_deprecate_function(self): from small_text.uti...
myfunc('foo'))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/models/test_kimcnn.py
test_simple_prediction
self.assertEqual
func_call
25
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNIntegrationTest(unittest.TestCase): def test_simple_prediction(self): """ Simple prediction with default weights (untrained). """ n = 10 vocab_size = 11 ...
output.size(0))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/models/test_kimcnn.py
test_simple_prediction
self.assertEqual
func_call
26
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNIntegrationTest(unittest.TestCase): def test_simple_prediction(self): """ Simple prediction with default weights (untrained). """ n = 10 vocab_size = 11 ...
output.size(1))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/utils/test_loss.py
test_loss_fct
self.assertEqual
func_call
17
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class LossTest(unittest.TestCase): def test_loss_fct(self): loss_fct = _LossAdapter2DTo1D(BCEWithLogitsLoss(reduction='none')) input = torch.randn(5, 3) target = torch.empty(5, 3).ra...
len(loss.shape))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/classifiers/test_svm.py
test_predict_binary_with_probas
self.assertEqual
func_call
31
import unittest from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import CountVectorizer from small_text.classifiers import ConfidenceEnhancedLinearSVC class ConfidenceEnhancedLinearSVCIntegrationTest(unittest.TestCase): def _get_20news_vectors(self, categories=None): ...
len(proba.shape))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_fit_and_predict
self.assertTrue
func_call
45
import unittest import pytest import numpy as np from packaging.version import parse, Version from unittest.mock import patch from unittest import mock from unittest.mock import Mock from scipy.sparse import issparse from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training...
issparse(y_pred))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_classification.py
test_fit_and_predict
self.assertTrue
func_call
47
import unittest import pytest import warnings import numpy as np from packaging.version import parse, Version from unittest import mock from unittest.mock import patch, Mock from scipy.sparse import issparse from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_s...
issparse(y_pred))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_setfit.py
test_fit_and_predict
self.assertTrue
func_call
45
import unittest import pytest import numpy as np from unittest.mock import create_autospec, patch from scipy.sparse import issparse from small_text.data.datasets import TextDataset from small_text.exceptions import UnsupportedOperationException from small_text.integrations.pytorch.exceptions import PytorchNotFoundErr...
issparse(y_pred))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/models/test_kimcnn.py
test_init_parameters_default
self.assertEqual
func_call
35
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNInitTest(unittest.TestCase): DEFAULT_KERNEL_HEIGHTS = [3, 4, 5] def test_init_parameters_default(self): vocab_size = 1000 max_seq_length = 50 model = KimCNN(vocab_s...
len(model.pools))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/models/test_kimcnn.py
test_init_parameters_default
self.assertEqual
func_call
39
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class KimCNNInitTest(unittest.TestCase): DEFAULT_KERNEL_HEIGHTS = [3, 4, 5] def test_init_parameters_default(self): vocab_size = 1000 max_seq_length = 50 model = KimCNN(vocab_s...
len(model.convs))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/classifiers/test_svm.py
test_predict_binary
self.assertEqual
func_call
27
import unittest from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import CountVectorizer from small_text.classifiers import ConfidenceEnhancedLinearSVC class ConfidenceEnhancedLinearSVCIntegrationTest(unittest.TestCase): def _get_20news_vectors(self, categories=None): ...
len(y_pred.shape))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_splits.py
test_split_data_random
self.assertEqual
func_call
20
import unittest import numpy as np from unittest import mock from small_text.data.sampling import balanced_sampling, stratified_sampling from small_text.data.splits import split_data from tests.utils.datasets import random_sklearn_dataset class SplitDataTest(unittest.TestCase): @mock.patch('numpy.random.permut...
len(subset_train))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_splits.py
test_split_data_random
self.assertEqual
func_call
21
import unittest import numpy as np from unittest import mock from small_text.data.sampling import balanced_sampling, stratified_sampling from small_text.data.splits import split_data from tests.utils.datasets import random_sklearn_dataset class SplitDataTest(unittest.TestCase): @mock.patch('numpy.random.permut...
len(subset_valid))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_fit_with_validation_set
self.assertEqual
func_call
34
import unittest import pytest import numpy as np from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.metrics import Metric from small_text.training.early_stopping import EarlyStopping, EarlySto...
len(call_args[0]))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py
test_fit_with_validation_set
self.assertEqual
func_call
35
import unittest import pytest import numpy as np from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.metrics import Metric from small_text.training.early_stopping import EarlyStopping, EarlySto...
len(call_args[1]))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/classifiers/test_classification.py
test_fit_with_validation_set
self.assertEqual
func_call
36
import os import unittest import pytest import small_text import numpy as np from importlib import reload from unittest.mock import patch from small_text.base import LABEL_UNLABELED from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.training.early_stopping import EarlyStoppin...
len(call_args[0]))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/test_serialization.py
test_and_load_with_file_str
self.assertEqual
func_call
45
import unittest import tempfile import pytest import numpy as np from numpy.testing import assert_array_equal from small_text.active_learner import PoolBasedActiveLearner from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.query_strategies import RandomSampling from tests.ut...
len(weights_after))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/test_serialization.py
test_and_load_with_file_str
self.assertEqual
func_call
53
import unittest import tempfile import pytest import numpy as np from numpy.testing import assert_array_equal from small_text.active_learner import PoolBasedActiveLearner from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.query_strategies import RandomSampling from small_te...
len(weights_after))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_system.py
test_get_offline_mode
self.assertFalse
func_call
19
import os import unittest from unittest.mock import patch from small_text.utils.system import ( OFFLINE_MODE_VARIABLE, PROGRESS_BARS_VARIABLE, TMP_DIR_VARIABLE, get_offline_mode, get_progress_bars_default, get_tmp_dir_base ) class SystemUtilsTest(unittest.TestCase): def test_get_offline_...
get_offline_mode())
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_system.py
test_get_tmp_dir_base
self.assertIsNone
func_call
19
import os import unittest from unittest.mock import patch from small_text.utils.system import ( OFFLINE_MODE_VARIABLE, PROGRESS_BARS_VARIABLE, TMP_DIR_VARIABLE, get_offline_mode, get_progress_bars_default, get_tmp_dir_base ) class SystemUtilsTest(unittest.TestCase): def test_get_tmp_dir_...
get_tmp_dir_base())
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/query_strategies/test_query_strategies.py
test_str
self.assertEqual
func_call
45
import unittest import pytest import numpy as np from unittest.mock import Mock, patch from numpy.testing import assert_array_equal from sklearn.base import clone from sklearn.preprocessing import normalize from small_text.query_strategies.exceptions import EmptyPoolException from small_text.classifiers import Conf...
str(query_strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_multi_label.py
test_init_with_nondefault_args
self.assertEqual
func_call
20
import unittest import numpy as np from scipy.sparse import csr_matrix from small_text.query_strategies.multi_label import ( CategoryVectorInconsistencyAndRanking, _label_cardinality_inconsistency, LabelCardinalityInconsistency, _uncertainty_weighted_label_cardinality_inconsistency, AdaptiveActive...
str(query_strategy))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_labels.py
test_get_num_labels_sparse
self.assertEqual
func_call
31
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_IGNORED, LABEL_UNLABELED from small_text.utils.labels import ( concatenate, csr_to_list, get_flattened_unique_labels, get_ignored_labels_mask, get_n...
get_num_labels(mat))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/utils/test_setfit.py
test_truncate_texts
self.assertEqual
func_call
27
import unittest import pytest import numpy as np from small_text.data.datasets import TextDataset from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class SetFitUtilsTest(unittest.TestCase): def test_truncate_texts(self): model_args = SetFitModelArguments('sentence-transformers/p...
len(result_datasets))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/transformers/classifiers/test_classification_embeddings.py
test_embed
self.assertEqual
func_call
34
import unittest import pytest from unittest import mock from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from tests.utils.datasets import twenty_news_transformers from tests.utils.testing import assert_array_not_equal class _EmbeddingTest(object): def test_embed(self): classifi...
len(embeddings.shape))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/query_strategies/test_base.py
test_argselect_maximum
assert_*
func_call
18
import unittest import numpy as np from numpy.testing import assert_array_almost_equal from small_text.query_strategies.base import argselect class ArgselectIntegrationTest(unittest.TestCase): def test_argselect_maximum(self, n=5): for _ in range(1000): arr = np.random.randn(100) ...
np.sort(arr[indices]))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_base.py
test_argselect_without_ties_maximum
assert_*
func_call
22
import unittest import scipy import numpy as np from small_text.classifiers.classification import SklearnClassifier, ConfidenceEnhancedLinearSVC from small_text.query_strategies.base import ClassificationType, argselect, constraints from small_text.query_strategies.strategies import RandomSampling from numpy.testing...
np.sort(arr[indices]))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_datetime.py
test_format_timedelta
self.assertEqual
func_call
11
import datetime import unittest from small_text.utils.datetime import format_timedelta class DatetimeUtilsTest(unittest.TestCase): def test_format_timedelta(self): td1 = datetime.timedelta(hours=9, minutes=0, seconds=59) self.assertEqual('09:00:59',
format_timedelta(td1))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_datetime.py
test_format_timedelta
self.assertEqual
func_call
14
import datetime import unittest from small_text.utils.datetime import format_timedelta class DatetimeUtilsTest(unittest.TestCase): def test_format_timedelta(self): td1 = datetime.timedelta(hours=9, minutes=0, seconds=59) self.assertEqual('09:00:59', format_timedelta(td1)) td2 = datetime....
format_timedelta(td2))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/test_datasets.py
test_dataset_to_copy
self.assertFalse
func_call
32
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class PytorchTextClassificationDatasetTest(unittest.TestCase): def test_dataset_to_copy(self): ds = random_text_classification_dataset(10) self.assertTrue(ds.target_label...
hasattr(ds_new, 'TEST'))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/initialization/test_strategies.py
test_random_initialization
self.assertEqual
func_call
22
import unittest import numpy as np from unittest.mock import patch from scipy.sparse import csr_matrix from small_text.data import balanced_sampling, stratified_sampling from small_text.initialization import random_initialization, \ random_initialization_stratified, random_initialization_balanced from tests.util...
len(np.unique(indices)))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/utils/test_classification.py
_assert_params
self.assertTrue
func_call
16
import unittest import pytest import numpy as np from unittest.mock import patch, MagicMock from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class BuildLayerSpecificParamsTest(unittest.TestCase): def _assert_params(self, params, base_lr, num_different_lrs): self.assertIsNotNon...
isinstance(param, dict))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/integrations/pytorch/test_datasets.py
test_dataset_to
self.assertTrue
func_call
16
import unittest import pytest import numpy as np from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class PytorchTextClassificationDatasetTest(unittest.TestCase): def test_dataset_to(self): ds = random_text_classification_dataset(10) tensor_is_on_cpu = [item[PytorchText...
np.all(tensor_is_on_cpu))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_splits.py
test_split_data_random_return_indices
self.assertEqual
func_call
20
import unittest import numpy as np from unittest import mock from small_text.data.sampling import balanced_sampling, stratified_sampling from small_text.data.splits import split_data from tests.utils.datasets import random_sklearn_dataset class SplitDataTest(unittest.TestCase): @mock.patch('numpy.random.permut...
len(indices_train.shape))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_bayesian.py
test_bald_with_only_zeros_no_epsilon
self.assertTrue
func_call
17
import unittest import numpy as np from small_text.classifiers import ConfidenceEnhancedLinearSVC from small_text.query_strategies.bayesian import BALD, _bald from tests.utils.datasets import random_sklearn_dataset from tests.utils.testing import assert_array_equal class BALDHelperTest(unittest.TestCase): def t...
np.all(np.isnan(result)))
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/query_strategies/test_query_strategies.py
test_query_when_unlabeled_pool_is_smaller_than_k
assert_*
variable
70
import unittest import pytest import numpy as np from unittest.mock import Mock, patch from numpy.testing import assert_array_equal from sklearn.base import clone from sklearn.preprocessing import normalize from small_text.query_strategies.exceptions import EmptyPoolException from small_text.classifiers import Conf...
y)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/initialization/test_strategies.py
test_random_initialization_stratified
assert_*
variable
24
import unittest import numpy as np from unittest.mock import patch from scipy.sparse import csr_matrix from small_text.data import balanced_sampling, stratified_sampling from small_text.initialization import random_initialization, \ random_initialization_stratified, random_initialization_balanced from tests.util...
y)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/query_strategies/test_class_balancing.py
test_subsample_when_not_enough_samples
assert_*
variable
40
import unittest import numpy as np from unittest import mock from small_text import ( ConfidenceEnhancedLinearSVC, RandomSampling, SklearnClassifier, SklearnDataset ) from small_text.data.sampling import _get_class_histogram from small_text.query_strategies.class_balancing import ClassBalancer, _get_r...
n)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/utils/testing.py
assert_array_not_equal
assert_*
variable
9
import numpy as np from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal, assert_raises def assert_array_not_equal(x, y): assert_raises(AssertionError, assert_array_equal, x,
y)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/test_active_learner.py
test_query
assert_*
variable
160
import unittest import numpy as np from unittest.mock import call, patch, Mock, ANY from numpy.testing import assert_array_equal from scipy import sparse from scipy.sparse import csr_matrix, vstack from small_text.active_learner import ( AbstractPoolBasedActiveLearner, ActiveLearner, PoolBasedActiveLearne...
ANY)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_logging.py
test_debug
assert_*
variable
19
import logging import unittest from logging import Logger, INFO, DEBUG from unittest.mock import patch from small_text import VerbosityLogger, verbosity_logger, VERBOSITY_QUIET, VERBOSITY_ALL class VerbosityLoggerTest(unittest.TestCase): @patch('small_text.utils.logging.Logger.debug') def test_debug(self, d...
msg)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/utils/misc.py
random_seed
assert
variable
21
import os import numpy as np def increase_dense_labels_safe(ds): """Increase the labels without leaving the range of the target_labels property. The only purpose of this operation is to alter the labels so we can check for a change later.""" # modulo needs not be used when single index result is 0 if...
seed
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/stopping_criteria/test_base.py
test_first_stop_call
self.assertFalse
variable
17
import unittest import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from small_text.stopping_criteria.base import DeltaFScore class DeltaFScoreTest(unittest.TestCase): def test_first_stop_call(self): stopping_criterion = DeltaFScore(2) predictions = np.arr...
stop)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/stopping_criteria/test_change.py
test_first_stop_call
self.assertFalse
variable
20
import unittest import numpy as np from numpy.testing import assert_array_equal from small_text.stopping_criteria.change import ClassificationChange from small_text.utils.labels import list_to_csr from tests.utils.testing import assert_csr_matrix_equal class ClassificationChangeSingleLabelStopTest(unittest.TestCase...
stop)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/stopping_criteria/test_kappa.py
test_first_stop_call
self.assertFalse
variable
17
import unittest import numpy as np from numpy.testing import assert_array_equal from small_text.stopping_criteria.kappa import KappaAverage, _adapted_cohen_kappa_score class KappaAverageTest(unittest.TestCase): def test_first_stop_call(self): stopping_criterion = KappaAverage(2) predictions = n...
stop)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/stopping_criteria/test_uncertainty.py
test_first_stop_call
self.assertFalse
variable
17
import unittest import numpy as np from small_text.stopping_criteria.uncertainty import OverallUncertainty class OverallUncertaintyTest(unittest.TestCase): def test_first_stop_call(self): stopping_criterion = OverallUncertainty(2) proba = np.array([ [0.5, 0.5] ]) sto...
stop)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/stopping_criteria/test_utility.py
test_immedita_stop
self.assertTrue
variable
11
import unittest from small_text.stopping_criteria.utility import MaxIterations class MaxIterationsTest(unittest.TestCase): def test_immedita_stop(self): stopping_criterion = MaxIterations(1) stop = stopping_criterion.stop() self.assertTrue(
stop)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_labels.py
test_get_ignored_labels_mask_dense
assert_*
variable
29
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_IGNORED, LABEL_UNLABELED from small_text.utils.labels import ( concatenate, csr_to_list, get_flattened_unique_labels, get_ignored_labels_mask, get_n...
mask)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/integration/small_text/query_strategies/test_query_strategies.py
test_initialize_index_default_hnsw_kwargs
self.assertIsNotNone
variable
50
import unittest import pytest import numpy as np from unittest.mock import Mock, patch from numpy.testing import assert_array_equal from sklearn.base import clone from sklearn.preprocessing import normalize from small_text.query_strategies.exceptions import EmptyPoolException from small_text.classifiers import Conf...
index)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_dataset_construction.py
test_from_arrays_with_lists
assert_*
variable
32
import unittest import numpy as np from numpy.testing import assert_array_equal from sklearn.feature_extraction.text import TfidfVectorizer from unittest.mock import patch from small_text.data import SklearnDataset, TextDataset from tests.utils.datasets import random_labeling, random_labels from tests.utils.testing i...
texts)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/data/test_datasets.py
test_set_labels
assert_*
variable
42
import unittest import numpy as np from copy import copy from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_UNLABELED from small_text.data.datasets import is_multi_label from small_text.data.datasets import ( SklearnDataset, DatasetView, Te...
y_new)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/pytorch/test_datasets.py
test_iter
self.assertEqual
variable
45
import unittest import pytest import numpy as np from abc import abstractmethod from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal from parameterized import parameterized_class from small_text.base import LABEL_UNLABELED from small_text.data.exceptions import UnsupportedOperationExcept...
count)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/classifiers/test_setfit.py
test_init_model_loading_strategy_default
self.assertIsNotNone
variable
33
import os import unittest import pytest import small_text from importlib import reload from packaging.version import parse, Version from unittest.mock import patch from small_text.integrations.pytorch.exceptions import PytorchNotFoundError from small_text.utils.logging import VERBOSITY_QUIET, VERBOSITY_MORE_VERBOSE ...
model)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/integrations/transformers/utils/test_classification.py
test_initialize_transformer_components
self.assertIsNotNone
variable
32
import unittest import pytest import numpy as np from unittest.mock import patch, MagicMock from small_text.integrations.pytorch.exceptions import PytorchNotFoundError class ClassificationUtilsTest(unittest.TestCase): def test_initialize_transformer_components(self): transformer_model = TransformerModel...
model)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/unit/small_text/utils/test_labels.py
test_remove_by_index_dense
assert_*
variable
29
import unittest import numpy as np from numpy.testing import assert_array_equal from scipy.sparse import csr_matrix from small_text.base import LABEL_IGNORED, LABEL_UNLABELED from small_text.utils.labels import ( concatenate, csr_to_list, get_flattened_unique_labels, get_ignored_labels_mask, get_n...
y_new)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor
webis-de/small-text
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
train
train
tests/utils/testing.py
assert_list_of_tensors_not_equal
assert_*
variable
36
import numpy as np from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal, assert_raises def assert_array_not_equal(x, y): assert_raises(AssertionError, assert_array_equal, x, y) def assert_csr_matrix_equal(x, y, check_shape=True): if check_shape and x.shape != y.shape: rai...
other)
62e6f754f4a383f0bfba2f02ab272fe2ab5aac2e
181
v2_extractor_at_anchor