repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
uncertainty-project | uncertainty-project-master/Code/core/overlaps.py |
from dataclasses import dataclass, fields
from typing import List
import numpy as np
@dataclass
class Overlaps:
rho : float = float("nan")
# For BO
qbo : float = float("nan")
# should be used when we do experiments (so q is not exactly m)
mbo : float = float("nan")
# for ERM
qerm ... | 1,616 | 30.096154 | 103 | py |
uncertainty-project | uncertainty-project-master/Code/core/models/amp_erm.py | import sys
from time import time
from abc import ABC
from typing import Tuple
import scipy.optimize as opt
import numpy as np
sys.path.append('..')
sys.path.append('core')
import utility
class ERM:
"""
NOTE : This code should not be changed in the noiseless case as it's not aware of the noise
and explici... | 2,876 | 33.25 | 123 | py |
uncertainty-project | uncertainty-project-master/Code/core/models/bayes_optimal.py | from typing import Tuple
import warnings
from abc import ABC
import numpy as np
from scipy.special import erfc
H_ = lambda x : 0.5 * erfc(x / np.sqrt(2.))
class BayesOptimal(ABC):
"""
Contains the channel / denoising function used in AMP for the bayes optimal setting
where
y = sgn(w . x) and w has ... | 2,202 | 30.927536 | 93 | py |
uncertainty-project | uncertainty-project-master/Code/experiments/joint_density.py | # joint_density.py
# Used to compute the joint probability distribution between ERM and BO
import itertools
import sys
from typing import Tuple
from tqdm.utils import disp_len
sys.path.append('core')
sys.path.append('experiments')
import matplotlib as mpl
import matplotlib.pyplot as plt
import json
import numpy as... | 6,288 | 34.937143 | 176 | py |
uncertainty-project | uncertainty-project-master/Code/experiments/display.py | import matplotlib.pyplot as plt
import json
import scipy.ndimage as ndimage
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.colors import LogNorm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib as mpl
import numpy as np
def plot_from_density(density :... | 1,497 | 37.410256 | 186 | py |
featuretools | featuretools-main/featuretools/__main__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/config_init.py | import copy
import logging
import os
import sys
def initialize_logging():
loggers = {}
# Check for environmental variables
logger_env_vars = {
"FEATURETOOLS_LOG_LEVEL": "featuretools",
"FEATURETOOLS_ES_LOG_LEVEL": "featuretools.entityset",
"FEATURETOOLS_BACKEND_LOG_LEVEL": "featur... | 2,078 | 27.479452 | 77 | py |
featuretools | featuretools-main/featuretools/exceptions.py | class UnknownFeature(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class UnusedPrimitiveWarning(UserWarning):
pass
| 178 | 21.375 | 49 | py |
featuretools | featuretools-main/featuretools/version.py | __version__ = "1.26.0"
ENTITYSET_SCHEMA_VERSION = "9.0.0"
FEATURES_SCHEMA_VERSION = "10.0.0"
| 93 | 22.5 | 34 | py |
featuretools | featuretools-main/featuretools/__init__.py | # flake8: noqa
from featuretools.version import __version__
from featuretools.config_init import config
from featuretools.entityset.api import *
from featuretools import primitives
from featuretools.synthesis.api import *
from featuretools.primitives import list_primitives, summarize_primitives
from featuretools.comput... | 2,152 | 32.640625 | 82 | py |
featuretools | featuretools-main/featuretools/synthesis/dfs.py | import warnings
from featuretools.computational_backends import calculate_feature_matrix
from featuretools.entityset import EntitySet
from featuretools.exceptions import UnusedPrimitiveWarning
from featuretools.synthesis.deep_feature_synthesis import DeepFeatureSynthesis
from featuretools.synthesis.utils import _categ... | 14,419 | 43.782609 | 167 | py |
featuretools | featuretools-main/featuretools/synthesis/deep_feature_synthesis.py | import functools
import logging
import operator
import warnings
from collections import defaultdict
from typing import Any, DefaultDict, Dict, List
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Boolean, BooleanNullable
from featuretools import primitives
from featuretools.entityse... | 47,691 | 35.406107 | 114 | py |
featuretools | featuretools-main/featuretools/synthesis/utils.py | from featuretools.feature_base import (
AggregationFeature,
FeatureOutputSlice,
GroupByTransformFeature,
TransformFeature,
)
from featuretools.utils.gen_utils import camel_and_title_to_snake
def _categorize_features(features):
"""Categorize each feature by its primitive type in a set of primitives... | 1,830 | 28.063492 | 111 | py |
featuretools | featuretools-main/featuretools/synthesis/api.py | # flake8: noqa
from featuretools.synthesis.deep_feature_synthesis import DeepFeatureSynthesis
from featuretools.synthesis.dfs import dfs
from featuretools.synthesis.encode_features import encode_features
from featuretools.synthesis.get_valid_primitives import get_valid_primitives
| 281 | 46 | 78 | py |
featuretools | featuretools-main/featuretools/synthesis/encode_features.py | import logging
import pandas as pd
from featuretools.computational_backends.utils import get_ww_types_from_features
from featuretools.utils.gen_utils import make_tqdm_iterator
logger = logging.getLogger("featuretools")
DEFAULT_TOP_N = 10
def encode_features(
feature_matrix,
features,
top_n=DEFAULT_TOP... | 7,377 | 36.075377 | 84 | py |
featuretools | featuretools-main/featuretools/synthesis/__init__.py | # flake8: noqa
from featuretools.synthesis.api import *
| 56 | 18 | 40 | py |
featuretools | featuretools-main/featuretools/synthesis/get_valid_primitives.py | from featuretools.primitives import AggregationPrimitive, TransformPrimitive
from featuretools.primitives.utils import (
get_aggregation_primitives,
get_transform_primitives,
)
from featuretools.synthesis.deep_feature_synthesis import DeepFeatureSynthesis
from featuretools.synthesis.utils import _categorize_fea... | 4,388 | 38.9 | 98 | py |
featuretools | featuretools-main/featuretools/tests/conftest.py | import contextlib
import copy
import os
import composeml as cp
import numpy as np
import pandas as pd
import pytest
from packaging.version import parse
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Boolean, Integer
from featuretools import EntitySet, demo
from featuretools.primiti... | 25,391 | 27.43449 | 315 | py |
featuretools | featuretools-main/featuretools/tests/test_version.py | from featuretools import __version__
def test_version():
assert __version__ == "1.26.0"
| 94 | 14.833333 | 36 | py |
featuretools | featuretools-main/featuretools/tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/demo_tests/test_demo_data.py | import urllib.request
import pandas as pd
import pytest
from featuretools import EntitySet
from featuretools.demo import load_flight, load_mock_customer, load_retail, load_weather
@pytest.fixture(autouse=True)
def set_testing_headers():
opener = urllib.request.build_opener()
opener.addheaders = [("Testing",... | 2,170 | 28.739726 | 88 | py |
featuretools | featuretools-main/featuretools/tests/demo_tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/synthesis/test_dfs_method.py | from unittest.mock import patch
import composeml as cp
import numpy as np
import pandas as pd
import pytest
from packaging.version import parse
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import NaturalLanguage
from featuretools.computational_backends.calculate_feature_matrix import (
... | 24,820 | 33.425798 | 177 | py |
featuretools | featuretools-main/featuretools/tests/synthesis/test_dask_dfs.py | import pandas as pd
import pytest
from woodwork.logical_types import (
Datetime,
Double,
Integer,
IntegerNullable,
NaturalLanguage,
)
from featuretools import dfs
from featuretools.entityset import EntitySet
from featuretools.utils.gen_utils import import_or_none
dd = import_or_none("dask.datafram... | 14,056 | 26.401559 | 111 | py |
featuretools | featuretools-main/featuretools/tests/synthesis/test_encode_features.py | import pandas as pd
import pytest
from featuretools import EntitySet, calculate_feature_matrix, dfs
from featuretools.feature_base import Feature, IdentityFeature
from featuretools.primitives import NMostCommon
from featuretools.synthesis import encode_features
def test_encodes_features(pd_es):
f1 = IdentityFeat... | 11,258 | 30.188366 | 90 | py |
featuretools | featuretools-main/featuretools/tests/synthesis/test_spark_dfs.py | import pandas as pd
import pytest
from woodwork.logical_types import (
Datetime,
Double,
Integer,
IntegerNullable,
NaturalLanguage,
)
from featuretools import dfs
from featuretools.entityset import EntitySet
from featuretools.utils.gen_utils import import_or_none
ps = import_or_none("pyspark.panda... | 14,974 | 26.990654 | 113 | py |
featuretools | featuretools-main/featuretools/tests/synthesis/test_deep_feature_synthesis.py | import copy
import re
import pandas as pd
import pytest
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Datetime
from featuretools import EntitySet, Feature, GroupByTransformFeature
from featuretools.entityset.entityset import LTI_COLUMN_NAME
from featuretools.feature_base import (
... | 69,688 | 32.488227 | 148 | py |
featuretools | featuretools-main/featuretools/tests/synthesis/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/synthesis/test_get_valid_primitives.py | import pytest
from woodwork.column_schema import ColumnSchema
from featuretools.primitives import (
AggregationPrimitive,
Count,
Hour,
IsIn,
Not,
TimeSincePrevious,
TransformPrimitive,
)
from featuretools.synthesis.get_valid_primitives import get_valid_primitives
from featuretools.utils.gen... | 4,778 | 28.140244 | 108 | py |
featuretools | featuretools-main/featuretools/tests/profiling/dfs_profile.py | """
dfs_profile.py
Helper module to allow profiling of the dfs operations. At some point we may
want to use pstats to output the results to a log, but I'm anticipating that
LookingGlass will provide the performance data we want.
Notes:
- output currently goes to the root directory and is in dfs_profile.stats
- *... | 1,118 | 27.692308 | 84 | py |
featuretools | featuretools-main/featuretools/tests/profiling/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_utils_info.py | import os
import pytest
from featuretools import __version__
from featuretools.utils import (
get_featuretools_root,
get_installed_packages,
get_sys_info,
show_info,
)
@pytest.fixture
def this_dir():
return os.path.dirname(os.path.abspath(__file__))
def test_show_info(capsys):
show_info()
... | 1,514 | 21.954545 | 76 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_config.py | import logging
import os
from featuretools.config_init import initialize_logging
logging_env_vars = {
"FEATURETOOLS_LOG_LEVEL": "debug",
"FEATURETOOLS_ES_LOG_LEVEL": "critical",
"FEATURETOOLS_BACKEND_LOG_LEVEL": "error",
}
def test_logging_defaults():
old_env_vars = {}
for env_var in logging_env... | 1,703 | 33.08 | 74 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_gen_utils.py | import pandas as pd
import pytest
from woodwork import list_logical_types as ww_list_logical_types
from woodwork import list_semantic_tags as ww_list_semantic_tags
from featuretools import list_logical_types, list_semantic_tags
from featuretools.utils.gen_utils import (
camel_and_title_to_snake,
import_or_none... | 3,014 | 32.131868 | 75 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_entry_point.py | import pandas as pd
import pytest
from featuretools import dfs
@pytest.fixture
def pd_entry_point_dfs():
cards_df = pd.DataFrame({"id": [1, 2, 3, 4, 5]})
transactions_df = pd.DataFrame(
{
"id": [1, 2, 3, 4, 5, 6],
"card_id": [1, 2, 1, 3, 4, 5],
"transaction_time": ... | 3,506 | 29.763158 | 85 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_recommend_primitives.py | import logging
import pandas as pd
import pytest
from woodwork.logical_types import NaturalLanguage
from woodwork.table_schema import ColumnSchema
from featuretools import EntitySet
from featuretools.primitives import Day, TransformPrimitive
from featuretools.utils.recommend_primitives import (
DEFAULT_EXCLUDED_P... | 7,844 | 28.055556 | 156 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_description_utils.py | from featuretools.utils.description_utils import convert_to_nth
def test_first():
assert convert_to_nth(1) == "1st"
assert convert_to_nth(21) == "21st"
assert convert_to_nth(131) == "131st"
def test_second():
assert convert_to_nth(2) == "2nd"
assert convert_to_nth(22) == "22nd"
assert conver... | 787 | 25.266667 | 63 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_trie.py | from featuretools.utils import Trie
def test_get_node():
t = Trie(default=lambda: "default")
t.get_node([1, 2, 3]).value = "123"
t.get_node([1, 2, 4]).value = "124"
sub = t.get_node([1, 2])
assert sub.get_node([3]).value == "123"
assert sub.get_node([4]).value == "124"
sub.get_node([4, 5... | 1,309 | 25.734694 | 63 | py |
featuretools | featuretools-main/featuretools/tests/utils_tests/test_time_utils.py | from datetime import datetime, timedelta
from itertools import chain
import numpy as np
import pandas as pd
import pytest
from featuretools.utils import convert_time_units, make_temporal_cutoffs
from featuretools.utils.time_utils import (
calculate_trend,
convert_datetime_to_floats,
convert_timedelta_to_f... | 7,746 | 29.261719 | 86 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/generate_fake_dataframe.py | import random
from datetime import datetime as dt
import pandas as pd
import woodwork.type_sys.type_system as ww_type_system
from woodwork import logical_types
logical_type_mapping = {
logical_types.Boolean.__name__: [True, False],
logical_types.BooleanNullable.__name__: [True, False, pd.NA],
logical_type... | 3,103 | 29.431373 | 88 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/features.py | import re
from featuretools.entityset.relationship import RelationshipPath
def feature_with_name(features, name):
for f in features:
if f.get_name() == name:
return True
return False
def number_of_features_with_name_like(features, pattern):
"""Returns number of features with names t... | 2,278 | 28.217949 | 85 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/cluster.py | from psutil import virtual_memory
def mock_cluster(
n_workers=1,
threads_per_worker=1,
diagnostics_port=8787,
memory_limit=None,
**dask_kwarg,
):
return (n_workers, threads_per_worker, diagnostics_port, memory_limit)
class MockClient:
def __init__(self, cluster):
self.cluster = c... | 510 | 20.291667 | 82 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/mock_ds.py | from datetime import datetime
import numpy as np
import pandas as pd
from woodwork.logical_types import (
URL,
Boolean,
Categorical,
CountryCode,
Datetime,
Double,
EmailAddress,
Filepath,
Integer,
IPAddress,
LatLong,
NaturalLanguage,
Ordinal,
PersonFullName,
... | 47,055 | 61.741333 | 2,445 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/es_utils.py | import pandas as pd
from featuretools.utils.gen_utils import import_or_none, is_instance
dd = import_or_none("dask.dataframe")
ps = import_or_none("pyspark.pandas")
def to_pandas(df, index=None, sort_index=False, int_index=False):
"""
Testing util to convert dataframes to pandas. If a pandas dataframe is pa... | 1,532 | 30.285714 | 115 | py |
featuretools | featuretools-main/featuretools/tests/testing_utils/__init__.py | # flake8: noqa
from featuretools.tests.testing_utils.cluster import (
MockClient,
mock_cluster,
get_mock_client_cluster,
)
from featuretools.tests.testing_utils.es_utils import get_df_tags, to_pandas
from featuretools.tests.testing_utils.features import (
feature_with_name,
number_of_features_with_n... | 482 | 27.411765 | 77 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/test_primitives.py | from featuretools.tests.entry_point_tests.utils import (
_import_featuretools,
_install_featuretools_primitives,
_python,
_uninstall_featuretools_primitives,
)
def test_entry_point():
_install_featuretools_primitives()
featuretools_log = _import_featuretools("debug").stdout.decode()
new_pr... | 1,104 | 45.041667 | 125 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/utils.py | import os
import subprocess
import sys
def _get_path_to_add_ons(*args):
pwd = os.path.dirname(__file__)
return os.path.join(pwd, "add-ons", *args)
def _python(*args):
command = [sys.executable, *args]
return subprocess.run(command, stdout=subprocess.PIPE)
def _install_featuretools_plugin():
os... | 1,040 | 23.785714 | 77 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/test_plugin.py | from featuretools.tests.entry_point_tests.utils import (
_import_featuretools,
_install_featuretools_plugin,
_uninstall_featuretools_plugin,
)
def test_plugin_warning():
_install_featuretools_plugin()
warning = _import_featuretools("warning").stdout.decode()
debug = _import_featuretools("debug... | 671 | 28.217391 | 84 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/setup.py | from setuptools import find_packages, setup
setup(
name="featuretools_primitives",
packages=find_packages(),
entry_points={
"featuretools_primitives": [
"new = featuretools_primitives.new_primitive",
"invalid = featuretools_primitives.invalid_primitive",
"existin... | 389 | 26.857143 | 68 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/featuretools_primitives/invalid_primitive.py | raise NotImplementedError("invalid primitive")
| 47 | 23 | 46 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/featuretools_primitives/existing_primitive.py | from featuretools.primitives.base import AggregationPrimitive
class Sum(AggregationPrimitive):
"""A primitive that should currently exist for testing."""
pass
| 170 | 20.375 | 62 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/featuretools_primitives/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_primitives/featuretools_primitives/new_primitive.py | from featuretools.primitives.base import TransformPrimitive
class NewPrimitive(TransformPrimitive):
"""A primitive that should not currently exist for testing."""
pass
| 179 | 21.5 | 66 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_plugin/setup.py | from setuptools import setup
setup(
name="featuretools_plugin",
packages=["featuretools_plugin"],
entry_points={
"featuretools_plugin": [
"module = featuretools_plugin",
],
},
)
| 223 | 17.666667 | 43 | py |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_plugin/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entry_point_tests/add-ons/featuretools_plugin/featuretools_plugin/__init__.py | raise NotImplementedError("plugin not implemented")
| 52 | 25.5 | 51 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_timedelta.py | import pandas as pd
import pytest
from dateutil.relativedelta import relativedelta
from featuretools.entityset import Timedelta
from featuretools.feature_base import Feature
from featuretools.primitives import Count
from featuretools.tests.testing_utils import to_pandas
from featuretools.utils.wrangle import _check_ti... | 7,711 | 32.241379 | 86 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_plotting.py | import os
import re
import graphviz
import pandas as pd
import pytest
from featuretools import EntitySet
from featuretools.utils.gen_utils import Library
@pytest.fixture
def pd_simple():
es = EntitySet("test")
df = pd.DataFrame({"foo": [1]})
es.add_dataframe(df, dataframe_name="test")
return es
@p... | 2,404 | 23.793814 | 86 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_last_time_index.py | from datetime import datetime
import pandas as pd
import pytest
from woodwork.logical_types import Categorical, Datetime, Integer
from featuretools.entityset.entityset import LTI_COLUMN_NAME
from featuretools.tests.testing_utils import to_pandas
from featuretools.utils.gen_utils import Library, import_or_none
dd = i... | 17,328 | 36.266667 | 90 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_dask_es.py | import pandas as pd
import pytest
from woodwork.logical_types import (
Categorical,
Datetime,
Double,
Integer,
NaturalLanguage,
)
from featuretools.entityset import EntitySet
from featuretools.tests.testing_utils import get_df_tags
from featuretools.utils.gen_utils import Library, import_or_none
d... | 6,622 | 29.948598 | 105 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_es.py | import copy
import logging
import pickle
import re
from datetime import datetime
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from woodwork.logical_types import (
URL,
Boolean,
Categorical,
CountryCode,
Datetime,
Double,
EmailAddress,
Integer,
... | 82,748 | 31.61687 | 179 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_es_metadata.py | import pandas as pd
import pytest
from featuretools import EntitySet
from featuretools.tests.testing_utils import backward_path, forward_path
def test_cannot_re_add_relationships_that_already_exists(es):
before_len = len(es.relationships)
es.add_relationship(relationship=es.relationships[0])
after_len = ... | 8,550 | 33.902041 | 86 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_relationship.py | from featuretools.entityset.relationship import Relationship, RelationshipPath
def test_relationship_path(es):
log_to_sessions = Relationship(es, "sessions", "id", "log", "session_id")
sessions_to_customers = Relationship(
es,
"customers",
"id",
"sessions",
"customer_id... | 3,214 | 30.831683 | 88 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_spark_es.py | import pandas as pd
import pytest
from woodwork.logical_types import Datetime, Double, Integer, NaturalLanguage
from featuretools.entityset import EntitySet
from featuretools.tests.testing_utils import get_df_tags
from featuretools.utils.gen_utils import Library, import_or_none
from featuretools.utils.spark_utils impo... | 6,736 | 30.481308 | 105 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_serialization.py | import json
import logging
import os
import tempfile
from unittest.mock import patch
from urllib.request import urlretrieve
import boto3
import pandas as pd
import pytest
import woodwork.type_sys.type_system as ww_type_system
from woodwork.logical_types import Datetime, LogicalType, Ordinal
from woodwork.serializers.s... | 16,578 | 33.611691 | 104 | py |
featuretools | featuretools-main/featuretools/tests/entityset_tests/test_ww_es.py | from datetime import datetime
import numpy as np
import pandas as pd
import pytest
from woodwork.exceptions import TypeConversionError
from woodwork.logical_types import (
Boolean,
Categorical,
Datetime,
Double,
Integer,
NaturalLanguage,
)
from featuretools.entityset.entityset import LTI_COLUM... | 34,935 | 31.498605 | 163 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_identity_features.py | from featuretools import IdentityFeature
from featuretools.primitives.utils import PrimitivesDeserializer
def test_relationship_path(es):
value = IdentityFeature(es["log"].ww["value"])
assert len(value.relationship_path) == 0
def test_serialization(es):
value = IdentityFeature(es["log"].ww["value"])
... | 616 | 22.730769 | 64 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_primitive_base.py | from datetime import datetime
import numpy as np
import pandas as pd
from pytest import raises
from featuretools.primitives import Haversine, IsIn, IsNull, Max, TimeSinceLast
from featuretools.primitives.base import TransformPrimitive
def test_call_agg():
primitive = Max()
# the assert is run twice on purp... | 2,873 | 25.127273 | 79 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_feature_base.py | import os.path
import re
import pytest
from pympler.asizeof import asizeof
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Datetime, Integer
from featuretools import Feature, config, feature_base
from featuretools.feature_base import IdentityFeature
from featuretools.primitives impo... | 19,917 | 31.177706 | 109 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_overrides.py | from featuretools import Feature, calculate_feature_matrix
from featuretools.primitives import (
AddNumeric,
AddNumericScalar,
Count,
DivideByFeature,
DivideNumeric,
DivideNumericScalar,
Equal,
EqualScalar,
GreaterThan,
GreaterThanEqualTo,
GreaterThanEqualToScalar,
Greate... | 6,106 | 22.579151 | 83 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_transform_features.py | from inspect import isclass
import numpy as np
import pandas as pd
import pytest
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import (
Boolean,
BooleanNullable,
Categorical,
Datetime,
Double,
Integer,
IntegerNullable,
)
from featuretools import (
Aggregat... | 55,375 | 29.594475 | 109 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_rolling_primitive_utils.py | from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from featuretools.primitives import (
RollingCount,
RollingMax,
RollingMean,
RollingMin,
RollingSTD,
RollingTrend,
)
from featuretools.primitives.standard.transform.time_series.utils import (
_get_rolled_s... | 21,912 | 31.70597 | 116 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_dask_primitives.py | import pandas as pd
import pytest
from featuretools import calculate_feature_matrix, dfs, list_primitives
from featuretools.feature_base.cache import feature_cache
from featuretools.primitives import get_aggregation_primitives, get_transform_primitives
from featuretools.tests.testing_utils import to_pandas
from featur... | 4,094 | 32.292683 | 96 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_direct_features.py | import numpy as np
import pandas as pd
import pytest
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Datetime
from featuretools.computational_backends.feature_set import FeatureSet
from featuretools.computational_backends.feature_set_calculator import (
FeatureSetCalculator,
)
fr... | 10,446 | 33.823333 | 87 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/utils.py | from inspect import signature
import pytest
from featuretools import (
FeatureBase,
calculate_feature_matrix,
dfs,
encode_features,
list_primitives,
load_features,
save_features,
)
from featuretools.primitives.base import AggregationPrimitive, PrimitiveBase
from featuretools.tests.testing_... | 6,621 | 31.62069 | 107 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_feature_serialization.py | import os
import boto3
import pandas as pd
import pytest
from pympler.asizeof import asizeof
from smart_open import open
from woodwork.column_schema import ColumnSchema
from featuretools import (
AggregationFeature,
DirectFeature,
EntitySet,
Feature,
GroupByTransformFeature,
IdentityFeature,
... | 18,248 | 32.794444 | 106 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_groupby_transform_primitives.py | import numpy as np
import pandas as pd
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Datetime
from featuretools import (
Feature,
GroupByTransformFeature,
IdentityFeature,
calculate_feature_matrix,
feature_base,
)
from featuretools.computational_backends.feature... | 19,205 | 29.198113 | 85 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_feature_visualizer.py | import json
import os
import re
import graphviz
import pytest
from featuretools.feature_base import (
AggregationFeature,
DirectFeature,
FeatureOutputSlice,
GroupByTransformFeature,
IdentityFeature,
TransformFeature,
graph_feature,
)
from featuretools.primitives import Count, CumMax, Mode,... | 14,927 | 31.311688 | 88 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_feature_utils.py | from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Double, Integer
from featuretools.feature_base.utils import is_valid_input
def test_is_valid_input():
assert is_valid_input(candidate=ColumnSchema(), template=ColumnSchema())
assert is_valid_input(
candidate=ColumnSch... | 2,058 | 29.731343 | 80 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_feature_descriptions.py | import json
import os
import pytest
from woodwork.column_schema import ColumnSchema
from featuretools import describe_feature
from featuretools.feature_base import (
AggregationFeature,
DirectFeature,
GroupByTransformFeature,
IdentityFeature,
TransformFeature,
)
from featuretools.primitives import... | 12,017 | 34.982036 | 145 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_features_deserializer.py | import logging
from unittest.mock import patch
import pandas as pd
import pytest
from featuretools import (
AggregationFeature,
Feature,
IdentityFeature,
TransformFeature,
__version__,
)
from featuretools.feature_base.features_deserializer import FeaturesDeserializer
from featuretools.primitives i... | 13,583 | 33.920308 | 87 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_features_serializer.py | import pandas as pd
from featuretools import (
AggregationFeature,
Feature,
IdentityFeature,
TransformFeature,
__version__,
)
from featuretools.entityset.deserialize import description_to_entityset
from featuretools.feature_base.features_serializer import FeaturesSerializer
from featuretools.primit... | 9,315 | 31.573427 | 85 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/__init__.py | 0 | 0 | 0 | py | |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_agg_feats.py | from datetime import datetime
from inspect import isclass
from math import isnan
import numpy as np
import pandas as pd
import pytest
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Datetime
from featuretools import (
AggregationFeature,
Feature,
IdentityFeature,
Tim... | 26,399 | 30.768953 | 89 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_absolute_diff.py | import numpy as np
import pandas as pd
import pytest
from featuretools.primitives import AbsoluteDiff
class TestAbsoluteDiff:
def test_nan(self):
data = pd.Series([np.nan, 5, 10, 20, np.nan, 10, np.nan])
answer = pd.Series([np.nan, np.nan, 5, 10, 0, 10, 0])
primitive_func = AbsoluteDiff()... | 2,345 | 37.459016 | 79 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_primitive_utils.py | import os
import pytest
from featuretools import list_primitives, summarize_primitives
from featuretools.primitives import (
AddNumericScalar,
Age,
Count,
Day,
Diff,
GreaterThan,
Haversine,
IsFreeEmailDomain,
IsNull,
Last,
Max,
Mean,
Min,
Mode,
Month,
Mu... | 10,206 | 29.930303 | 128 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/test_all_primitive_docstrings.py | from featuretools.primitives import get_aggregation_primitives, get_transform_primitives
def docstring_is_uniform(primitive):
docstring = primitive.__doc__
valid_verbs = [
"Calculates",
"Determines",
"Transforms",
"Computes",
"Counts",
"Negates",
"Adds",... | 850 | 24.029412 | 88 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_upper_case_count.py | import numpy as np
import pandas as pd
from featuretools.primitives import UpperCaseCount
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestUpperCaseCount(PrimitiveTestBase):
primitive = UpperCaseCount
def test_strings(se... | 1,118 | 31.911765 | 83 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_number_of_mentions.py | import numpy as np
import pandas as pd
from featuretools.primitives import NumberOfMentions
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumberOfMentions(PrimitiveTestBase):
primitive = NumberOfMentions
def test_regu... | 2,367 | 28.974684 | 75 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_num_unique_separators.py | import numpy as np
import pandas as pd
from featuretools.primitives import NumUniqueSeparators
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumUniqueSeparators(PrimitiveTestBase):
primitive = NumUniqueSeparators
def ... | 2,012 | 33.706897 | 85 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_number_of_hashtags.py | import numpy as np
import pandas as pd
from featuretools.primitives import NumberOfHashtags
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumberOfHashtags(PrimitiveTestBase):
primitive = NumberOfHashtags
def test_regu... | 2,323 | 29.181818 | 75 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_title_word_count.py | import numpy as np
import pandas as pd
from featuretools.primitives import TitleWordCount
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestTitleWordCount(PrimitiveTestBase):
primitive = TitleWordCount
def test_strings(se... | 1,213 | 30.128205 | 75 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_num_characters.py | import numpy as np
import pandas as pd
from featuretools.primitives import NumCharacters
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumCharacters(PrimitiveTestBase):
primitive = NumCharacters
def test_general(self)... | 1,918 | 31.525424 | 75 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_number_of_common_words.py | import numpy as np
import pandas as pd
from featuretools.primitives import NumberOfCommonWords
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumberOfCommonWords(PrimitiveTestBase):
primitive = NumberOfCommonWords
test_... | 2,075 | 31.952381 | 79 | py |
featuretools | featuretools-main/featuretools/tests/primitive_tests/natural_language_primitives_tests/test_number_of_words_in_quotes.py | import numpy as np
import pandas as pd
import pytest
from featuretools.primitives import NumberOfWordsInQuotes
from featuretools.tests.primitive_tests.utils import (
PrimitiveTestBase,
find_applicable_primitives,
valid_dfs,
)
class TestNumberOfWordsInQuotes(PrimitiveTestBase):
primitive = NumberOfWor... | 3,956 | 36.685714 | 323 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.