id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
402
import argparse import speakeasy import logging def get_logger(): """ Get the default logger for speakeasy """ logger = logging.getLogger('emu_exe') if not logger.handlers: sh = logging.StreamHandler() logger.addHandler(sh) logger.setLevel(logging.INFO) return logger The...
API hook that is installed to intercept MessageBox calls as an example Args: api_name: The full name including module of the hooked API func: the real emulated function provided by the framework Users can call this by passing in "params" whenever they choose params: the argments passed to the function
403
import argparse import speakeasy import logging def get_logger(): """ Get the default logger for speakeasy """ logger = logging.getLogger('emu_dll') if not logger.handlers: sh = logging.StreamHandler() logger.addHandler(sh) logger.setLevel(logging.INFO) return logger The...
API hook that is installed to intercept MessageBox calls as an example Args: api_name: The full name including module of the hooked API func: the real emulated function provided by the framework Users can call this by passing in "params" whenever they choose params: the argments passed to the function
404
import argparse import speakeasy import logging def get_logger(): """ Get the default logger for speakeasy """ logger = logging.getLogger('emu_dll') if not logger.handlers: sh = logging.StreamHandler() logger.addHandler(sh) logger.setLevel(logging.INFO) return logger The...
Hook that is called whenever memory is written to Args: access: memory access requested address: Memory address that is being written to size: Size of the data being written value: data that is being written to "address"
405
import pathlib import re import typing as t from functools import lru_cache import setuptools VERSION_FILE = DEEPCHECKS_DIR / "VERSION" def is_correct_version_string(value: str) -> bool: def get_version_string() -> str: if not (VERSION_FILE.exists() and VERSION_FILE.is_file()): raise RuntimeError( ...
null
406
import pathlib import re import typing as t from functools import lru_cache import setuptools DESCRIPTION_FILE = DEEPCHECKS_DIR / "DESCRIPTION.rst" def get_description() -> t.Tuple[str, str]: if not (DESCRIPTION_FILE.exists() and DESCRIPTION_FILE.is_file()): raise RuntimeError( "DESCRIPTION.rst...
null
407
import pathlib import re import typing as t from functools import lru_cache import setuptools DEEPCHECKS_DIR = SETUP_MODULE.parent def read_requirements_file(path): dependencies = [] dependencies_links = [] for line in path.open("r").readlines(): if "-f" in line or "--find-links" in line: ...
null
408
from deepchecks.tabular.checks import DatasetsSizeComparison import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.suites import train_test_validation import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.checks import DatasetsSizeComparison from deepchecks.core...
null
409
from deepchecks.tabular.checks import DatasetsSizeComparison import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.suites import train_test_validation import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.checks import DatasetsSizeComparison from deepchecks.core...
null
410
import warnings import pandas as pd from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from deepchecks.tabular import Dataset from deepchecks.tabular.checks import CalibrationScore from deepchecks.tabular.datasets.classificatio...
null
411
import warnings import pandas as pd from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from deepchecks.tabular import Dataset from deepchecks.tabular.checks import RocReport def custom_formatwarning(msg, *args, **kwargs): ...
null
412
import numpy as np import pandas as pd from deepchecks.tabular.datasets.classification import adult def insert_new_values_types(col: pd.Series, ratio_to_replace: float, values_list): col = col.to_numpy().astype(object) indices_to_replace = np.random.choice(range(len(col)), int(len(col) * ratio_to_replace), repl...
null
413
import numpy as np import pandas as pd from deepchecks.tabular.datasets.classification import adult def insert_new_values_types(col: pd.Series, ratio_to_replace: float, values_list): col = col.to_numpy().astype(object) indices_to_replace = np.random.choice(range(len(col)), int(len(col) * ratio_to_replace), repl...
null
414
import numpy as np import pandas as pd from deepchecks.tabular.datasets.classification import adult def insert_new_values_types(col: pd.Series, ratio_to_replace: float, values_list): from deepchecks.tabular import Dataset from deepchecks.tabular.checks import MixedDataTypes def insert_number_types(col: pd.Series, rati...
null
415
from deepchecks.vision.checks import PredictionDrift from deepchecks.vision.datasets.classification.mnist_torch import load_dataset from deepchecks.vision.checks import ClassPerformance import numpy as np import torch np.random.seed(42) from deepchecks.vision.datasets.detection.coco_torch import load_dataset def gener...
null
416
from deepchecks.tabular import datasets import pandas as pd from deepchecks.tabular import Dataset from deepchecks.tabular.suites import data_integrity from deepchecks.tabular.checks import IsSingleValue, DataDuplicates def add_dirty_data(df): # change strings df.loc[df[df['type'] == 'organic'].sample(frac=0.1...
null
417
import functools import inspect import os import pathlib import sys import typing as t import re from subprocess import check_output import plotly.io as pio from plotly.io._sg_scraper import plotly_sg_scraper import deepchecks from deepchecks import vision from deepchecks.utils.strings import to_snake_case os.environ['...
null
418
import functools import inspect import os import pathlib import sys import typing as t import re from subprocess import check_output import plotly.io as pio from plotly.io._sg_scraper import plotly_sg_scraper import deepchecks from deepchecks import vision from deepchecks.utils.strings import to_snake_case os.environ['...
null
419
import functools import inspect import os import pathlib import sys import typing as t import re from subprocess import check_output import plotly.io as pio from plotly.io._sg_scraper import plotly_sg_scraper import deepchecks from deepchecks import vision from deepchecks.utils.strings import to_snake_case os.environ['...
null
420
import functools import inspect import os import pathlib import sys import typing as t import re from subprocess import check_output import plotly.io as pio from plotly.io._sg_scraper import plotly_sg_scraper import deepchecks from deepchecks import vision from deepchecks.utils.strings import to_snake_case def get_chec...
null
421
from deepchecks.vision.datasets.segmentation.segmentation_coco import CocoSegmentationDataset, load_model model = load_model(pretrained=True) import torch import torchvision.transforms.functional as F from deepchecks.vision.vision_data import BatchOutputFormat from torch.utils.data import DataLoader from deepchecks.vis...
Return a batch of images, labels and predictions for a batch of data. The expected format is a dictionary with the following keys: 'images', 'labels' and 'predictions', each value is in the deepchecks format for the task. You can also use the BatchOutputFormat class to create the output.
422
import os import numpy as np import torch from torch.utils.data import DataLoader, Dataset import albumentations as A from albumentations.pytorch import ToTensorV2 from PIL import Image import xml.etree.ElementTree as ET import urllib.request import zipfile from functools import partial from torch import nn import torc...
Return a batch of images, labels and predictions in the deepchecks format.
423
import os import urllib.request import zipfile import albumentations as A import numpy as np import PIL.Image import torch import torchvision from albumentations.pytorch import ToTensorV2 from torch import nn from torch.utils.data import DataLoader device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")...
Return a batch of images, labels and predictions for a batch of data. The expected format is a dictionary with the following keys: 'images', 'labels' and 'predictions', each value is in the deepchecks format for the task. You can also use the BatchOutputFormat class to create the output.
424
import typing as t import numpy as np from deepchecks.core.check_result import CheckResult from deepchecks.core.checks import DatasetKind from deepchecks.core.condition import ConditionCategory from deepchecks.vision.base_checks import TrainTestCheck from deepchecks.vision.context import Context from deepchecks.vision....
Initialize the color averages dicts.
425
import typing as t import numpy as np from deepchecks.core.check_result import CheckResult from deepchecks.core.checks import DatasetKind from deepchecks.core.condition import ConditionCategory from deepchecks.vision.base_checks import TrainTestCheck from deepchecks.vision.context import Context from deepchecks.vision....
Initialize the pixel counts dicts.
426
import typing as t import numpy as np from deepchecks.core.check_result import CheckResult from deepchecks.core.checks import DatasetKind from deepchecks.core.condition import ConditionCategory from deepchecks.vision.base_checks import TrainTestCheck from deepchecks.vision.context import Context from deepchecks.vision....
Sum the values of all the pixels in the batch, returning a numpy array with an entry per channel.
427
import typing as t import numpy as np from deepchecks.core.check_result import CheckResult from deepchecks.core.checks import DatasetKind from deepchecks.core.condition import ConditionCategory from deepchecks.vision.base_checks import TrainTestCheck from deepchecks.vision.context import Context from deepchecks.vision....
Count the pixels in the batch.
428
import contextlib import os import typing as t from pathlib import Path import albumentations as A import matplotlib.pyplot as plt import numpy as np import torch import torchvision.transforms.functional as F from albumentations.pytorch.transforms import ToTensorV2 from PIL import Image, ImageDraw from torch.utils.data...
Return a batch of images, labels and predictions for a batch of data. The expected format is a dictionary with the following keys: 'images', 'labels' and 'predictions', each value is in the deepchecks format for the task. You can also use the BatchOutputFormat class to create the output.
429
import contextlib import os import typing as t from pathlib import Path import albumentations as A import matplotlib.pyplot as plt import numpy as np import torch import torchvision.transforms.functional as F from albumentations.pytorch.transforms import ToTensorV2 from PIL import Image, ImageDraw from torch.utils.data...
Return a list containing the number of detections per sample in batch.
430
from datetime import datetime import joblib import pandas as pd from airflow.decorators import dag, task, short_circuit_task from airflow.providers.amazon.aws.hooks.s3 import S3Hook def model_training_dag(): @short_circuit_task def validate_data(**context): from deepchecks.tabular.suites import data_i...
null
431
from datetime import datetime, timedelta import os from airflow import DAG from airflow.operators.python import PythonOperator import joblib import pandas as pd from deepchecks.tabular.datasets.classification import adult dir_path = "suite_results" data_path = os.path.join(os.getcwd(), "data") def load_adult_dataset(*...
null
432
from datetime import datetime, timedelta import os from airflow import DAG from airflow.operators.python import PythonOperator import joblib import pandas as pd from deepchecks.tabular.datasets.classification import adult data_path = os.path.join(os.getcwd(), "data") def load_fitted_model(pretrained=True): """Load...
null
433
from datetime import datetime, timedelta import os from airflow import DAG from airflow.operators.python import PythonOperator import joblib import pandas as pd from deepchecks.tabular.datasets.classification import adult dir_path = "suite_results" _target = 'income' _CAT_FEATURES = ['workclass', 'education', 'marital...
null
434
from datetime import datetime, timedelta import os from airflow import DAG from airflow.operators.python import PythonOperator import joblib import pandas as pd from deepchecks.tabular.datasets.classification import adult dir_path = "suite_results" _target = 'income' _CAT_FEATURES = ['workclass', 'education', 'marital...
null
435
import torch from transformers import DetrForObjectDetection from typing import Union, List, Iterable import numpy as np from deepchecks.vision import VisionData import torchvision.transforms as T class COCODETRData: """Class for loading the COCO dataset meant for the DETR ResNet50 model`. Implement the necessa...
Generates a collate function that converts the batch to the deepchecks format, using the given model.
436
import inspect from typing import Callable from deepchecks.core import DatasetKind from deepchecks.core.errors import DeepchecksBaseError from deepchecks.tabular import Context, SingleDatasetCheck, checks from deepchecks.tabular.datasets.classification import lending_club from deepchecks.tabular.datasets.regression imp...
null
437
import inspect from typing import Callable from deepchecks.core import DatasetKind from deepchecks.core.errors import DeepchecksBaseError from deepchecks.tabular import Context, SingleDatasetCheck, checks from deepchecks.tabular.datasets.classification import lending_club from deepchecks.tabular.datasets.regression imp...
null
438
import inspect from typing import Callable from deepchecks.core import DatasetKind from deepchecks.core.errors import DeepchecksBaseError from deepchecks.tabular import Context, SingleDatasetCheck, checks from deepchecks.tabular.datasets.classification import lending_club from deepchecks.tabular.datasets.regression imp...
null
439
from typing import Callable import torch from deepchecks.core.errors import DeepchecksBaseError from deepchecks.vision import SingleDatasetCheck, TrainTestCheck from deepchecks.vision.datasets.classification import mnist_torch as mnist from deepchecks.vision.datasets.detection import coco_torch as coco from deepchecks....
null
440
from typing import Callable import torch from deepchecks.core.errors import DeepchecksBaseError from deepchecks.vision import SingleDatasetCheck, TrainTestCheck from deepchecks.vision.datasets.classification import mnist_torch as mnist from deepchecks.vision.datasets.detection import coco_torch as coco from deepchecks....
null
441
from typing import Callable import torch from deepchecks.core.errors import DeepchecksBaseError from deepchecks.vision import SingleDatasetCheck, TrainTestCheck from deepchecks.vision.datasets.classification import mnist_torch as mnist from deepchecks.vision.datasets.detection import coco_torch as coco from deepchecks....
null
442
import warnings import numpy as np import pandas as pd from pandas.api.types import (is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype) from sklearn import preprocessing, tree from sklearn.metrics import f...
In case of MAE, calculates the baseline score for y and derives the PPS.
443
import warnings import numpy as np import pandas as pd from pandas.api.types import (is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype) from sklearn import preprocessing, tree from sklearn.metrics import f...
In case of F1, calculates the baseline score for y and derives the PPS.
444
import warnings import numpy as np import pandas as pd from pandas.api.types import (is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype) from sklearn import preprocessing, tree from sklearn.metrics import f...
Calculate the Predictive Power Score (PPS) matrix for all columns in the dataframe. Args: df : pandas.DataFrame The dataframe that contains the data output: str - potential values: "df", "list" Control the type of the output. Either return a pandas.DataFrame (df) or a list with the score dicts sorted: bool Whether or n...
445
from deepchecks.nlp import Suite from deepchecks.nlp.checks import (ConflictingLabels, FrequentSubstrings, LabelDrift, MetadataSegmentsPerformance, PredictionDrift, PropertyDrift, PropertyLabelCorrelation, PropertySegmentsPerformance, SpecialCharacte...
Create a suite that includes many of the implemented checks, for a quick overview of your model and data.
446
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Validate tokenized text format.
447
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Validate text format.
448
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Validate and process label to accepted formats.
449
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Validate length of numpy array and type.
450
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Validate length of data table and calculate column types.
451
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
Compare two dataframes and return a difference.
452
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
null
453
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
null
454
import collections from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Type, cast import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksValueError, ValidationError from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.utils.log...
null
455
import typing as t from collections.abc import Sequence from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score from seqeval.scheme import Token from sklearn.metrics import make_scorer from deepchecks.core.errors import DeepchecksValueError def get_scorer_dict( suffix: bool = False, ...
Validate the given scorer list.
456
import typing as t from collections.abc import Sequence from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score from seqeval.scheme import Token from sklearn.metrics import make_scorer from deepchecks.core.errors import DeepchecksValueError DEFAULT_AVG_SCORER_NAMES = ('f1_macro', 'recall_mac...
Return the default scorers for token classification.
457
import typing as t import numpy as np from deepchecks.nlp.task_type import TaskType from deepchecks.nlp.text_data import TextData from deepchecks.tabular.metric_utils import DeepcheckScorer from deepchecks.tabular.metric_utils.scorers import _transform_to_multi_label_format from deepchecks.utils.metrics import is_label...
Initialize scorers and return all of them as deepchecks scorers. Parameters ---------- scorers : Mapping[str, Union[str, Callable]] dict of scorers names to scorer sklearn_name/function or a list without a name model_classes : t.Optional[t.List] possible classes output for model. None for regression tasks. observed_cla...
458
import typing as t import numpy as np from deepchecks.nlp.task_type import TaskType from deepchecks.nlp.text_data import TextData from deepchecks.tabular.metric_utils import DeepcheckScorer from deepchecks.tabular.metric_utils.scorers import _transform_to_multi_label_format from deepchecks.utils.metrics import is_label...
Infer using DeepcheckScorer on NLP TextData using an NLP context _DummyModel.
459
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data def load_all_data() -> t.Dict[str, t.Dict[str, t.Any]]: """Load a dict of all the text data, labels and predictions. One...
Load and return a precalculated predictions for the dataset. Returns ------- predictions : Tuple[List[str], List[str]] The IOB predictions of the tokens in the train and test datasets.
460
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data def load_all_data() -> t.Dict[str, t.Dict[str, t.Any]]: """Load a dict of all the text data, labels and predictions. One...
Load and returns the SCIERC Abstract NER dataset (token classification). Parameters ---------- data_format : str, default: 'TextData' Represent the format of the returned value. Can be 'TextData'|'Dict' 'TextData' will return the data as a TextData object 'Dict' will return the data as a dict of tokenized texts and IOB...
461
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data _PREDICTIONS_URL = 'https://ndownloader.figshare.com/files/39264461' ASSETS_DIR = pathlib.Path(__file__).absolute().parent.p...
Load and return a precalculated predictions for the dataset. Parameters ---------- pred_format : str, default: 'predictions' Represent the format of the returned value. Can be 'predictions' or 'probabilities'. 'predictions' will return the predicted class for each sample. 'probabilities' will return the predicted proba...
462
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data def load_data(data_format: str = 'TextData', as_train_test: bool = True, include_properties: bool = True, incl...
Load and return the test data, modified to have under annotated segment.
463
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data _SHORT_PROBAS_URL = 'https://figshare.com/ndownloader/files/40578866' ASSETS_DIR = pathlib.Path(__file__).absolute().parent....
Load and return a precalculated predictions for the dataset. Parameters ---------- pred_format : str, default: 'predictions' Represent the format of the returned value. Can be 'predictions' or 'probabilities'. 'predictions' will return the predicted class for each sample. 'probabilities' will return the predicted proba...
464
import pathlib import typing as t import warnings import numpy as np import pandas as pd from deepchecks.nlp import TextData from deepchecks.utils.builtin_datasets_utils import read_and_save_data _FULL_DATA_URL = 'https://figshare.com/ndownloader/files/40564895' _SHORT_DATA_URL = 'https://figshare.com/ndownloader/files...
Load and returns the Just Dance Comment Analysis dataset (multi-label classification). Parameters ---------- data_format : str, default: 'TextData' Represent the format of the returned value. Can be 'TextData'|'DataFrame' 'TextData' will return the data as a TextData object 'Dataframe' will return the data as a pandas ...
465
import contextlib import pathlib import typing as t import warnings from numbers import Number import numpy as np import pandas as pd from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError from deepchecks.nlp.input_validations import (ColumnTypes, validate_length_and_calculate_column_types...
Disable deepchecks root logger.
466
import warnings from typing import Hashable, List, Optional, Union import numpy as np from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksProcessError from deepchecks.nlp import TextData from deepchecks.utils.dataframes import select_from_dataframe def _warn_n_top_columns(data_type: str, n_top_fea...
Get relevant data table from the database.
467
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return text length.
468
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return average word length.
469
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return percentage of special characters (as float between 0 and 1).
470
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return percentage of punctuation (as float between 0 and 1).
471
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return max word length.
472
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return whether text is in English or not.
473
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return float representing subjectivity.
474
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return float representing toxicity.
475
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return float representing fluency.
476
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return float representing formality.
477
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return a float representing lexical density. Lexical density is the percentage of unique words in a given text. For more information: https://en.wikipedia.org/wiki/Lexical_density
478
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of unique noun words in the text.
479
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return a float representing the Flesch Reading-Ease score per text sample. In the Flesch reading-ease test, higher scores indicate material that is easier to read whereas lower numbers mark texts that are more difficult to read. For more information: https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_test...
480
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the average words per sentence in the text.
481
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of unique URLS in the text.
482
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of URLS in the text.
483
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of unique email addresses in the text.
484
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of email addresses in the text.
485
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of unique syllables in the text.
486
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return an integer representing time in seconds to read the text. The formula is based on Demberg & Keller, 2008 where it is assumed that reading a character taken 14.69 milliseconds on average.
487
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return the number of sentences in the text.
488
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Return a the average number of syllables per sentences per text sample.
489
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Calculate properties on provided text samples. Parameters ---------- raw_text : Sequence[str] The text to calculate the properties for. include_properties : List[str], default None The properties to calculate. If None, all default properties will be calculated. Cannot be used together with ignore_properties parameter. ...
490
import pathlib import pickle as pkl import re import string import warnings from collections import defaultdict from importlib.util import find_spec from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import numpy as np import pandas as pd import textblob import torch.cuda from nltk import co...
Get the names of all the available builtin properties. Returns ------- Dict[str, str] A dictionary with the property name as key and the property's type as value.
491
from typing import List, Sequence import numpy as np import pandas as pd import plotly.express as px import plotly.graph_objs as go from deepchecks.nlp import TextData from deepchecks.nlp.task_type import TaskType from deepchecks.nlp.utils.text import break_to_lines_and_trim from deepchecks.nlp.utils.text_properties im...
Create a distribution / bar graph of the data and its outliers. Parameters ---------- dist : Sequence The distribution of the data. data : Sequence[str] The data (used to give samples of it in hover). lower_limit : float The lower limit of the common part of the data (under it is an outlier). upper_limit : float The up...
492
from typing import List, Sequence from tqdm import tqdm The provided code snippet includes necessary dependencies for implementing the `call_open_ai_completion_api` function. Write a Python function `def call_open_ai_completion_api(inputs: Sequence[str], max_tokens=200, batch_size=20, # api limit of 20 requests ...
Call the open ai completion api with the given inputs batch by batch. Parameters ---------- inputs : Sequence[str] The inputs to send to the api. max_tokens : int, default 200 The maximum number of tokens to return for each input. batch_size : int, default 20 The number of inputs to send in each batch. model : str, def...
493
import re import sys import warnings from itertools import islice from typing import Optional import numpy as np from tqdm import tqdm EMBEDDING_MODEL = 'text-embedding-ada-002' EMBEDDING_DIM = 1536 EMBEDDING_CTX_LENGTH = 8191 EMBEDDING_ENCODING = 'cl100k_base' def encode_text(text, encoding_name): """Encode tokens...
Get the built-in embeddings for the dataset. Parameters ---------- text : np.array The text to get embeddings for. model : str, default 'miniLM' The type of embeddings to return. Can be either 'miniLM' or 'open_ai'. For 'open_ai' option, the model used is 'text-embedding-ada-002' and requires to first set an open ai ap...
494
import re import string import typing as t import unicodedata import warnings import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize def normalize_text( text_sample: str, *, ignore_case: bool = True, remove_punct: bool = True, normalize_uni: bool = True, remove_sto...
Normalize given sequence of text samples.
495
import re import string import typing as t import unicodedata import warnings import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize def hash_text(text: str) -> int: """Hash a text sample.""" assert isinstance(text, str) return hash(text) from typing import List The provided...
Hash a sequence of text samples.
496
from typing import List, Optional import numpy as np import pandas as pd import plotly.graph_objs as go from plotly.subplots import make_subplots from deepchecks.nlp.task_type import TaskType, TTextLabel from deepchecks.nlp.utils.text import break_to_lines_and_trim from deepchecks.nlp.utils.text_properties import TEXT_...
Return a plotly figure instance. Parameters ---------- properties: pd.DataFrame The DataFrame consisting of the text properties data. If no prooperties are there, you can pass an empty DataFrame as well. n_samples: int The total number of samples present in the TextData object. max_num_labels_to_show : int The threshol...
497
import warnings from typing import List, Tuple import numpy as np import pandas as pd from seqeval.metrics.sequence_labeling import get_entities from sklearn.base import BaseEstimator from deepchecks.core.errors import DeepchecksValueError from deepchecks.nlp.task_type import TaskType class DeepchecksValueError(Deepch...
Infer the observed labels from the given datasets and predictions. Parameters ---------- train_dataset : Union[TextData, None], default None TextData object, representing data an estimator was fitted on test_dataset : Union[TextData, None], default None TextData object, representing data an estimator predicts on model ...
498
import warnings import numpy as np import pandas as pd from numba import NumbaDeprecationWarning from sklearn.decomposition import PCA from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import roc_auc_score from sklearn.model_selection import train_test_split from deepchecks.core.check_utils.m...
Calculate multivariable drift on embeddings.
499
import io import traceback from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union, cast import jsonpickle import jsonpickle.ext.pandas as jsonpickle_pd import pandas as pd from ipywidgets import Widget from pandas.io.formats.style import Styler from plotly.basedatatypes import BaseFigure from deep...
null
500
import abc import io import json import pathlib import warnings from collections import OrderedDict from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, cast import jsonpickle from bs4 import BeautifulSoup from ipywidgets import Widget from typing_extensions import Self, TypedDict from deepc...
Sort sequence of 'CheckResult' instances. Returns ------- List[check_types.CheckResult]
501
import typing as t import numpy as np import pandas as pd from deepchecks.core import ConditionResult from deepchecks.core.condition import ConditionCategory from deepchecks.core.errors import DeepchecksValueError from deepchecks.utils.dict_funcs import get_dict_entry_by_value from deepchecks.utils.strings import forma...
Add condition - test metric scores are greater than the threshold. Parameters ---------- min_score : float Minimum score to pass the check. Returns ------- Callable the condition function