id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
502 | 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 performance is not degraded by more than given percentage in train. Parameters ---------- threshold : float maximum degradation ratio allowed (value between 0 and 1) Returns ------- Callable the condition function |
503 | 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 - relative ratio difference between highest-class and lowest-class is less than threshold. Parameters ---------- threshold : float ratio difference threshold score : str limit score for condition Returns ------- Callable the condition function |
504 | import warnings
from typing import Container, List, Tuple
import pandas as pd
import plotly.graph_objects as go
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OrdinalEncoder
from... | Calculate multivariable drift. |
505 | from typing import Optional, Tuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import deepchecks.ppscore as pps
from deepchecks.utils.plot import DEFAULT_DATASET_NAMES, colors
from deepchecks.utils.strings import format_percent
from deepchecks.utils.typing import Hashable
colors = {DEFAULT... | Create bar plotly bar trace out of pandas Series, with difference shown in percentages. |
506 | from typing import Optional, Tuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import deepchecks.ppscore as pps
from deepchecks.utils.plot import DEFAULT_DATASET_NAMES, colors
from deepchecks.utils.strings import format_percent
from deepchecks.utils.typing import Hashable
def get_pps_figure... | Calculate the PPS for train, test and difference for feature label correlation checks. The PPS represents the ability of a feature to single-handedly predict another feature or label. This function calculates the PPS per feature for both train and test, and returns the data and display graph. Uses the ppscore package -... |
507 | from typing import Optional, Tuple
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import deepchecks.ppscore as pps
from deepchecks.utils.plot import DEFAULT_DATASET_NAMES, colors
from deepchecks.utils.strings import format_percent
from deepchecks.utils.typing import Hashable
def get_pps_figure... | Calculate the PPS for train, test and difference for feature label correlation checks per class. The PPS represents the ability of a feature to single-handedly predict another feature or label. This function calculates the PPS per feature for both train and test, and returns the data and display graph. Uses the ppscore... |
508 | import abc
import html
import io
import pathlib
import sys
import typing as t
from multiprocessing import get_context, process
from tempfile import NamedTemporaryFile
from IPython.core.display import display, display_html
from ipywidgets import Widget
from deepchecks.core.serialization.abc import HTMLFormatter, HtmlSer... | Display suite result or check result in a new python gui window. |
509 | import abc
import html
import io
import pathlib
import sys
import typing as t
from multiprocessing import get_context, process
from tempfile import NamedTemporaryFile
from IPython.core.display import display, display_html
from ipywidgets import Widget
from deepchecks.core.serialization.abc import HTMLFormatter, HtmlSer... | Return html iframe tag. |
510 | import textwrap
import typing as t
from plotly.basedatatypes import BaseFigure
from plotly.io import to_html
from typing_extensions import Literal
from deepchecks.core import check_result as check_types
from deepchecks.core.resources import requirejs_script
from deepchecks.core.serialization.abc import ABCDisplayItemsH... | Verify CheckResultSection sequence. |
511 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Form unique output anchor. |
512 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Add additional style classes to the widget. |
513 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Prettify data. |
514 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Take an object and return a JSON-safe representation of it. Parameters ---------- value : object value to normilize Returns ------- Any of the basic builtin datatypes |
515 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Return the conditions table as DataFrame. Parameters ---------- check_results : Union['CheckResult', Sequence['CheckResult']] check results to show conditions of. max_info_len : int max length of the additional info. include_icon : bool , default: True if to show the html condition result icon or the enum include_check... |
516 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Create dataframe with check results. Parameters ---------- results : Sequence['CheckResult'] check results output_id : str unique identifier of the output, it will be used to form a link (html '<a></a>' tag) to the check result full output is_for_iframe_with_srcdoc : bool, default False anchor links, in order to work w... |
517 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Create dataframe with check failures. Parameters ---------- failures : Sequence[Union[CheckFailure, CheckResult]] check failures Returns ------- pd.Dataframe: the condition table. |
518 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Return plotly activation script in the requirejs enviroment. Parameters ---------- connected : bool, default True Returns ------- str |
519 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Return all active matplot figures. |
520 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Switch matplot backend. |
521 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Concatenate a list of images vertically. Parameters ---------- images : List[PIL.Image.Image] list of images gap : int, default 10 gap between images Returns ------- PIL.Image.Image |
522 | import io
import json
import textwrap
import typing as t
from contextlib import contextmanager
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.io._html as plotlyhtml
from ipywidgets import DOMWidget
from jsonpickle.pickler import Pickler
from pandas.io.formats.styl... | Construct an iterator from list and put 'item' between each element of the list. |
523 | import typing as t
import warnings
from ipywidgets import HTML, Accordion, VBox, Widget
from deepchecks.core import check_result as check_types
from deepchecks.core import suite
from deepchecks.core.serialization.abc import WidgetSerializer
from deepchecks.core.serialization.check_failure.widget import CheckFailureSeri... | null |
524 | import re
import sys
import xml.etree.ElementTree as ET
from datetime import datetime
from typing import Dict, List, Union
from six import u
from deepchecks.core import check_result as check_types
from deepchecks.core import suite
from deepchecks.core.serialization.abc import JunitSerializer
from deepchecks.core.serial... | Remove any illegal unicode characters from the given XML string. @see: http://stackoverflow.com/questions/1707890/fast-way-to-filter-illegal-xml-unicode-chars-in-python |
525 | import importlib
import typing as t
from typing_extensions import Literal as L
from deepchecks import __version__
from deepchecks.utils.logger import get_logger
The provided code snippet includes necessary dependencies for implementing the `importable_name` function. Write a Python function `def importable_name(obj: t... | Return the full import name of an object type. |
526 | import importlib
import typing as t
from typing_extensions import Literal as L
from deepchecks import __version__
from deepchecks.utils.logger import get_logger
The provided code snippet includes necessary dependencies for implementing the `import_type` function. Write a Python function `def import_type( module_na... | Import and return type instance by name. |
527 | import importlib
import typing as t
from typing_extensions import Literal as L
from deepchecks import __version__
from deepchecks.utils.logger import get_logger
VersionUnmatchAction = t.Union[L['raise'], L['warn'], None]
__version__ = version('deepchecks')
def get_logger() -> logging.Logger:
"""Retutn the deepche... | Validate check/suite configuration dictionary. |
528 | from typing import Callable, Dict, List, Union
from deepchecks.tabular import Suite
from deepchecks.tabular.checks import (BoostingOverfit, CalibrationScore, ConflictingLabels, ConfusionMatrixReport,
DataDuplicates, DatasetsSizeComparison, DateTrainTestLeakageDuplicates,
... | Suite for testing the model in production. The suite contains checks for evaluating the model's performance. Checks for detecting drift and checks for data integrity issues that may occur in production. List of Checks (exact checks depend on the task type and the is_comparative flag): .. list-table:: List of Checks :wi... |
529 | from typing import Callable, Dict, List, Union
from deepchecks.tabular import Suite
from deepchecks.tabular.checks import (BoostingOverfit, CalibrationScore, ConflictingLabels, ConfusionMatrixReport,
DataDuplicates, DatasetsSizeComparison, DateTrainTestLeakageDuplicates,
... | Create a suite that includes many of the implemented checks, for a quick overview of your model and data. |
530 | import typing as t
import pandas as pd
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.tabular import Dataset
from deepchecks.tabular.metric_utils import DeepcheckScorer
from deepchecks.tabular.utils.feature_importance import _calculate_feature_importance
from deepchecks.tabular.utils.task_infer... | Get or calculate feature importance outside of check and suite. Many checks and suites in deepchecks use feature importance as part of its calculation or output. If your model does not have built-in feature importance, the check or suite will calculate it for you. This calculation is done in every call to the check or ... |
531 | import numpy as np
import pandas as pd
import plotly.graph_objects as go
from sklearn.base import TransformerMixin
from sklearn.compose import ColumnTransformer
from sklearn.decomposition import PCA
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OrdinalE... | Create a naive encoder for categorical and numerical features. The encoder handles nans for all features and uses label encoder for categorical features. Then, all features are scaled using RobustScaler. Parameters ---------- numerical_features cat_features Returns ------- TransformerMixin A transformer object |
532 | import itertools
from typing import Callable, Dict, Tuple, Union
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.checks import DatasetKind
from deepchecks.c... | Create combination of parameter values. Create a dataframe with one column for each named argument and rows corresponding to all possible combinations of the given arguments. |
533 | import itertools
from typing import Callable, Dict, Tuple, Union
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.checks import DatasetKind
from deepchecks.c... | Combine segment filters. Parameters ---------- filters: Series Series indexed by segment names and with values corresponding to segment filters to be applied to the data. dataframe: DataFrame DataFrame to which filters are applied. Returns ------- DataFrame Data filtered to the given combination of segments. |
534 | import itertools
from typing import Callable, Dict, Tuple, Union
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.checks import DatasetKind
from deepchecks.c... | Check whether a given scorer provides an average score or a score for each class. |
535 | from typing import Dict, List
import numpy as np
import plotly.graph_objects as go
import sklearn
from deepchecks.core import CheckResult, ConditionResult
from deepchecks.core.condition import ConditionCategory
from deepchecks.core.errors import DeepchecksNotSupportedError
from deepchecks.tabular import Context, Single... | null |
536 | import warnings
from collections import defaultdict
from numbers import Number
from typing import TYPE_CHECKING, Callable, Dict, Hashable, List, Mapping, Union
import numpy as np
import pandas as pd
import plotly.express as px
from sklearn.dummy import DummyClassifier, DummyRegressor
from sklearn.pipeline import Pipeli... | null |
537 | from copy import deepcopy
from typing import TYPE_CHECKING, Callable, Tuple, Union
import numpy as np
import plotly.graph_objects as go
from sklearn.pipeline import Pipeline
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.errors import DeepchecksValueError, ModelValidati... | null |
538 | from copy import deepcopy
from typing import TYPE_CHECKING, Callable, Tuple, Union
import numpy as np
import plotly.graph_objects as go
from sklearn.pipeline import Pipeline
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.errors import DeepchecksValueError, ModelValidati... | Calculate steps (integers between 1 to num_estimators) to work on. |
539 | from collections import defaultdict
from typing import List, Union
import pandas as pd
from pandas.api.types import infer_dtype
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.tabular import Context, SingleDatasetCheck
from deepchecks.tabular.utils.feature_importance import N... | null |
540 | from typing import Dict, List, Tuple, Union
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
from scipy import stats
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.tabular import Context, SingleDatasetCheck
from deepchecks.tabular.utils.feature_imp... | Get outlier ranges on histogram. Parameters ---------- percentile_histogram : Dict[float, float] histogram to search for outliers in shape [0.0-100.0]->[float] iqr_percent : float , default: 85 Interquartile range upper percentage, start searching for outliers outside IQR. outlier_factor : float , default: 5 a factor t... |
541 | from typing import Dict, List, Tuple, Union
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
from scipy import stats
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.tabular import Context, SingleDatasetCheck
from deepchecks.tabular.utils.feature_imp... | null |
542 | from typing import Dict, List, Tuple, Union
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
from scipy import stats
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.tabular import Context, SingleDatasetCheck
from deepchecks.tabular.utils.feature_imp... | null |
543 | import itertools
from collections import defaultdict
from typing import Dict, List, Optional, Union
import pandas as pd
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.reduce_classes import ReduceFeatureMixin
from deepchecks.tabular import Context, SingleDatasetCheck
fro... | null |
544 | import time
from typing import List, Union
import numpy as np
from PyNomaly import loop
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.errors import (DeepchecksProcessError, DeepchecksTimeoutError, DeepchecksValueError,
NotEnoughSampl... | null |
545 | import math
from typing import Dict, Iterable, List, Optional, Union
import numpy as np
import pandas as pd
from pandas.api.types import is_categorical_dtype
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.core.reduce_cl... | null |
546 | import typing as t
import warnings
from collections import Counter
import numpy as np
import pandas as pd
from IPython.display import HTML, display_html
from pandas.api.types import infer_dtype
from sklearn.model_selection import train_test_split
from typing_extensions import Literal as L
from deepchecks.core.errors im... | Return link to documentation for Dataset class. |
547 | from typing import Union
import numpy as np
from sklearn.metrics import confusion_matrix, roc_auc_score
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.utils.metrics import averaging_mechanism
def assert_multi_label_shape(y):
if not isinstance(y, np.ndarray):
raise DeepchecksValueErr... | Receive a metric which calculates false positive rate. The rate is calculated as: False Positives / (False Positives + True Negatives) Parameters ---------- y_true : array-like of shape (n_samples, n_classes) or (n_samples) for binary The labels should be passed in a sequence of sequences, with the sequence for each sa... |
548 | from typing import Union
import numpy as np
from sklearn.metrics import confusion_matrix, roc_auc_score
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.utils.metrics import averaging_mechanism
def assert_multi_label_shape(y):
if not isinstance(y, np.ndarray):
raise DeepchecksValueErr... | Receive a metric which calculates false negative rate. The rate is calculated as: False Negatives / (False Negatives + True Positives) Parameters ---------- y_true : array-like of shape (n_samples, n_classes) or (n_samples) for binary The labels should be passed in a sequence of sequences, with the sequence for each sa... |
549 | from typing import Union
import numpy as np
from sklearn.metrics import confusion_matrix, roc_auc_score
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.utils.metrics import averaging_mechanism
def assert_multi_label_shape(y):
if not isinstance(y, np.ndarray):
raise DeepchecksValueErr... | Receive a metric which calculates true negative rate. Alternative name to the same metric is specificity. The rate is calculated as: True Negatives / (True Negatives + False Positives) Parameters ---------- y_true : array-like of shape (n_samples, n_classes) or (n_samples) for binary The labels should be passed in a se... |
550 | from typing import Union
import numpy as np
from sklearn.metrics import confusion_matrix, roc_auc_score
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.utils.metrics import averaging_mechanism
def assert_multi_label_shape(y):
if not isinstance(y, np.ndarray):
raise DeepchecksValueErr... | Receives predictions and true labels and returns the ROC AUC score for each class. Parameters ---------- y_true : array-like of shape (n_samples, n_classes) The labels should be passed in a sequence of sequences, with the sequence for each sample being a binary vector, representing the presence of the i-th label in tha... |
551 | import logging
import typing as t
import warnings
from numbers import Number
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from packaging import version
from sklearn import __version__ as scikit_version
from sklearn.base import ClassifierMixin
from sklearn.metrics import get_scorer, log_loss, ... | Validate that the number of classes (columns) in probabilities matches the model_classes. |
552 | import typing as t
from urllib.request import urlopen
import joblib
import pandas as pd
import sklearn
from sklearn.ensemble import AdaBoostClassifier
from deepchecks.tabular.dataset import Dataset
_MODEL_URL = 'https://figshare.com/ndownloader/files/35122759'
_MODEL_VERSION = '1.0.2'
def load_data(data_format: str = '... | Load and return a fitted classification model to predict the flower type in the iris dataset. Returns ------- model : Joblib The model/pipeline that was trained on the iris dataset. |
553 | import typing as t
from urllib.request import urlopen
import joblib
import pandas as pd
import sklearn
from category_encoders import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.ensemble import RandomForestClassifier
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipel... | Load and return a fitted regression model to predict the target in the phishing dataset. Returns ------- model : Joblib the model/pipeline that was trained on the phishing dataset. |
554 | import typing as t
from urllib.request import urlopen
import joblib
import pandas as pd
import sklearn
from category_encoders import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.ensemble import RandomForestClassifier
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipel... | Return a data processor object for the phishing URL dataset. |
555 | import typing as t
from urllib.request import urlopen
import joblib
import pandas as pd
import sklearn
from sklearn.ensemble import RandomForestClassifier
from deepchecks.tabular.dataset import Dataset
_MODEL_URL = 'https://figshare.com/ndownloader/files/35122762'
_MODEL_VERSION = '1.0.2'
def load_data(data_format: str... | Load and return a fitted classification model to predict the flower type in the iris dataset. Returns ------- model : Joblib the model/pipeline that was trained on the iris dataset. |
556 | import typing as t
from urllib.request import urlopen
import joblib
import pandas as pd
import sklearn
from category_encoders import OneHotEncoder
from sklearn.compose import ColumnTransformer
from sklearn.ensemble import RandomForestRegressor
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeli... | Load and return a fitted regression model to predict the quality in the Wine Quality dataset. Returns ------- model : Joblib the model/pipeline that was trained on the Wine Quality dataset. |
557 | import math
import time
import typing as t
import numpy as np
import pandas as pd
from deepchecks.tabular.dataset import Dataset
_TRAIN_DATA_URL = ('https://raw.githubusercontent.com/deepchecks/deepchecks-datasets/'
'8dd24134239b9df5d2a3a13cdce38cc22caaaaf4/airbnb_ref_data.csv')
_TEST_DATA_URL = ('ht... | Load and returns the Airbnb NYC 2019 dataset (regression). Parameters ---------- data_format : str , default: Dataset Represent the format of the returned value. Can be 'Dataset'|'Dataframe' 'Dataset' will return the data as a Dataset object 'Dataframe' will return the data as a pandas Dataframe object load_train : boo... |
558 | import math
import time
import typing as t
import numpy as np
import pandas as pd
from deepchecks.tabular.dataset import Dataset
The provided code snippet includes necessary dependencies for implementing the `load_pre_calculated_feature_importance` function. Write a Python function `def load_pre_calculated_feature_imp... | Load the pre-calculated feature importance for the Airbnb NYC 2019 dataset. Returns ------- feature_importance : pd.Series The feature importance for a model trained on the Airbnb NYC 2019 dataset. |
559 | import time
import typing as t
import warnings
import numpy as np
import pandas as pd
from sklearn.inspection import permutation_importance
from sklearn.pipeline import Pipeline
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.tabu... | Return the dict of columns sorted and limited by feature importance. Parameters ---------- cols_dict : t.Dict[Hashable, t.Any] dict where columns are the keys dataset : tabular.Dataset dataset used to fit the model feature_importances : t.Optional[pd.Series] , default: None feature importance normalized to 0-1 indexed ... |
560 | import time
import typing as t
import warnings
import numpy as np
import pandas as pd
from sklearn.inspection import permutation_importance
from sklearn.pipeline import Pipeline
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.tabu... | Return the dataframe of columns sorted and limited by feature importance. Parameters ---------- df : pd.DataFrame DataFrame to sort ds : tabular.Dataset dataset used to fit the model feature_importances : pd.Series feature importance normalized to 0-1 indexed by feature names n_top : int , default: 10 amount of columns... |
561 | import time
import typing as t
import warnings
import numpy as np
import pandas as pd
from sklearn.inspection import permutation_importance
from sklearn.pipeline import Pipeline
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.tabu... | Validate feature importance. |
562 | import typing as t
import numpy as np
import pandas as pd
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.utils.typing import BasicModel
supported_models_html = f'<a href="{supported_models_link}" target="_blank">supported model types</a>'
from typing import List
class BasicMode... | Receive any object and check if it's an instance of a model we support. Parameters ---------- model: t.Any Raises ------ DeepchecksValueError If the object is not of a supported type |
563 | import typing as t
import numpy as np
import pandas as pd
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.utils.typing import BasicModel
from typing import List
The provided code snippet includes necessary dependencies for implementing the `ensure_dataframe_type` function. Write a Py... | Ensure that given object is of type DataFrame or Dataset and return it as DataFrame. else raise error. Parameters ---------- obj : t.Any Object to ensure it is DataFrame or Dataset Returns ------- pd.DataFrame |
564 | import typing as t
import numpy as np
import pandas as pd
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.utils.typing import BasicModel
from typing import List
The provided code snippet includes necessary dependencies for implementing the `ensure_predictions_shape` function. Write a... | Ensure the predictions are in the right shape and if so return them. else raise error. |
565 | import typing as t
import numpy as np
import pandas as pd
from deepchecks import tabular
from deepchecks.core import errors
from deepchecks.utils.typing import BasicModel
from typing import List
The provided code snippet includes necessary dependencies for implementing the `ensure_predictions_proba` function. Write a... | Ensure the predictions are in the right shape and if so return them. else raise error. |
566 | import http.client
import os
import pathlib
import uuid
import deepchecks
from deepchecks.utils.logger import get_logger
MODULE_DIR = pathlib.Path(__file__).absolute().parent.parent
ANALYTICS_DISABLED = os.environ.get('DISABLE_DEEPCHECKS_ANONYMOUS_TELEMETRY', False) or \
os.environ.get('DISABLE_LATEST_VERSION_CHECK... | Check if we are on the latest version and send an anonymous import event to PostHog. |
567 | from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from deepchecks.vision import Suite
from deepchecks.vision.checks import (ClassPerformance, ConfusionMatrixReport, # SimilarImageLeakage,
HeatmapComparison, ImageDatasetDrift, ImagePropertyDrift, ImagePropertyOut... | Create a suite that includes many of the implemented checks, for a quick overview of your model and data. Parameters ---------- n_samples : Optional[int] , default : 5000 Number of samples to use for the checks in the suite. If None, all samples will be used. image_properties : List[Dict[str, Any]], default: None List ... |
568 | from collections import defaultdict
from typing import List
import numpy as np
def compute_bounding_box_class_ious(detected: np.ndarray, ground_truth: np.ndarray):
"""Compute ious between bounding boxes of the same class."""
bb_info = group_class_detection_label(detected, ground_truth)
# Calculating pairwis... | Calculate mean iou for a single sample. |
569 | from typing import Tuple
import numpy as np
The provided code snippet includes necessary dependencies for implementing the `segmentation_counts_per_class` function. Write a Python function `def segmentation_counts_per_class(y_true_onehot: np.ndarray, y_pred_onehot: np.ndarray)` to solve the following problem:
Compute ... | Compute the ground truth, predicted and intersection areas per class for segmentation metrics. |
570 | import warnings
from collections import defaultdict
from typing import List, Optional, Tuple, Union
import numpy as np
from ignite.metrics import Metric
from ignite.metrics.metric import reinit__is_reduced, sync_all_reduce
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.vision.metrics_utils.metr... | null |
571 | import numpy as np
The provided code snippet includes necessary dependencies for implementing the `_calc_recall` function. Write a Python function `def _calc_recall(tp: float, fp: float, fn: float) -> float` to solve the following problem:
Calculate recall for given matches and number of positives.
Here is the functi... | Calculate recall for given matches and number of positives. |
572 | import numpy as np
The provided code snippet includes necessary dependencies for implementing the `_calc_precision` function. Write a Python function `def _calc_precision(tp: float, fp: float, fn: float) -> float` to solve the following problem:
Calculate precision for given matches and number of positives.
Here is t... | Calculate precision for given matches and number of positives. |
573 | import numpy as np
The provided code snippet includes necessary dependencies for implementing the `_calc_f1` function. Write a Python function `def _calc_f1(tp: float, fp: float, fn: float) -> float` to solve the following problem:
Calculate F1 for given matches and number of positives.
Here is the function:
def _ca... | Calculate F1 for given matches and number of positives. |
574 | import numpy as np
The provided code snippet includes necessary dependencies for implementing the `_calc_fpr` function. Write a Python function `def _calc_fpr(tp: float, fp: float, fn: float) -> float` to solve the following problem:
Calculate FPR for given matches and number of positives.
Here is the function:
def ... | Calculate FPR for given matches and number of positives. |
575 | import numpy as np
The provided code snippet includes necessary dependencies for implementing the `_calc_fnr` function. Write a Python function `def _calc_fnr(tp: float, fp: float, fn: float) -> float` to solve the following problem:
Calculate FNR for given matches and number of positives.
Here is the function:
def ... | Calculate FNR for given matches and number of positives. |
576 | from collections import defaultdict
from typing import Tuple
import numpy as np
import torch
from ignite.metrics import Metric
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.vision.metrics_utils.semantic_segmentation_metric_utils import (format_segmentation_masks,
... | Calculate Dice score per sample. |
577 | import typing as t
from copy import copy
from numbers import Number
import numpy as np
import pandas as pd
import torch
from ignite.metrics import Metric
from deepchecks.core import DatasetKind
from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError
from deepchecks.utils.metrics import get_... | Get scorers list according to model object and label column. Parameters ---------- dataset : VisionData Dataset object alternative_scorers: Union[Dict[str, Union[Callable, str]], List[Any]] , default: None Scorers to override the default scorers (metrics), find more about the supported formats at https://docs.deepcheck... |
578 | import typing as t
from copy import copy
from numbers import Number
import numpy as np
import pandas as pd
import torch
from ignite.metrics import Metric
from deepchecks.core import DatasetKind
from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError
from deepchecks.utils.metrics import get_... | Get dict of metric name to tensor of classes scores, and convert it to dataframe. |
579 | import typing as t
from copy import copy
from numbers import Number
import numpy as np
import pandas as pd
import torch
from ignite.metrics import Metric
from deepchecks.core import DatasetKind
from deepchecks.core.errors import DeepchecksNotSupportedError, DeepchecksValueError
from deepchecks.utils.metrics import get_... | Filter the metrics dataframe for display purposes. Parameters ---------- metrics_df : pd.DataFrame Dataframe containing the metrics. n_to_show : int Number of classes to show in the report. show_only : str Specify which classes to show in the report. Can be one of the following: - 'largest': Show the largest classes. -... |
580 | import typing as t
from collections import defaultdict
from queue import PriorityQueue
import numpy as np
import pandas as pd
from deepchecks.core import CheckResult, DatasetKind
from deepchecks.utils.abstracts.confusion_matrix_abstract import create_confusion_matrix_figure
from deepchecks.vision._shared_docs import do... | null |
581 | from typing import Any, Callable, Dict, Hashable, List, Optional, Union
import numpy as np
import pandas as pd
import plotly.express as px
from deepchecks.core import CheckResult, ConditionCategory, ConditionResult, DatasetKind
from deepchecks.core.errors import DeepchecksValueError
from deepchecks.utils import plot
fr... | null |
582 | import string
import typing as t
import warnings
from abc import abstractmethod
from collections import defaultdict
from numbers import Number
from secrets import choice
import numpy as np
import pandas as pd
from deepchecks.core import CheckResult, DatasetKind
from deepchecks.core.errors import DeepchecksProcessError,... | Validate the result of the property. |
583 | import string
import typing as t
import warnings
from abc import abstractmethod
from collections import defaultdict
from numbers import Number
from secrets import choice
import numpy as np
import pandas as pd
from deepchecks.core import CheckResult, DatasetKind
from deepchecks.core.errors import DeepchecksProcessError,... | null |
584 | import random
import sys
import typing as t
from collections import Counter
from enum import Enum
from numbers import Number
import numpy as np
from typing_extensions import NotRequired, TypedDict
from deepchecks.core.errors import DatasetValidationError
from deepchecks.utils.logger import get_logger
def is_torch_objec... | Reshuffle the batch loader. |
585 | import random
import sys
import typing as t
from collections import Counter
from enum import Enum
from numbers import Number
import numpy as np
from typing_extensions import NotRequired, TypedDict
from deepchecks.core.errors import DatasetValidationError
from deepchecks.utils.logger import get_logger
class TaskType(Enu... | Return the number of images containing each class_id. Returns ------- Dict[int, int] A dictionary mapping each class_id to the number of images containing it. |
586 | import random
import sys
import typing as t
from collections import Counter
from enum import Enum
from numbers import Number
import numpy as np
from typing_extensions import NotRequired, TypedDict
from deepchecks.core.errors import DatasetValidationError
from deepchecks.utils.logger import get_logger
class TaskType(Enu... | Return the number of images containing each class_id. Returns ------- Dict[int, int] A dictionary mapping each class_id to the number of images containing it. |
587 | import random
import sys
import typing as t
from collections import Counter
from enum import Enum
from numbers import Number
import numpy as np
from typing_extensions import NotRequired, TypedDict
from deepchecks.core.errors import DatasetValidationError
from deepchecks.utils.logger import get_logger
The provided code... | Set seeds for reproducibility. Parameters ---------- seed : int Seed to be set |
588 | import random
import sys
import typing as t
from collections import Counter
from enum import Enum
from numbers import Number
import numpy as np
from typing_extensions import NotRequired, TypedDict
from deepchecks.core.errors import DatasetValidationError
from deepchecks.utils.logger import get_logger
class DatasetVali... | Validate that two vision datasets are compatible. Raises: DeepchecksValueError: if the datasets are not compatible |
589 | import typing as t
from pathlib import Path
import cv2
import numpy as np
import torch
from torch.utils.data import DataLoader
from typing_extensions import Literal
from deepchecks.vision.vision_data import VisionData
class SimpleClassificationDataset(VisionDataset):
"""Simple VisionDataset type for the classificat... | Load a simple classification dataset. The function expects that the data within the root folder to be structured one of the following ways: - root/ - class1/ image1.jpeg - root/ - train/ - class1/ image1.jpeg - test/ - class1/ image1.jpeg Parameters ---------- root : str path to the data batch_size : int, default: 32 B... |
590 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
class ValidationError(DeepchecksBaseError):
"""Represent... | Validate that the data is in the required format. Parameters ---------- images The images of the batch. Result of VisionData's batch_to_images Raises ------ DeepchecksValueError If the images doesn't fit the required deepchecks format. |
591 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
def _validate_predictions_label_common_format(name, data, tas... | Validate that the labels are in the required format based on task_type. Parameters ---------- labels The labels of the batch. Result of VisionData's batch_to_labels task_type: TaskType The task type of the model Raises ------ DeepchecksValueError If the labels doesn't fit the required deepchecks format. |
592 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
def _validate_predictions_label_common_format(name, data, tas... | Validate that the predictions are in the required format based on task_type. Parameters ---------- predictions The predictions of the batch. Result of VisionData's batch_to_predictions task_type: TaskType The task type of the model Raises ------ DeepchecksValueError If the predictions doesn't fit the required deepcheck... |
593 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
class ValidationError(DeepchecksBaseError):
"""Represent... | Validate that the data is in the required format. Parameters ---------- additional_data_batch The additional data of the batch. Result of VisionData's batch_to_additional_data Raises ------ DeepchecksValueError If the images doesn't fit the required deepchecks format. |
594 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
class ValidationError(DeepchecksBaseError):
"""Represent... | Validate that the data is in the required format. Parameters ---------- embeddings The embeddings of the batch. Result of VisionData's batch_to_embeddings Raises ------ DeepchecksValueError If the images doesn't fit the required deepchecks format. |
595 | from numbers import Number
from typing import Iterable
import numpy as np
from deepchecks.core.errors import ValidationError
from deepchecks.vision.vision_data import TaskType
from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
class ValidationError(DeepchecksBaseError):
"""Represent... | Validate that the data is in the required format. Parameters ---------- image_identifiers The image identifiers of the batch. Result of VisionData's batch_to_image_identifiers Raises ------ DeepchecksValueError If the images doesn't fit the required deepchecks format. |
596 | import contextlib
import os
import pathlib
import typing as t
from pathlib import Path
import albumentations as A
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 import nn
from torch.utils.... | Get the COCO128 dataset and return a dataloader. Parameters ---------- train : bool, default: True if `True` train dataset, otherwise test dataset batch_size : int, default: 32 Batch size for the dataloader. num_workers : int, default: 0 Number of workers for the dataloader. shuffle : bool, default: True Whether to shu... |
597 | import logging
import typing as t
import warnings
import zipfile
from io import BytesIO
from pathlib import Path
from urllib.request import urlopen
import albumentations as A
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader
from typing_extensions import Literal
from deepchec... | Collate function for the coco dataset returning images and labels in correct format as tuple. |
598 | import contextlib
import hashlib
import json
import os
import pathlib
import typing as t
import urllib.request
from pathlib import Path
import numpy as np
import torch
from bs4 import BeautifulSoup
from PIL import Image
from torch import nn
from torch.utils.data import DataLoader
from typing_extensions import Literal
f... | Get the mask dataset and return a dataloader. Parameters ---------- day_index : int, default: 0 Select the index of the day that should be loaded. 0 is the training set, and each subsequent number is a subsequent day in the production dataset. Last day index is 59. batch_size : int, default: 32 Batch size for the datal... |
599 | import contextlib
import hashlib
import json
import os
import pathlib
import typing as t
import urllib.request
from pathlib import Path
import numpy as np
import torch
from bs4 import BeautifulSoup
from PIL import Image
from torch import nn
from torch.utils.data import DataLoader
from typing_extensions import Literal
f... | Get a list of the data timestamps, one entry per day in the production data. Returns ------- t.List[int] A list of the data timestamps. |
600 | import os
import typing as t
from pathlib import Path
import albumentations as A
import numpy as np
from typing_extensions import Literal
from deepchecks import vision
from deepchecks.vision.datasets.detection.coco_utils import COCO_DIR, LABEL_MAP, download_coco128, get_image_and_label
from deepchecks.vision.vision_dat... | Get the COCO128 dataset and return a dataloader. Parameters ---------- train : bool, default: True if `True` train dataset, otherwise test dataset shuffle : bool, default: False Whether to shuffle the dataset. object_type : Literal['Dataset', 'Dataset'], default: 'Dataset' type of the return value. If 'Dataset', :obj:`... |
601 | import logging
import os
import pathlib
import pickle
import typing as t
import warnings
from itertools import cycle
from urllib.error import URLError
import albumentations as A
import numpy as np
import torch
import torch.nn.functional as F
from albumentations.pytorch import ToTensorV2
from torch import nn
from torch.... | Collate function for the mnist dataset returning images and labels in correct format as tuple. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.