{
    "file_diffs": [
        {
            "old_file_content": "import numpy as np\n\nfrom Orange import data\n\n\ndef _get_variable(variable, dat, attr_name, expected_type=None, expected_name=\"\"):\n    failed = False\n    if isinstance(variable, data.Variable):\n        datvar = getattr(dat, \"variable\", None)\n        if datvar is not None and datvar is not variable:\n            raise ValueError(\"variable does not match the variable in the data\")\n    elif hasattr(dat, \"domain\"):\n        variable = dat.domain[variable]\n    elif hasattr(dat, attr_name):\n        variable = dat.variable\n    else:\n        failed = True\n    if failed or (expected_type is not None and not isinstance(variable, expected_type)):\n        if not expected_type or isinstance(variable, data.Variable):\n            raise ValueError(\"expected %s variable not %s\" % (expected_name, variable))\n        else:\n            raise ValueError(\"expected %s, not '%s'\" % (\n                expected_type.__name__, type(variable).__name__))\n    return variable\n\n\ndef _create_discrete(cls, *args):\n    return cls(*args)\n\n\nclass Discrete(np.ndarray):\n    def __new__(cls, dat, col_variable=None, row_variable=None,\n                row_unknowns=None, col_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            return cls.from_data(dat, col_variable, row_variable)\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self = super().__new__(cls, dat.shape)\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n\n        self.col_unknowns = np.zeros(dat.shape[0]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(dat.shape[1]) \\\n            if col_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n        self[...] = dat\n\n        return self\n\n    @classmethod\n    def from_data(cls, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\n                    \"row_variable needs to be specified (data has no class)\")\n        row_variable = _get_variable(row_variable, data, \"row_variable\")\n        col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            dist, col_unknowns, row_unknowns, unknowns = \\\n                data._compute_contingency([col_variable], row_variable)[0]\n\n            self = super().__new__(cls, dist.shape)\n            self[...] = dist\n            self.col_unknowns = col_unknowns\n            self.row_unknowns = row_unknowns\n            self.unknowns = unknowns\n        except NotImplementedError:\n            shape = len(row_variable.values), len(col_variable.values)\n            self = super().__new__(cls, shape)\n            self[...] = np.zeros(shape)\n            self.col_unknowns = np.zeros(shape[0])\n            self.row_unknowns = np.zeros(shape[1])\n            self.unknowns = 0\n            rind = data.domain.index(row_variable)\n            cind = data.domain.index(col_variable)\n            for row in data:\n                rval, cval = row[rind], row[cind]\n                w = row.weight\n                if np.isnan(rval) and np.isnan(cval):\n                    self.unknowns += w\n                elif np.isnan(rval):\n                    self.row_unknowns[int(cval)] += w\n                elif np.isnan(cval):\n                    self.col_unknowns[int(rval)] += w\n                else:\n                    self[int(rval), int(cval)] += w\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        return self\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This property returns a contingency array with unknowns arrays added\n        as a column and row.\n\n        Returns\n        -------\n        np.array\n            Array with concatenated unknowns as a row and column\n        \"\"\"\n        return np.vstack(\n            (np.hstack((np.array(self), self.col_unknowns.reshape(-1, 1))),\n             np.append(self.row_unknowns, self.unknowns)))\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self, other) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        if isinstance(index, str):\n            if len(self.shape) == 2:  # contingency\n                index = self.row_variable.to_val(index)\n                contingency_row = super().__getitem__(index)\n                contingency_row.col_variable = self.col_variable\n                return contingency_row\n            else:  # Contingency row\n                column = self.strides == self.base.strides[:1]\n                if column:\n                    index = self.row_variable.to_val(index)\n                else:\n                    index = self.col_variable.to_val(index)\n\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        result = super().__getitem__(index)\n        if isinstance(result, Discrete):\n            if not isinstance(index, tuple):\n                result.col_unknowns = self.col_unknowns[index]\n                result.row_unknowns = self.row_unknowns\n            else:\n                result.col_unknowns = self.col_unknowns[index[0]]\n                result.row_unknowns = self.col_unknowns[index[1]]\n            result.unknowns = self.unknowns\n        if result.strides:\n            result.col_variable = self.col_variable\n            result.row_variable = self.row_variable\n        return result\n\n    def __setitem__(self, index, value):\n        if isinstance(index, str):\n            index = self.row_variable.to_val(index)\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        super().__setitem__(index, value)\n\n    def normalize(self, axis=None):\n        t = np.sum(self, axis=axis)\n        if t > 1e-6:\n            self[:] /= t\n            if axis is None or axis == 1:\n                self.unknowns /= t\n\n    def __reduce__(self):\n        return (\n            _create_discrete,\n            (Discrete, np.copy(self), self.col_variable, self.row_variable,\n             self.col_unknowns, self.row_unknowns)\n        )\n\n\nclass Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1\n\n\ndef get_contingency(dat, col_variable, row_variable=None, col_unknowns=None,\n                    row_unknowns=None, unks=None):\n    variable = _get_variable(col_variable, dat, \"col_variable\")\n    if variable.is_discrete:\n        return Discrete(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns, unks)\n    elif variable.is_continuous:\n        return Continuous(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns)\n    else:\n        raise TypeError(\n            \"cannot compute distribution of '%s'\" % type(variable).__name__)\n\n\ndef get_contingencies(dat, skip_discrete=False, skip_continuous=False):\n    vars = dat.domain.attributes\n    row_var = dat.domain.class_var\n    if row_var is None:\n        raise ValueError(\"data has no target variable\")\n    if skip_discrete:\n        if skip_continuous:\n            return []\n        columns = [i for i, var in enumerate(vars) if var.is_continuous]\n    elif skip_continuous:\n        columns = [i for i, var in enumerate(vars) if var.is_discrete]\n    else:\n        columns = None\n    try:\n        dist_unks = dat._compute_contingency(columns)\n        if columns is None:\n            columns = np.arange(len(vars))\n        contigs = []\n        for col, (cont, col_unk, row_unk, unks) in zip(columns, dist_unks):\n            contigs.append(get_contingency(\n                cont, vars[col], row_var, col_unk, row_unk, unks))\n    except NotImplementedError:\n        if columns is None:\n            columns = range(len(vars))\n        contigs = [get_contingency(dat, i) for i in columns]\n    return contigs\n",
            "new_file_content": "import numpy as np\n\nfrom Orange import data\n\n\ndef _get_variable(variable, dat, attr_name, expected_type=None, expected_name=\"\"):\n    failed = False\n    if isinstance(variable, data.Variable):\n        datvar = getattr(dat, \"variable\", None)\n        if datvar is not None and datvar is not variable:\n            raise ValueError(\"variable does not match the variable in the data\")\n    elif hasattr(dat, \"domain\"):\n        variable = dat.domain[variable]\n    elif hasattr(dat, attr_name):\n        variable = dat.variable\n    else:\n        failed = True\n    if failed or (expected_type is not None and not isinstance(variable, expected_type)):\n        if not expected_type or isinstance(variable, data.Variable):\n            raise ValueError(\"expected %s variable not %s\" % (expected_name, variable))\n        else:\n            raise ValueError(\"expected %s, not '%s'\" % (\n                expected_type.__name__, type(variable).__name__))\n    return variable\n\n\ndef _create_discrete(cls, *args):\n    return cls(*args)\n\n\nclass Discrete(np.ndarray):\n    def __new__(cls, dat, col_variable=None, row_variable=None,\n                row_unknowns=None, col_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            return cls.from_data(dat, col_variable, row_variable)\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self = super().__new__(cls, dat.shape)\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n\n        self.col_unknowns = np.zeros(dat.shape[0]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(dat.shape[1]) \\\n            if col_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n        self[...] = dat\n\n        return self\n\n    @classmethod\n    def from_data(cls, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\n                    \"row_variable needs to be specified (data has no class)\")\n        row_variable = _get_variable(row_variable, data, \"row_variable\")\n        col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            dist, col_unknowns, row_unknowns, unknowns = \\\n                data._compute_contingency([col_variable], row_variable)[0]\n\n            self = super().__new__(cls, dist.shape)\n            self[...] = dist\n            self.col_unknowns = col_unknowns\n            self.row_unknowns = row_unknowns\n            self.unknowns = unknowns\n        except NotImplementedError:\n            shape = len(row_variable.values), len(col_variable.values)\n            self = super().__new__(cls, shape)\n            self[...] = np.zeros(shape)\n            self.col_unknowns = np.zeros(shape[0])\n            self.row_unknowns = np.zeros(shape[1])\n            self.unknowns = 0\n            rind = data.domain.index(row_variable)\n            cind = data.domain.index(col_variable)\n            for row in data:\n                rval, cval = row[rind], row[cind]\n                w = row.weight\n                if np.isnan(rval) and np.isnan(cval):\n                    self.unknowns += w\n                elif np.isnan(rval):\n                    self.row_unknowns[int(cval)] += w\n                elif np.isnan(cval):\n                    self.col_unknowns[int(rval)] += w\n                else:\n                    self[int(rval), int(cval)] += w\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        return self\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This property returns a contingency array with unknowns arrays added\n        as a column and row.\n\n        Returns\n        -------\n        np.array\n            Array with concatenated unknowns as a row and column\n        \"\"\"\n        return np.vstack(\n            (np.hstack((np.array(self), self.col_unknowns.reshape(-1, 1))),\n             np.append(self.row_unknowns, self.unknowns)))\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self, other) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        if isinstance(index, str):\n            if len(self.shape) == 2:  # contingency\n                index = self.row_variable.to_val(index)\n                contingency_row = super().__getitem__(index)\n                contingency_row.col_variable = self.col_variable\n                return contingency_row\n            else:  # Contingency row\n                column = self.strides == self.base.strides[:1]\n                if column:\n                    index = self.row_variable.to_val(index)\n                else:\n                    index = self.col_variable.to_val(index)\n\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        result = super().__getitem__(index)\n        if isinstance(result, Discrete):\n            if not isinstance(index, tuple):\n                result.col_unknowns = self.col_unknowns[index]\n                result.row_unknowns = self.row_unknowns\n            else:\n                result.col_unknowns = self.col_unknowns[index[0]]\n                result.row_unknowns = self.col_unknowns[index[1]]\n            result.unknowns = self.unknowns\n        if result.strides:\n            result.col_variable = self.col_variable\n            result.row_variable = self.row_variable\n        return result\n\n    def __setitem__(self, index, value):\n        if isinstance(index, str):\n            index = self.row_variable.to_val(index)\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        super().__setitem__(index, value)\n\n    def normalize(self, axis=None):\n        t = np.sum(self, axis=axis)\n        if t > 1e-6:\n            self[:] /= t\n            if axis is None or axis == 1:\n                self.unknowns /= t\n\n    def __reduce__(self):\n        return (\n            _create_discrete,\n            (Discrete, np.copy(self), self.col_variable, self.row_variable,\n             self.col_unknowns, self.row_unknowns)\n        )\n\n\nclass Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This function returns the list of all items returned by __getitem__\n        with adding a row of row_unknowns together with values.\n        \"\"\"\n        # pylint: disable=unnecessary-comprehension\n        other_rows = [x for x in self]\n        ind = self.row_unknowns > 0\n        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))\n        return other_rows + [unknown_rows]\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1\n\n\ndef get_contingency(dat, col_variable, row_variable=None, col_unknowns=None,\n                    row_unknowns=None, unks=None):\n    variable = _get_variable(col_variable, dat, \"col_variable\")\n    if variable.is_discrete:\n        return Discrete(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns, unks)\n    elif variable.is_continuous:\n        return Continuous(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns)\n    else:\n        raise TypeError(\n            \"cannot compute distribution of '%s'\" % type(variable).__name__)\n\n\ndef get_contingencies(dat, skip_discrete=False, skip_continuous=False):\n    vars = dat.domain.attributes\n    row_var = dat.domain.class_var\n    if row_var is None:\n        raise ValueError(\"data has no target variable\")\n    if skip_discrete:\n        if skip_continuous:\n            return []\n        columns = [i for i, var in enumerate(vars) if var.is_continuous]\n    elif skip_continuous:\n        columns = [i for i, var in enumerate(vars) if var.is_discrete]\n    else:\n        columns = None\n    try:\n        dist_unks = dat._compute_contingency(columns)\n        if columns is None:\n            columns = np.arange(len(vars))\n        contigs = []\n        for col, (cont, col_unk, row_unk, unks) in zip(columns, dist_unks):\n            contigs.append(get_contingency(\n                cont, vars[col], row_var, col_unk, row_unk, unks))\n    except NotImplementedError:\n        if columns is None:\n            columns = range(len(vars))\n        contigs = [get_contingency(dat, i) for i in columns]\n    return contigs\n",
            "header": {
                "file": {
                    "path": "Orange/statistics/contingency.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "9905a52eb",
                "new_commit_hash": "76135576a",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/statistics/contingency.py"
            },
            "plus_file": {
                "path": "b/Orange/statistics/contingency.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 225,
                            "length": 6
                        },
                        "new_range": {
                            "start": 225,
                            "length": 18
                        },
                        "section": "class Continuous:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                \"Fallback method for computation of contingencies is not implemented yet\"",
                                "type": "context"
                            },
                            {
                                "content": "            )",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @property",
                                "type": "added"
                            },
                            {
                                "content": "    def array_with_unknowns(self):",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "added"
                            },
                            {
                                "content": "        This function returns the list of all items returned by __getitem__",
                                "type": "added"
                            },
                            {
                                "content": "        with adding a row of row_unknowns together with values.",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "added"
                            },
                            {
                                "content": "        # pylint: disable=unnecessary-comprehension",
                                "type": "added"
                            },
                            {
                                "content": "        other_rows = [x for x in self]",
                                "type": "added"
                            },
                            {
                                "content": "        ind = self.row_unknowns > 0",
                                "type": "added"
                            },
                            {
                                "content": "        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))",
                                "type": "added"
                            },
                            {
                                "content": "        return other_rows + [unknown_rows]",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def __eq__(self, other):",
                                "type": "context"
                            },
                            {
                                "content": "        return (",
                                "type": "context"
                            },
                            {
                                "content": "            np.array_equal(self.values, other.values) and",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/statistics/contingency.py",
                            "type": "class",
                            "name": "Continuous",
                            "content": "class Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This function returns the list of all items returned by __getitem__\n        with adding a row of row_unknowns together with values.\n        \"\"\"\n        # pylint: disable=unnecessary-comprehension\n        other_rows = [x for x in self]\n        ind = self.row_unknowns > 0\n        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))\n        return other_rows + [unknown_rows]\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 186,
                            "end_lineno": 287,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/statistics/contingency.py",
                            "type": "method",
                            "name": "Continuous.array_with_unknowns",
                            "content": "class Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This function returns the list of all items returned by __getitem__\n        with adding a row of row_unknowns together with values.\n        \"\"\"\n        # pylint: disable=unnecessary-comprehension\n        other_rows = [x for x in self]\n        ind = self.row_unknowns > 0\n        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))\n        return other_rows + [unknown_rows]\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 229,
                            "end_lineno": 238,
                            "parent": {
                                "file_name": "Orange/statistics/contingency.py",
                                "type": "class",
                                "name": "Continuous",
                                "content": "class Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This function returns the list of all items returned by __getitem__\n        with adding a row of row_unknowns together with values.\n        \"\"\"\n        # pylint: disable=unnecessary-comprehension\n        other_rows = [x for x in self]\n        ind = self.row_unknowns > 0\n        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))\n        return other_rows + [unknown_rows]\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 186,
                                "end_lineno": 287,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.sparse import csr_matrix, csc_matrix\n\nfrom Orange.data import DiscreteVariable, Table, Domain\nfrom Orange.statistics import contingency\nfrom Orange import data\nfrom Orange.tests import test_filename\n\n\ndef assert_dist_equal(dist, expected):\n    np.testing.assert_array_equal(np.asarray(dist), expected)\n\n\ndef assert_dist_almost_equal(dist, expected):\n    np.testing.assert_array_almost_equal(np.asarray(dist), expected)\n\n\nclass TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.sparse import csr_matrix, csc_matrix\n\nfrom Orange.data import DiscreteVariable, Table, Domain\nfrom Orange.statistics import contingency\nfrom Orange import data\nfrom Orange.tests import test_filename\n\n\ndef assert_dist_equal(dist, expected):\n    np.testing.assert_array_equal(np.asarray(dist), expected)\n\n\ndef assert_dist_almost_equal(dist, expected):\n    np.testing.assert_array_almost_equal(np.asarray(dist), expected)\n\n\nclass TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n\n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n        arr_unknowns = cont.array_with_unknowns\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][1], correct_row_unknowns_no_zero)\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][0], correct_values_no_zero)\n\n        # check if other match to what we get with __getitem__\n        for v1, v2 in zip(arr_unknowns[:-1], cont):\n            np.testing.assert_almost_equal(v1, v2)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)\n",
            "header": {
                "file": {
                    "path": "Orange/tests/test_contingency.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "6f7ccfca2",
                "new_commit_hash": "022da6d69",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/tests/test_contingency.py"
            },
            "plus_file": {
                "path": "b/Orange/tests/test_contingency.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 165,
                            "length": 6
                        },
                        "new_range": {
                            "start": 165,
                            "length": 32
                        },
                        "section": "class TestDiscrete(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "             3., 4., 2., 1., 1., 1., 1.])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(cont.unknowns, 1)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @staticmethod",
                                "type": "added"
                            },
                            {
                                "content": "    def test_continuous_array_with_unknowns():",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "added"
                            },
                            {
                                "content": "        Test array_with_unknowns function",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "added"
                            },
                            {
                                "content": "        d = data.Table(\"iris\")",
                                "type": "added"
                            },
                            {
                                "content": "        d.Y[:50] = np.zeros(50) * float(\"nan\")",
                                "type": "added"
                            },
                            {
                                "content": "        cont = contingency.Continuous(d, \"sepal width\")",
                                "type": "added"
                            },
                            {
                                "content": "        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,",
                                "type": "added"
                            },
                            {
                                "content": "                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]",
                                "type": "added"
                            },
                            {
                                "content": "        correct_row_unknowns_no_zero = [",
                                "type": "added"
                            },
                            {
                                "content": "            c for c in correct_row_unknowns if c > 0]",
                                "type": "added"
                            },
                            {
                                "content": "        correct_values_no_zero = [",
                                "type": "added"
                            },
                            {
                                "content": "            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)",
                                "type": "added"
                            },
                            {
                                "content": "        arr_unknowns = cont.array_with_unknowns",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(",
                                "type": "added"
                            },
                            {
                                "content": "            arr_unknowns[-1][1], correct_row_unknowns_no_zero)",
                                "type": "added"
                            },
                            {
                                "content": "        np.testing.assert_almost_equal(",
                                "type": "added"
                            },
                            {
                                "content": "            arr_unknowns[-1][0], correct_values_no_zero)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # check if other match to what we get with __getitem__",
                                "type": "added"
                            },
                            {
                                "content": "        for v1, v2 in zip(arr_unknowns[:-1], cont):",
                                "type": "added"
                            },
                            {
                                "content": "            np.testing.assert_almost_equal(v1, v2)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_mixedtype_metas(self):",
                                "type": "context"
                            },
                            {
                                "content": "        import Orange",
                                "type": "context"
                            },
                            {
                                "content": "        zoo = Orange.data.Table(\"zoo\")",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/tests/test_contingency.py",
                            "type": "class",
                            "name": "TestDiscrete",
                            "content": "class TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n\n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n        arr_unknowns = cont.array_with_unknowns\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][1], correct_row_unknowns_no_zero)\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][0], correct_values_no_zero)\n\n        # check if other match to what we get with __getitem__\n        for v1, v2 in zip(arr_unknowns[:-1], cont):\n            np.testing.assert_almost_equal(v1, v2)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 25,
                            "end_lineno": 393,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/tests/test_contingency.py",
                            "type": "method",
                            "name": "TestDiscrete.test_continuous_array_with_unknowns",
                            "content": "class TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n\n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n        arr_unknowns = cont.array_with_unknowns\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][1], correct_row_unknowns_no_zero)\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][0], correct_values_no_zero)\n\n        # check if other match to what we get with __getitem__\n        for v1, v2 in zip(arr_unknowns[:-1], cont):\n            np.testing.assert_almost_equal(v1, v2)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 169,
                            "end_lineno": 192,
                            "parent": {
                                "file_name": "Orange/tests/test_contingency.py",
                                "type": "class",
                                "name": "TestDiscrete",
                                "content": "class TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n\n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n        arr_unknowns = cont.array_with_unknowns\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][1], correct_row_unknowns_no_zero)\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][0], correct_values_no_zero)\n\n        # check if other match to what we get with __getitem__\n        for v1, v2 in zip(arr_unknowns[:-1], cont):\n            np.testing.assert_almost_equal(v1, v2)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 25,
                                "end_lineno": 393,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 212,
                            "length": 7
                        },
                        "new_range": {
                            "start": 238,
                            "length": 6
                        },
                        "section": "class TestDiscrete(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        Y = np.array([[1, 2, 1, 0, 0]]).T",
                                "type": "context"
                            },
                            {
                                "content": "        return data.Table.from_numpy(domain, X, Y)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "deleted"
                            },
                            {
                                "content": "    def test_sparse(self):",
                                "type": "context"
                            },
                            {
                                "content": "        d = self._construct_sparse()",
                                "type": "context"
                            },
                            {
                                "content": "        cont = contingency.Discrete(d, 5)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/tests/test_contingency.py",
                            "type": "class",
                            "name": "TestDiscrete",
                            "content": "class TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 25,
                            "end_lineno": 368,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "b3c1e8cd77d836813c2330888b77b915a81b664d^",
    "new_commit_hash": "b3c1e8cd77d836813c2330888b77b915a81b664d",
    "commit_message": "Contingency add a property for getting all values including unknowns",
    "commit_date": "2019-12-23T16:09:00+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "b3c1e8cd77d836813c2330888b77b915a81b664d",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.sparse import csr_matrix, csc_matrix\n\nfrom Orange.data import DiscreteVariable, Table, Domain\nfrom Orange.statistics import contingency\nfrom Orange import data\nfrom Orange.tests import test_filename\n\n\ndef assert_dist_equal(dist, expected):\n    np.testing.assert_array_equal(np.asarray(dist), expected)\n\n\ndef assert_dist_almost_equal(dist, expected):\n    np.testing.assert_array_almost_equal(np.asarray(dist), expected)\n\n\nclass TestDiscrete(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.zoo = data.Table(\"zoo\")\n        cls.test9 = data.Table(test_filename(\"datasets/test9.tab\"))\n\n    def test_discrete(self):\n        cont = contingency.Discrete(self.zoo, 0)\n        assert_dist_equal(cont[\"amphibian\"], [4, 0])\n        assert_dist_equal(cont, [[4, 0], [20, 0], [13, 0],\n                                 [4, 4], [10, 0], [2, 39], [5, 0]])\n\n        cont = contingency.Discrete(self.zoo, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n\n        cont = contingency.Discrete(self.zoo, self.zoo.domain[\"predator\"])\n        assert_dist_equal(cont[\"fish\"], [4, 9])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 9], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        self.assertEqual(sum(cont.col_unknowns), 0)\n        self.assertEqual(sum(cont.row_unknowns), 0)\n\n    def test_discrete_missing(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = float(\"nan\")\n        d[0][0] = float(\"nan\")\n        cont = contingency.Discrete(d, 0)\n        assert_dist_equal(cont[\"amphibian\"], [3, 0])\n        assert_dist_equal(cont, [[3, 0], [20, 0], [13, 0], [4, 4],\n                                 [10, 0], [2, 38], [5, 0]])\n        np.testing.assert_almost_equal(cont.col_unknowns,\n                                       [0, 0, 0, 0, 0, 1, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns,\n                                       [1, 0])\n\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont[\"fish\"], [4, 8])\n        assert_dist_equal(cont, [[1, 3], [11, 9], [4, 8], [7, 1],\n                                 [2, 8], [19, 22], [1, 4]])\n        np.testing.assert_almost_equal(\n            cont.col_unknowns, [0, 0, 0, 0, 0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 0])\n        self.assertEqual(1, cont.unknowns)\n\n    def test_array_with_unknowns(self):\n        d = data.Table(\"zoo\")\n        d.Y[2] = float(\"nan\")\n        d.Y[6] = float(\"nan\")\n        d[2][\"predator\"] = float(\"nan\")\n        d[4][\"predator\"] = float(\"nan\")\n        cont = contingency.Discrete(d, \"predator\")\n        assert_dist_equal(cont.array_with_unknowns,\n                          [[1, 3, 0], [11, 9, 0], [4, 8, 0], [7, 1, 0],\n                           [2, 8, 0], [18, 21, 1], [1, 4, 0], [1, 0, 1]])\n\n    def test_discrete_with_fallback(self):\n        d = data.Table(\"zoo\")\n        d.Y[25] = None\n        d.Y[24] = None\n        d.X[0, 0] = None\n        d.X[24, 0] = None\n        default = contingency.Discrete(d, 0)\n\n        d._compute_contingency = Mock(side_effect=NotImplementedError)\n        fallback = contingency.Discrete(d, 0)\n\n        np.testing.assert_array_equal(\n            np.asarray(fallback), np.asarray(default))\n        np.testing.assert_array_equal(fallback.unknowns, default.unknowns)\n        np.testing.assert_array_equal(\n            fallback.row_unknowns, default.row_unknowns)\n        np.testing.assert_array_equal(\n            fallback.col_unknowns, default.col_unknowns)\n\n    def test_continuous(self):\n        d = data.Table(\"iris\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 6, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        self.assertEqual(cont.unknowns, 0)\n\n    def test_continuous_missing(self):\n        d = data.Table(\"iris\")\n        d[1][1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.3, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7,\n                    3.8, 3.9, 4.0, 4.1, 4.2, 4.4],\n                   [1, 1, 5, 5, 5, 2, 9, 6, 2, 3, 4, 2, 1, 1, 1, 1]]\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(cont.row_unknowns, np.zeros(23))\n        np.testing.assert_almost_equal(cont[\"Iris-setosa\"], correct)\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[0] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct = [[2.2, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.6, 3.8],\n                   [1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2]]\n        np.testing.assert_almost_equal(\n            cont[d.domain.class_var.values.index(\"Iris-virginica\")], correct)\n        np.testing.assert_almost_equal(cont.col_unknowns, [1, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 0)\n\n        d.Y[1] = float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,\n             0., 0., 0., 0., 0., 0., 0.])\n        self.assertEqual(cont.unknowns, 1)\n\n        # this one was failing before since the issue in _contingecy.pyx\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 0, 0])\n        np.testing.assert_almost_equal(\n            cont.row_unknowns,\n            [0., 0., 1., 0., 0., 0., 0., 0., 1., 5., 5., 5., 2., 9., 6., 2.,\n             3., 4., 2., 1., 1., 1., 1.])\n        self.assertEqual(cont.unknowns, 1)\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n\n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n        arr_unknowns = cont.array_with_unknowns\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][1], correct_row_unknowns_no_zero)\n        np.testing.assert_almost_equal(\n            arr_unknowns[-1][0], correct_values_no_zero)\n\n        # check if other match to what we get with __getitem__\n        for v1, v2 in zip(arr_unknowns[:-1], cont):\n            np.testing.assert_almost_equal(v1, v2)\n\n    def test_mixedtype_metas(self):\n        import Orange\n        zoo = Orange.data.Table(\"zoo\")\n        dom = Orange.data.Domain(zoo.domain.attributes, zoo.domain.class_var,\n                                 zoo.domain.metas + zoo.domain.attributes[:2])\n        t = zoo.transform(dom)\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [38, 5])\n        assert_dist_equal(cont, [[4, 54], [38, 5]])\n        zoo[25][t.domain.metas[1]] = float(\"nan\")\n        zoo[0][2] = float(\"nan\")\n        cont = contingency.get_contingency(zoo, 2, t.domain.metas[1])\n        assert_dist_equal(cont[\"1\"], [37, 5])\n        assert_dist_equal(cont, [[4, 53], [37, 5]])\n        np.testing.assert_almost_equal(cont.col_unknowns, [0, 1])\n        np.testing.assert_almost_equal(cont.row_unknowns, [0, 1])\n        self.assertEqual(0, cont.unknowns)\n\n    @staticmethod\n    def _construct_sparse():\n        domain = data.Domain(\n            [data.DiscreteVariable(\"d%i\" % i, values=list(\"abc\"))\n             for i in range(10)] +\n            [data.ContinuousVariable(\"c%i\" % i) for i in range(10)],\n            data.DiscreteVariable(\"y\", values=list(\"abc\")))\n\n        #  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19\n        #------------------------------------------------------------\n        #     2     2  1  1  2        1           1  1     2  0  2\n        #        1  1  0  0  1     2                 2     1  0\n        #           1     2  0\n        #\n        #        2        0  1                   1.1\n        #\n        sdata = np.array([2, 2, 1, 1, 2, 1, 1, 1, 2, 0, 2,\n                          1, 1, 0, 0, 1, 2, 2, 1, 0,\n                          1, 2, 0,\n                          2, 0, 1, 1.1])\n        indices = [1, 3, 4, 5, 6, 9, 13, 14, 16, 17, 18,\n                   2, 3, 4, 5, 6, 8, 14, 16, 17,\n                   3, 5, 6,\n                   2, 5, 6, 13]\n        indptr = [0, 11, 20, 23, 23, 27]\n        X = sp.csr_matrix((sdata, indices, indptr), shape=(5, 20))\n        Y = np.array([[1, 2, 1, 0, 0]]).T\n        return data.Table.from_numpy(domain, X, Y)\n\n    def test_sparse(self):\n        d = self._construct_sparse()\n        cont = contingency.Discrete(d, 5)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.Continuous(d, 14)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.Continuous(d, \"c3\")\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        d[4].set_class(1)\n        cont = contingency.Continuous(d, 13)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1, 1.1], [1, 1]])\n        assert_dist_equal(cont[2], [[], []])\n\n        cont = contingency.Continuous(d, 12)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n\n    def test_get_contingency(self):\n        d = self._construct_sparse()\n        cont = contingency.get_contingency(d, 5)\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = contingency.get_contingency(d, \"c4\")\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        cont = contingency.get_contingency(d, d.domain[13])\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[1.1], [1]])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[], []])\n        assert_dist_equal(cont[2], [[], []])\n\n    def test_get_contingencies(self):\n        d = self._construct_sparse()\n        conts = contingency.get_contingencies(d)\n\n        self.assertEqual(len(conts), 20)\n\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n        cont = conts[14]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_discrete=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[4]\n        self.assertIsInstance(cont, contingency.Continuous)\n        assert_dist_equal(cont[0], [[], []])\n        assert_dist_equal(cont[\"b\"], [[1], [1]])\n        assert_dist_equal(cont[2], [[2], [1]])\n\n        conts = contingency.get_contingencies(d, skip_continuous=True)\n        self.assertEqual(len(conts), 10)\n        cont = conts[5]\n        self.assertIsInstance(cont, contingency.Discrete)\n        assert_dist_equal(cont[0], [2, 0, 0])\n        assert_dist_equal(cont[\"b\"], [0, 1, 1])\n        assert_dist_equal(cont[2], [1, 0, 0])\n\n    def test_compute_contingency_metas(self):\n        var1, var2 = self.test9.domain[-2], self.test9.domain[-4]\n        cont = contingency.Discrete(self.test9, var1, var2)\n        assert_dist_equal(cont, [[3, 0, 0], [0, 2, 0],\n                                 [0, 0, 2], [0, 1, 0]])\n\n    def test_compute_contingency_row_attribute_sparse(self):\n        \"\"\"\n        Testing with sparse row variable since currently we do not test the\n        situation when a row variable is sparse.\n        \"\"\"\n        d = self.test9\n        # make X sparse\n        d.X = csr_matrix(d.X)\n        var1, var2 = d.domain[0], d.domain[1]\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n        d.X = csc_matrix(d.X)\n        cont = contingency.Discrete(d, var1, var2)\n        assert_dist_equal(cont, [[1, 0], [1, 0], [1, 0], [1, 0],\n                                 [0, 1], [0, 1], [0, 1], [0, 1]])\n        cont = contingency.Discrete(d, var2, var1)\n        assert_dist_equal(cont, [[1, 1, 1, 1, 0, 0, 0, 0],\n                                 [0, 0, 0, 0, 1, 1, 1, 1]])\n\n    def test_compute_contingency_invalid(self):\n        rstate = np.random.RandomState(0xFFFF)\n        X = data.ContinuousVariable(\"X\")\n        C = data.DiscreteVariable(\"C\", values=[\"C{}\".format(i + 1) for i in range(1024)])\n        domain = data.Domain([X], [C])\n        d = data.Table.from_numpy(\n            domain,\n            rstate.uniform(size=(20, 1)).round(1),\n            rstate.randint(0, 1024, size=(20, 1)),\n        )\n        c = contingency.get_contingency(d, X, C)\n        self.assertEqual(c.counts.shape[0], 1024)\n\n        d.Y[5] = 1024\n        with self.assertRaises(IndexError):\n            contingency.get_contingency(d, X, C)\n\n    def test_incompatible_arguments(self):\n        \"\"\"\n        When providing data table unknowns should not be provided\n        \"\"\"\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Discrete, self.zoo, 0, col_unknowns=0)\n\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, row_unknowns=0)\n        self.assertRaises(\n            TypeError, contingency.Continuous, self.zoo, 0, col_unknowns=0)\n\n        # data with no class\n        zoo_ = Table.from_table(Domain(self.zoo.domain.attributes), self.zoo)\n        self.assertRaises(ValueError, contingency.Discrete, zoo_, 0)\n        self.assertRaises(ValueError, contingency.Continuous, zoo_, 0)\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpk47gk5ae/tmp\ncreating /tmp/tmpk47gk5ae/tmp/tmpk47gk5ae\ncompile options: '-MMD -MF /tmp/tmpk47gk5ae/file.c.d -c'\ncc: /tmp/tmpk47gk5ae/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpbee17gf6/tmp\ncreating /tmp/tmpbee17gf6/tmp/tmpbee17gf6\ncompile options: '-MMD -MF /tmp/tmpbee17gf6/file.c.d -c'\ncc: /tmp/tmpbee17gf6/file.c\ncustomize UnixCCompiler using build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_simple_tree.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_tree_scorers.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_valuecount.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_contingency.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_io.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_variable.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/distance/_distance.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/preprocess/_discretize.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/preprocess/_relieff.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/projection/_som.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/widgets/utils/_grid_density.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\nrunning develop\nrunning build_scripts\nrunning egg_info\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp8bflhxed/tmp\ncreating /tmp/tmp8bflhxed/tmp/tmp8bflhxed\ncompile options: '-MMD -MF /tmp/tmp8bflhxed/file.c.d -c'\ncc: /tmp/tmp8bflhxed/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp2pkhtizp/tmp\ncreating /tmp/tmp2pkhtizp/tmp/tmp2pkhtizp\ncompile options: '-MMD -MF /tmp/tmp2pkhtizp/file.c.d -c'\ncc: /tmp/tmp2pkhtizp/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.25.0.dev0+b3c1e8c to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d\nProcessing dependencies for Orange3==3.25.0.dev0+b3c1e8c\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.25.0.dev0+b3c1e8c\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 94ms\nPrepared 18 packages in 11ms\nInstalled 18 packages in 101ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 40 packages in 230ms\nInstalled 35 packages in 544ms\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + et-xmlfile==1.1.0\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pip==24.0\n + pycparser==2.21\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 34 packages in 330ms\nInstalled 19 packages in 186ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + cycler==0.11.0\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + fonttools==4.38.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + pillow==9.5.0\n + platformdirs==4.0.0\n + pyparsing==3.1.4\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 3ms\nInstalled 2 packages in 24ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 2ms\nAudited 2 packages in 26ms\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3115:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3115 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4619:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4619 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5396:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5396 |           for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5517:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5517 |           __pyx_t_27 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5523:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5523 |           __pyx_t_27 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7051:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7051 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7741:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7741 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7801:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7801 |               __pyx_t_17 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_18 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:3881:24: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3881 |           __pyx_v_decs = (__pyx_v_decs / 10.0);\n      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4070:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4070 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:480:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  480 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1301:7: note: ‘__pyx_v_attr_index’ was declared here\n 1301 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:2935:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2935 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:581:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:3655:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3655 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3654:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3654 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4547:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4547 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4114:7: note: ‘__pyx_v_win_y’ was declared here\n 4114 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4536:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4536 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4113:7: note: ‘__pyx_v_win_x’ was declared here\n 4113 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:4746:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4746 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4745:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4745 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3141:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3141 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:2964:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2964 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2665:7: note: ‘__pyx_v_win_y’ was declared here\n 2665 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:2953:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2953 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2664:7: note: ‘__pyx_v_win_x’ was declared here\n 2664 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:5515:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5515 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5514:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5514 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/.venv/lib/python3.7/site-packages/setuptools/command/egg_info.py:628: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.\nPlease extend command classes from setuptools instead of distutils.\n  SetuptoolsDeprecationWarning\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d\ncollected 16 items\n\nr2e_tests/test_1.py E...............                                     [100%]\n\n==================================== ERRORS ====================================\n_______________________ ERROR at setup of test_filename ________________________\nfile /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/Orange/tests/__init__.py, line 65\n  def test_filename(path):\nE       fixture 'path' not found\n>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory\n>       use 'pytest --fixtures [testpath]' for help on them.\n\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/Orange/tests/__init__.py:65\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestDiscrete::test_array_with_unknowns\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_invalid\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_metas\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_row_attribute_sparse\nPASSED r2e_tests/test_1.py::TestDiscrete::test_continuous\nPASSED r2e_tests/test_1.py::TestDiscrete::test_continuous_array_with_unknowns\nPASSED r2e_tests/test_1.py::TestDiscrete::test_continuous_missing\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete_missing\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete_with_fallback\nPASSED r2e_tests/test_1.py::TestDiscrete::test_get_contingencies\nPASSED r2e_tests/test_1.py::TestDiscrete::test_get_contingency\nPASSED r2e_tests/test_1.py::TestDiscrete::test_incompatible_arguments\nPASSED r2e_tests/test_1.py::TestDiscrete::test_mixedtype_metas\nPASSED r2e_tests/test_1.py::TestDiscrete::test_sparse\nERROR r2e_tests/test_1.py::test_filename\n========================= 15 passed, 1 error in 1.52s ==========================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d\ncollected 16 items\n\nr2e_tests/test_1.py E.....F.........                                     [100%]\n\n==================================== ERRORS ====================================\n_______________________ ERROR at setup of test_filename ________________________\nfile /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/Orange/tests/__init__.py, line 65\n  def test_filename(path):\nE       fixture 'path' not found\n>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory\n>       use 'pytest --fixtures [testpath]' for help on them.\n\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b3c1e8cd77d836813c2330888b77b915a81b664d/Orange/tests/__init__.py:65\n=================================== FAILURES ===================================\n_______________ TestDiscrete.test_continuous_array_with_unknowns _______________\n\n    @staticmethod\n    def test_continuous_array_with_unknowns():\n        \"\"\"\n        Test array_with_unknowns function\n        \"\"\"\n        d = data.Table(\"iris\")\n        d.Y[:50] = np.zeros(50) * float(\"nan\")\n        cont = contingency.Continuous(d, \"sepal width\")\n        correct_row_unknowns = [0., 0., 1., 0., 0., 0., 0., 0., 1., 6., 5., 5.,\n                                2., 9., 6., 2., 3., 4., 2., 1., 1., 1., 1.]\n        correct_row_unknowns_no_zero = [\n            c for c in correct_row_unknowns if c > 0]\n        correct_values_no_zero = [\n            v for v, c in zip(cont.values, correct_row_unknowns) if c > 0]\n    \n        np.testing.assert_almost_equal(cont.row_unknowns, correct_row_unknowns)\n>       arr_unknowns = cont.array_with_unknowns\nE       AttributeError: 'Continuous' object has no attribute 'array_with_unknowns'\n\nr2e_tests/test_1.py:184: AttributeError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestDiscrete::test_array_with_unknowns\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_invalid\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_metas\nPASSED r2e_tests/test_1.py::TestDiscrete::test_compute_contingency_row_attribute_sparse\nPASSED r2e_tests/test_1.py::TestDiscrete::test_continuous\nPASSED r2e_tests/test_1.py::TestDiscrete::test_continuous_missing\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete_missing\nPASSED r2e_tests/test_1.py::TestDiscrete::test_discrete_with_fallback\nPASSED r2e_tests/test_1.py::TestDiscrete::test_get_contingencies\nPASSED r2e_tests/test_1.py::TestDiscrete::test_get_contingency\nPASSED r2e_tests/test_1.py::TestDiscrete::test_incompatible_arguments\nPASSED r2e_tests/test_1.py::TestDiscrete::test_mixedtype_metas\nPASSED r2e_tests/test_1.py::TestDiscrete::test_sparse\nERROR r2e_tests/test_1.py::test_filename\nFAILED r2e_tests/test_1.py::TestDiscrete::test_continuous_array_with_unknowns\n==================== 1 failed, 14 passed, 1 error in 1.39s =====================\n",
    "old_commit_res_stderr": ""
}
Orange/statistics/contingency.py Orange/tests/test_contingency.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Accessing `array_with_unknowns` on `Continuous` Object Raises AttributeError

**Description:**
When attempting to access the `array_with_unknowns` property of a `Continuous` object, an `AttributeError` is raised because the property does not exist. This prevents users from retrieving all values, including unknowns, as intended.

**Example Code:**
```python
from Orange.statistics import contingency
from Orange.data import Table
import numpy as np

# Load sample data
data = Table("iris")
data.Y[:50] = np.zeros(50) * float("nan")

# Create Continuous contingency object
cont = contingency.Continuous(data, "sepal width")

# Attempt to access array_with_unknowns
unknowns = cont.array_with_unknowns
```

**Expected Behavior:**
Accessing `cont.array_with_unknowns` should return a list of all items, including a row that combines `row_unknowns` with their corresponding values. This allows for comprehensive analysis that accounts for unknown values.

**Actual Behavior:**
Running the above code results in the following error:
```
AttributeError: 'Continuous' object has no attribute 'array_with_unknowns'
```

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/statistics/contingency.py
import numpy as np

from Orange import data


def _get_variable(variable, dat, attr_name, expected_type=None, expected_name=""):
    failed = False
    if isinstance(variable, data.Variable):
        datvar = getattr(dat, "variable", None)
        if datvar is not None and datvar is not variable:
            raise ValueError("variable does not match the variable in the data")
    elif hasattr(dat, "domain"):
        variable = dat.domain[variable]
    elif hasattr(dat, attr_name):
        variable = dat.variable
    else:
        failed = True
    if failed or (expected_type is not None and not isinstance(variable, expected_type)):
        if not expected_type or isinstance(variable, data.Variable):
            raise ValueError("expected %s variable not %s" % (expected_name, variable))
        else:
            raise ValueError("expected %s, not '%s'" % (
                expected_type.__name__, type(variable).__name__))
    return variable


def _create_discrete(cls, *args):
    return cls(*args)


class Discrete(np.ndarray):
    def __new__(cls, dat, col_variable=None, row_variable=None,
                row_unknowns=None, col_unknowns=None, unknowns=None):
        if isinstance(dat, data.Storage):
            if unknowns is not None or row_unknowns is not None or \
                    col_unknowns is not None:
                raise TypeError(
                    "incompatible arguments (data storage and 'unknowns'")
            return cls.from_data(dat, col_variable, row_variable)

        if row_variable is not None:
            row_variable = _get_variable(row_variable, dat, "row_variable")
        if col_variable is not None:
            col_variable = _get_variable(col_variable, dat, "col_variable")

        self = super().__new__(cls, dat.shape)
        self.row_variable = row_variable
        self.col_variable = col_variable

        self.col_unknowns = np.zeros(dat.shape[0]) \
            if col_unknowns is None else col_unknowns
        self.row_unknowns = np.zeros(dat.shape[1]) \
            if col_unknowns is None else row_unknowns
        self.unknowns = unknowns or 0

        self[...] = dat

        return self

    @classmethod
    def from_data(cls, data, col_variable, row_variable=None):
        if row_variable is None:
            row_variable = data.domain.class_var
            if row_variable is None:
                raise ValueError(
                    "row_variable needs to be specified (data has no class)")
        row_variable = _get_variable(row_variable, data, "row_variable")
        col_variable = _get_variable(col_variable, data, "col_variable")
        try:
            dist, col_unknowns, row_unknowns, unknowns = \
                data._compute_contingency([col_variable], row_variable)[0]

            self = super().__new__(cls, dist.shape)
            self[...] = dist
            self.col_unknowns = col_unknowns
            self.row_unknowns = row_unknowns
            self.unknowns = unknowns
        except NotImplementedError:
            shape = len(row_variable.values), len(col_variable.values)
            self = super().__new__(cls, shape)
            self[...] = np.zeros(shape)
            self.col_unknowns = np.zeros(shape[0])
            self.row_unknowns = np.zeros(shape[1])
            self.unknowns = 0
            rind = data.domain.index(row_variable)
            cind = data.domain.index(col_variable)
            for row in data:
                rval, cval = row[rind], row[cind]
                w = row.weight
                if np.isnan(rval) and np.isnan(cval):
                    self.unknowns += w
                elif np.isnan(rval):
                    self.row_unknowns[int(cval)] += w
                elif np.isnan(cval):
                    self.col_unknowns[int(rval)] += w
                else:
                    self[int(rval), int(cval)] += w
        self.row_variable = row_variable
        self.col_variable = col_variable
        return self

    @property
    def array_with_unknowns(self):
        """
        This property returns a contingency array with unknowns arrays added
        as a column and row.

        Returns
        -------
        np.array
            Array with concatenated unknowns as a row and column
        """
        return np.vstack(
            (np.hstack((np.array(self), self.col_unknowns.reshape(-1, 1))),
             np.append(self.row_unknowns, self.unknowns)))

    def __eq__(self, other):
        return (
            np.array_equal(self, other) and
            (not hasattr(other, "col_unknowns") or
             np.array_equal(self.col_unknowns, other.col_unknowns)) and
            (not hasattr(other, "row_unknowns") or
             np.array_equal(self.row_unknowns, other.row_unknowns)) and
            (not hasattr(other, "unknowns") or
             self.unknowns == other.unknowns)
        )

    def __getitem__(self, index):
        if isinstance(index, str):
            if len(self.shape) == 2:  # contingency
                index = self.row_variable.to_val(index)
                contingency_row = super().__getitem__(index)
                contingency_row.col_variable = self.col_variable
                return contingency_row
            else:  # Contingency row
                column = self.strides == self.base.strides[:1]
                if column:
                    index = self.row_variable.to_val(index)
                else:
                    index = self.col_variable.to_val(index)

        elif isinstance(index, tuple):
            if isinstance(index[0], str):
                index = (self.row_variable.to_val(index[0]), index[1])
            if isinstance(index[1], str):
                index = (index[0], self.col_variable.to_val(index[1]))
        result = super().__getitem__(index)
        if isinstance(result, Discrete):
            if not isinstance(index, tuple):
                result.col_unknowns = self.col_unknowns[index]
                result.row_unknowns = self.row_unknowns
            else:
                result.col_unknowns = self.col_unknowns[index[0]]
                result.row_unknowns = self.col_unknowns[index[1]]
            result.unknowns = self.unknowns
        if result.strides:
            result.col_variable = self.col_variable
            result.row_variable = self.row_variable
        return result

    def __setitem__(self, index, value):
        if isinstance(index, str):
            index = self.row_variable.to_val(index)
        elif isinstance(index, tuple):
            if isinstance(index[0], str):
                index = (self.row_variable.to_val(index[0]), index[1])
            if isinstance(index[1], str):
                index = (index[0], self.col_variable.to_val(index[1]))
        super().__setitem__(index, value)

    def normalize(self, axis=None):
        t = np.sum(self, axis=axis)
        if t > 1e-6:
            self[:] /= t
            if axis is None or axis == 1:
                self.unknowns /= t

    def __reduce__(self):
        return (
            _create_discrete,
            (Discrete, np.copy(self), self.col_variable, self.row_variable,
             self.col_unknowns, self.row_unknowns)
        )


class Continuous:
    def __init__(self, dat, col_variable=None, row_variable=None,
                 col_unknowns=None, row_unknowns=None, unknowns=None):
        if isinstance(dat, data.Storage):
            if unknowns is not None or row_unknowns is not None or \
                    col_unknowns is not None:
                raise TypeError(
                    "incompatible arguments (data storage and 'unknowns'")
            self.from_data(dat, col_variable, row_variable)
            return

        if row_variable is not None:
            row_variable = _get_variable(row_variable, dat, "row_variable")
        if col_variable is not None:
            col_variable = _get_variable(col_variable, dat, "col_variable")

        self.values, self.counts = dat

        self.row_variable = row_variable
        self.col_variable = col_variable
        self.col_unknowns = np.zeros(self.counts.shape[1]) \
            if col_unknowns is None else col_unknowns
        self.row_unknowns = np.zeros(self.counts.shape[0]) \
            if row_unknowns is None else row_unknowns
        self.unknowns = unknowns or 0

    def from_data(self, data, col_variable, row_variable=None):
        if row_variable is None:
            row_variable = data.domain.class_var
            if row_variable is None:
                raise ValueError("row_variable needs to be specified (data has no class)")
        self.row_variable = _get_variable(row_variable, data, "row_variable")
        self.col_variable = _get_variable(col_variable, data, "col_variable")
        try:
            conts = data._compute_contingency([col_variable], row_variable)
            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \
            self.unknowns = conts[0]
        except NotImplementedError:
            raise NotImplementedError(
                "Fallback method for computation of contingencies is not implemented yet"
            )

    def __eq__(self, other):
        return (
            np.array_equal(self.values, other.values) and
            np.array_equal(self.counts, other.counts) and
            (not hasattr(other, "col_unknowns") or
             np.array_equal(self.col_unknowns, other.col_unknowns)) and
            (not hasattr(other, "row_unknowns") or
             np.array_equal(self.row_unknowns, other.row_unknowns)) and
            (not hasattr(other, "unknowns") or
             self.unknowns == other.unknowns)
        )

    def __getitem__(self, index):
        """ Return contingencies for a given class value. """
        if isinstance(index, (str, float)):
            index = self.row_variable.to_val(index)
        C = self.counts[index]
        ind = C > 0
        return np.vstack((self.values[ind], C[ind]))

    def __len__(self):
        return self.counts.shape[0]

    def __setitem__(self, index, value):
        raise NotImplementedError(
            "Setting individual class contingencies is not implemented yet. "
            "Set .values and .counts."
        )

    def normalize(self, axis=None):
        if axis is None:
            t = sum(np.sum(x[:, 1]) for x in self)
            if t > 1e-6:
                for x in self:
                    x[:, 1] /= t
        elif axis != 1:
            raise ValueError(
                "contingencies can be normalized only with axis=1 or without axis"
            )
        else:
            for i, x in enumerate(self):
                t = np.sum(x[:, 1])
                if t > 1e-6:
                    x[:, 1] /= t
                    self.unknowns[i] /= t
                else:
                    if self.unknowns[i] > 1e-6:
                        self.unknowns[i] = 1


def get_contingency(dat, col_variable, row_variable=None, col_unknowns=None,
                    row_unknowns=None, unks=None):
    variable = _get_variable(col_variable, dat, "col_variable")
    if variable.is_discrete:
        return Discrete(
            dat, col_variable, row_variable, col_unknowns, row_unknowns, unks)
    elif variable.is_continuous:
        return Continuous(
            dat, col_variable, row_variable, col_unknowns, row_unknowns)
    else:
        raise TypeError(
            "cannot compute distribution of '%s'" % type(variable).__name__)


def get_contingencies(dat, skip_discrete=False, skip_continuous=False):
    vars = dat.domain.attributes
    row_var = dat.domain.class_var
    if row_var is None:
        raise ValueError("data has no target variable")
    if skip_discrete:
        if skip_continuous:
            return []
        columns = [i for i, var in enumerate(vars) if var.is_continuous]
    elif skip_continuous:
        columns = [i for i, var in enumerate(vars) if var.is_discrete]
    else:
        columns = None
    try:
        dist_unks = dat._compute_contingency(columns)
        if columns is None:
            columns = np.arange(len(vars))
        contigs = []
        for col, (cont, col_unk, row_unk, unks) in zip(columns, dist_unks):
            contigs.append(get_contingency(
                cont, vars[col], row_var, col_unk, row_unk, unks))
    except NotImplementedError:
        if columns is None:
            columns = range(len(vars))
        contigs = [get_contingency(dat, i) for i in columns]
    return contigs

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]
**Title:** Accessing `array_with_unknowns` on `Continuous` Object Raises AttributeError

**Description:**
When attempting to access the `array_with_unknowns` property of a `Continuous` object, an `AttributeError` is raised because the property does not exist. This prevents users from retrieving all values, including unknowns, as intended.

**Example Code:**
```python
from Orange.statistics import contingency
from Orange.data import Table
import numpy as np

# Load sample data
data = Table("iris")
data.Y[:50] = np.zeros(50) * float("nan")

# Create Continuous contingency object
cont = contingency.Continuous(data, "sepal width")

# Attempt to access array_with_unknowns
unknowns = cont.array_with_unknowns
```

**Expected Behavior:**
Accessing `cont.array_with_unknowns` should return a list of all items, including a row that combines `row_unknowns` with their corresponding values. This allows for comprehensive analysis that accounts for unknown values.

**Actual Behavior:**
Running the above code results in the following error:
```
AttributeError: 'Continuous' object has no attribute 'array_with_unknowns'
```

[/ISSUE]
{
    "TestDiscrete.test_array_with_unknowns": "PASSED",
    "TestDiscrete.test_compute_contingency_invalid": "PASSED",
    "TestDiscrete.test_compute_contingency_metas": "PASSED",
    "TestDiscrete.test_compute_contingency_row_attribute_sparse": "PASSED",
    "TestDiscrete.test_continuous": "PASSED",
    "TestDiscrete.test_continuous_array_with_unknowns": "PASSED",
    "TestDiscrete.test_continuous_missing": "PASSED",
    "TestDiscrete.test_discrete": "PASSED",
    "TestDiscrete.test_discrete_missing": "PASSED",
    "TestDiscrete.test_discrete_with_fallback": "PASSED",
    "TestDiscrete.test_get_contingencies": "PASSED",
    "TestDiscrete.test_get_contingency": "PASSED",
    "TestDiscrete.test_incompatible_arguments": "PASSED",
    "TestDiscrete.test_mixedtype_metas": "PASSED",
    "TestDiscrete.test_sparse": "PASSED",
    "test_filename": "ERROR"
}
diff --git a/Orange/statistics/contingency.py b/Orange/statistics/contingency.py
index 9905a52eb..76135576a 100644
--- a/Orange/statistics/contingency.py
+++ b/Orange/statistics/contingency.py
@@ -225,6 +225,18 @@ class Continuous:
                 "Fallback method for computation of contingencies is not implemented yet"
             )
 
+    @property
+    def array_with_unknowns(self):
+        """
+        This function returns the list of all items returned by __getitem__
+        with adding a row of row_unknowns together with values.
+        """
+        # pylint: disable=unnecessary-comprehension
+        other_rows = [x for x in self]
+        ind = self.row_unknowns > 0
+        unknown_rows = np.vstack((self.values[ind], self.row_unknowns[ind]))
+        return other_rows + [unknown_rows]
+
     def __eq__(self, other):
         return (
             np.array_equal(self.values, other.values) and

{"Orange/statistics/contingency.py": "import numpy as np\n\nfrom Orange import data\n\n\ndef _get_variable(variable, dat, attr_name, expected_type=None, expected_name=\"\"):\n    failed = False\n    if isinstance(variable, data.Variable):\n        datvar = getattr(dat, \"variable\", None)\n        if datvar is not None and datvar is not variable:\n            raise ValueError(\"variable does not match the variable in the data\")\n    elif hasattr(dat, \"domain\"):\n        variable = dat.domain[variable]\n    elif hasattr(dat, attr_name):\n        variable = dat.variable\n    else:\n        failed = True\n    if failed or (expected_type is not None and not isinstance(variable, expected_type)):\n        if not expected_type or isinstance(variable, data.Variable):\n            raise ValueError(\"expected %s variable not %s\" % (expected_name, variable))\n        else:\n            raise ValueError(\"expected %s, not '%s'\" % (\n                expected_type.__name__, type(variable).__name__))\n    return variable\n\n\ndef _create_discrete(cls, *args):\n    return cls(*args)\n\n\nclass Discrete(np.ndarray):\n    def __new__(cls, dat, col_variable=None, row_variable=None,\n                row_unknowns=None, col_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            return cls.from_data(dat, col_variable, row_variable)\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self = super().__new__(cls, dat.shape)\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n\n        self.col_unknowns = np.zeros(dat.shape[0]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(dat.shape[1]) \\\n            if col_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n        self[...] = dat\n\n        return self\n\n    @classmethod\n    def from_data(cls, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\n                    \"row_variable needs to be specified (data has no class)\")\n        row_variable = _get_variable(row_variable, data, \"row_variable\")\n        col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            dist, col_unknowns, row_unknowns, unknowns = \\\n                data._compute_contingency([col_variable], row_variable)[0]\n\n            self = super().__new__(cls, dist.shape)\n            self[...] = dist\n            self.col_unknowns = col_unknowns\n            self.row_unknowns = row_unknowns\n            self.unknowns = unknowns\n        except NotImplementedError:\n            shape = len(row_variable.values), len(col_variable.values)\n            self = super().__new__(cls, shape)\n            self[...] = np.zeros(shape)\n            self.col_unknowns = np.zeros(shape[0])\n            self.row_unknowns = np.zeros(shape[1])\n            self.unknowns = 0\n            rind = data.domain.index(row_variable)\n            cind = data.domain.index(col_variable)\n            for row in data:\n                rval, cval = row[rind], row[cind]\n                w = row.weight\n                if np.isnan(rval) and np.isnan(cval):\n                    self.unknowns += w\n                elif np.isnan(rval):\n                    self.row_unknowns[int(cval)] += w\n                elif np.isnan(cval):\n                    self.col_unknowns[int(rval)] += w\n                else:\n                    self[int(rval), int(cval)] += w\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        return self\n\n    @property\n    def array_with_unknowns(self):\n        \"\"\"\n        This property returns a contingency array with unknowns arrays added\n        as a column and row.\n\n        Returns\n        -------\n        np.array\n            Array with concatenated unknowns as a row and column\n        \"\"\"\n        return np.vstack(\n            (np.hstack((np.array(self), self.col_unknowns.reshape(-1, 1))),\n             np.append(self.row_unknowns, self.unknowns)))\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self, other) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        if isinstance(index, str):\n            if len(self.shape) == 2:  # contingency\n                index = self.row_variable.to_val(index)\n                contingency_row = super().__getitem__(index)\n                contingency_row.col_variable = self.col_variable\n                return contingency_row\n            else:  # Contingency row\n                column = self.strides == self.base.strides[:1]\n                if column:\n                    index = self.row_variable.to_val(index)\n                else:\n                    index = self.col_variable.to_val(index)\n\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        result = super().__getitem__(index)\n        if isinstance(result, Discrete):\n            if not isinstance(index, tuple):\n                result.col_unknowns = self.col_unknowns[index]\n                result.row_unknowns = self.row_unknowns\n            else:\n                result.col_unknowns = self.col_unknowns[index[0]]\n                result.row_unknowns = self.col_unknowns[index[1]]\n            result.unknowns = self.unknowns\n        if result.strides:\n            result.col_variable = self.col_variable\n            result.row_variable = self.row_variable\n        return result\n\n    def __setitem__(self, index, value):\n        if isinstance(index, str):\n            index = self.row_variable.to_val(index)\n        elif isinstance(index, tuple):\n            if isinstance(index[0], str):\n                index = (self.row_variable.to_val(index[0]), index[1])\n            if isinstance(index[1], str):\n                index = (index[0], self.col_variable.to_val(index[1]))\n        super().__setitem__(index, value)\n\n    def normalize(self, axis=None):\n        t = np.sum(self, axis=axis)\n        if t > 1e-6:\n            self[:] /= t\n            if axis is None or axis == 1:\n                self.unknowns /= t\n\n    def __reduce__(self):\n        return (\n            _create_discrete,\n            (Discrete, np.copy(self), self.col_variable, self.row_variable,\n             self.col_unknowns, self.row_unknowns)\n        )\n\n\nclass Continuous:\n    def __init__(self, dat, col_variable=None, row_variable=None,\n                 col_unknowns=None, row_unknowns=None, unknowns=None):\n        if isinstance(dat, data.Storage):\n            if unknowns is not None or row_unknowns is not None or \\\n                    col_unknowns is not None:\n                raise TypeError(\n                    \"incompatible arguments (data storage and 'unknowns'\")\n            self.from_data(dat, col_variable, row_variable)\n            return\n\n        if row_variable is not None:\n            row_variable = _get_variable(row_variable, dat, \"row_variable\")\n        if col_variable is not None:\n            col_variable = _get_variable(col_variable, dat, \"col_variable\")\n\n        self.values, self.counts = dat\n\n        self.row_variable = row_variable\n        self.col_variable = col_variable\n        self.col_unknowns = np.zeros(self.counts.shape[1]) \\\n            if col_unknowns is None else col_unknowns\n        self.row_unknowns = np.zeros(self.counts.shape[0]) \\\n            if row_unknowns is None else row_unknowns\n        self.unknowns = unknowns or 0\n\n    def from_data(self, data, col_variable, row_variable=None):\n        if row_variable is None:\n            row_variable = data.domain.class_var\n            if row_variable is None:\n                raise ValueError(\"row_variable needs to be specified (data has no class)\")\n        self.row_variable = _get_variable(row_variable, data, \"row_variable\")\n        self.col_variable = _get_variable(col_variable, data, \"col_variable\")\n        try:\n            conts = data._compute_contingency([col_variable], row_variable)\n            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \\\n            self.unknowns = conts[0]\n        except NotImplementedError:\n            raise NotImplementedError(\n                \"Fallback method for computation of contingencies is not implemented yet\"\n            )\n\n    def __eq__(self, other):\n        return (\n            np.array_equal(self.values, other.values) and\n            np.array_equal(self.counts, other.counts) and\n            (not hasattr(other, \"col_unknowns\") or\n             np.array_equal(self.col_unknowns, other.col_unknowns)) and\n            (not hasattr(other, \"row_unknowns\") or\n             np.array_equal(self.row_unknowns, other.row_unknowns)) and\n            (not hasattr(other, \"unknowns\") or\n             self.unknowns == other.unknowns)\n        )\n\n    def __getitem__(self, index):\n        \"\"\" Return contingencies for a given class value. \"\"\"\n        if isinstance(index, (str, float)):\n            index = self.row_variable.to_val(index)\n        C = self.counts[index]\n        ind = C > 0\n        return np.vstack((self.values[ind], C[ind]))\n\n    def __len__(self):\n        return self.counts.shape[0]\n\n    def __setitem__(self, index, value):\n        raise NotImplementedError(\n            \"Setting individual class contingencies is not implemented yet. \"\n            \"Set .values and .counts.\"\n        )\n\n    def normalize(self, axis=None):\n        if axis is None:\n            t = sum(np.sum(x[:, 1]) for x in self)\n            if t > 1e-6:\n                for x in self:\n                    x[:, 1] /= t\n        elif axis != 1:\n            raise ValueError(\n                \"contingencies can be normalized only with axis=1 or without axis\"\n            )\n        else:\n            for i, x in enumerate(self):\n                t = np.sum(x[:, 1])\n                if t > 1e-6:\n                    x[:, 1] /= t\n                    self.unknowns[i] /= t\n                else:\n                    if self.unknowns[i] > 1e-6:\n                        self.unknowns[i] = 1\n\n\ndef get_contingency(dat, col_variable, row_variable=None, col_unknowns=None,\n                    row_unknowns=None, unks=None):\n    variable = _get_variable(col_variable, dat, \"col_variable\")\n    if variable.is_discrete:\n        return Discrete(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns, unks)\n    elif variable.is_continuous:\n        return Continuous(\n            dat, col_variable, row_variable, col_unknowns, row_unknowns)\n    else:\n        raise TypeError(\n            \"cannot compute distribution of '%s'\" % type(variable).__name__)\n\n\ndef get_contingencies(dat, skip_discrete=False, skip_continuous=False):\n    vars = dat.domain.attributes\n    row_var = dat.domain.class_var\n    if row_var is None:\n        raise ValueError(\"data has no target variable\")\n    if skip_discrete:\n        if skip_continuous:\n            return []\n        columns = [i for i, var in enumerate(vars) if var.is_continuous]\n    elif skip_continuous:\n        columns = [i for i, var in enumerate(vars) if var.is_discrete]\n    else:\n        columns = None\n    try:\n        dist_unks = dat._compute_contingency(columns)\n        if columns is None:\n            columns = np.arange(len(vars))\n        contigs = []\n        for col, (cont, col_unk, row_unk, unks) in zip(columns, dist_unks):\n            contigs.append(get_contingency(\n                cont, vars[col], row_var, col_unk, row_unk, unks))\n    except NotImplementedError:\n        if columns is None:\n            columns = range(len(vars))\n        contigs = [get_contingency(dat, i) for i in columns]\n    return contigs\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Accessing `array_with_unknowns` on `Continuous` Object Raises AttributeError

**Description:**
When attempting to access the `array_with_unknowns` property of a `Continuous` object, an `AttributeError` is raised because the property does not exist. This prevents users from retrieving all values, including unknowns, as intended.

**Example Code:**
```python
from Orange.statistics import contingency
from Orange.data import Table
import numpy as np

# Load sample data
data = Table("iris")
data.Y[:50] = np.zeros(50) * float("nan")

# Create Continuous contingency object
cont = contingency.Continuous(data, "sepal width")

# Attempt to access array_with_unknowns
unknowns = cont.array_with_unknowns
```

**Expected Behavior:**
Accessing `cont.array_with_unknowns` should return a list of all items, including a row that combines `row_unknowns` with their corresponding values. This allows for comprehensive analysis that accounts for unknown values.

**Actual Behavior:**
Running the above code results in the following error:
```
AttributeError: 'Continuous' object has no attribute 'array_with_unknowns'
```

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/statistics/contingency.py
import numpy as np

from Orange import data


def _get_variable(variable, dat, attr_name, expected_type=None, expected_name=""):
    failed = False
    if isinstance(variable, data.Variable):
        datvar = getattr(dat, "variable", None)
        if datvar is not None and datvar is not variable:
            raise ValueError("variable does not match the variable in the data")
    elif hasattr(dat, "domain"):
        variable = dat.domain[variable]
    elif hasattr(dat, attr_name):
        variable = dat.variable
    else:
        failed = True
    if failed or (expected_type is not None and not isinstance(variable, expected_type)):
        if not expected_type or isinstance(variable, data.Variable):
            raise ValueError("expected %s variable not %s" % (expected_name, variable))
        else:
            raise ValueError("expected %s, not '%s'" % (
                expected_type.__name__, type(variable).__name__))
    return variable


def _create_discrete(cls, *args):
    return cls(*args)


class Discrete(np.ndarray):
    def __new__(cls, dat, col_variable=None, row_variable=None,
                row_unknowns=None, col_unknowns=None, unknowns=None):
        if isinstance(dat, data.Storage):
            if unknowns is not None or row_unknowns is not None or \
                    col_unknowns is not None:
                raise TypeError(
                    "incompatible arguments (data storage and 'unknowns'")
            return cls.from_data(dat, col_variable, row_variable)

        if row_variable is not None:
            row_variable = _get_variable(row_variable, dat, "row_variable")
        if col_variable is not None:
            col_variable = _get_variable(col_variable, dat, "col_variable")

        self = super().__new__(cls, dat.shape)
        self.row_variable = row_variable
        self.col_variable = col_variable

        self.col_unknowns = np.zeros(dat.shape[0]) \
            if col_unknowns is None else col_unknowns
        self.row_unknowns = np.zeros(dat.shape[1]) \
            if col_unknowns is None else row_unknowns
        self.unknowns = unknowns or 0

        self[...] = dat

        return self

    @classmethod
    def from_data(cls, data, col_variable, row_variable=None):
        if row_variable is None:
            row_variable = data.domain.class_var
            if row_variable is None:
                raise ValueError(
                    "row_variable needs to be specified (data has no class)")
        row_variable = _get_variable(row_variable, data, "row_variable")
        col_variable = _get_variable(col_variable, data, "col_variable")
        try:
            dist, col_unknowns, row_unknowns, unknowns = \
                data._compute_contingency([col_variable], row_variable)[0]

            self = super().__new__(cls, dist.shape)
            self[...] = dist
            self.col_unknowns = col_unknowns
            self.row_unknowns = row_unknowns
            self.unknowns = unknowns
        except NotImplementedError:
            shape = len(row_variable.values), len(col_variable.values)
            self = super().__new__(cls, shape)
            self[...] = np.zeros(shape)
            self.col_unknowns = np.zeros(shape[0])
            self.row_unknowns = np.zeros(shape[1])
            self.unknowns = 0
            rind = data.domain.index(row_variable)
            cind = data.domain.index(col_variable)
            for row in data:
                rval, cval = row[rind], row[cind]
                w = row.weight
                if np.isnan(rval) and np.isnan(cval):
                    self.unknowns += w
                elif np.isnan(rval):
                    self.row_unknowns[int(cval)] += w
                elif np.isnan(cval):
                    self.col_unknowns[int(rval)] += w
                else:
                    self[int(rval), int(cval)] += w
        self.row_variable = row_variable
        self.col_variable = col_variable
        return self

    @property
    def array_with_unknowns(self):
        """
        This property returns a contingency array with unknowns arrays added
        as a column and row.

        Returns
        -------
        np.array
            Array with concatenated unknowns as a row and column
        """
        return np.vstack(
            (np.hstack((np.array(self), self.col_unknowns.reshape(-1, 1))),
             np.append(self.row_unknowns, self.unknowns)))

    def __eq__(self, other):
        return (
            np.array_equal(self, other) and
            (not hasattr(other, "col_unknowns") or
             np.array_equal(self.col_unknowns, other.col_unknowns)) and
            (not hasattr(other, "row_unknowns") or
             np.array_equal(self.row_unknowns, other.row_unknowns)) and
            (not hasattr(other, "unknowns") or
             self.unknowns == other.unknowns)
        )

    def __getitem__(self, index):
        if isinstance(index, str):
            if len(self.shape) == 2:  # contingency
                index = self.row_variable.to_val(index)
                contingency_row = super().__getitem__(index)
                contingency_row.col_variable = self.col_variable
                return contingency_row
            else:  # Contingency row
                column = self.strides == self.base.strides[:1]
                if column:
                    index = self.row_variable.to_val(index)
                else:
                    index = self.col_variable.to_val(index)

        elif isinstance(index, tuple):
            if isinstance(index[0], str):
                index = (self.row_variable.to_val(index[0]), index[1])
            if isinstance(index[1], str):
                index = (index[0], self.col_variable.to_val(index[1]))
        result = super().__getitem__(index)
        if isinstance(result, Discrete):
            if not isinstance(index, tuple):
                result.col_unknowns = self.col_unknowns[index]
                result.row_unknowns = self.row_unknowns
            else:
                result.col_unknowns = self.col_unknowns[index[0]]
                result.row_unknowns = self.col_unknowns[index[1]]
            result.unknowns = self.unknowns
        if result.strides:
            result.col_variable = self.col_variable
            result.row_variable = self.row_variable
        return result

    def __setitem__(self, index, value):
        if isinstance(index, str):
            index = self.row_variable.to_val(index)
        elif isinstance(index, tuple):
            if isinstance(index[0], str):
                index = (self.row_variable.to_val(index[0]), index[1])
            if isinstance(index[1], str):
                index = (index[0], self.col_variable.to_val(index[1]))
        super().__setitem__(index, value)

    def normalize(self, axis=None):
        t = np.sum(self, axis=axis)
        if t > 1e-6:
            self[:] /= t
            if axis is None or axis == 1:
                self.unknowns /= t

    def __reduce__(self):
        return (
            _create_discrete,
            (Discrete, np.copy(self), self.col_variable, self.row_variable,
             self.col_unknowns, self.row_unknowns)
        )


class Continuous:
    def __init__(self, dat, col_variable=None, row_variable=None,
                 col_unknowns=None, row_unknowns=None, unknowns=None):
        if isinstance(dat, data.Storage):
            if unknowns is not None or row_unknowns is not None or \
                    col_unknowns is not None:
                raise TypeError(
                    "incompatible arguments (data storage and 'unknowns'")
            self.from_data(dat, col_variable, row_variable)
            return

        if row_variable is not None:
            row_variable = _get_variable(row_variable, dat, "row_variable")
        if col_variable is not None:
            col_variable = _get_variable(col_variable, dat, "col_variable")

        self.values, self.counts = dat

        self.row_variable = row_variable
        self.col_variable = col_variable
        self.col_unknowns = np.zeros(self.counts.shape[1]) \
            if col_unknowns is None else col_unknowns
        self.row_unknowns = np.zeros(self.counts.shape[0]) \
            if row_unknowns is None else row_unknowns
        self.unknowns = unknowns or 0

    def from_data(self, data, col_variable, row_variable=None):
        if row_variable is None:
            row_variable = data.domain.class_var
            if row_variable is None:
                raise ValueError("row_variable needs to be specified (data has no class)")
        self.row_variable = _get_variable(row_variable, data, "row_variable")
        self.col_variable = _get_variable(col_variable, data, "col_variable")
        try:
            conts = data._compute_contingency([col_variable], row_variable)
            (self.values, self.counts), self.col_unknowns, self.row_unknowns, \
            self.unknowns = conts[0]
        except NotImplementedError:
            raise NotImplementedError(
                "Fallback method for computation of contingencies is not implemented yet"
            )

    def __eq__(self, other):
        return (
            np.array_equal(self.values, other.values) and
            np.array_equal(self.counts, other.counts) and
            (not hasattr(other, "col_unknowns") or
             np.array_equal(self.col_unknowns, other.col_unknowns)) and
            (not hasattr(other, "row_unknowns") or
             np.array_equal(self.row_unknowns, other.row_unknowns)) and
            (not hasattr(other, "unknowns") or
             self.unknowns == other.unknowns)
        )

    def __getitem__(self, index):
        """ Return contingencies for a given class value. """
        if isinstance(index, (str, float)):
            index = self.row_variable.to_val(index)
        C = self.counts[index]
        ind = C > 0
        return np.vstack((self.values[ind], C[ind]))

    def __len__(self):
        return self.counts.shape[0]

    def __setitem__(self, index, value):
        raise NotImplementedError(
            "Setting individual class contingencies is not implemented yet. "
            "Set .values and .counts."
        )

    def normalize(self, axis=None):
        if axis is None:
            t = sum(np.sum(x[:, 1]) for x in self)
            if t > 1e-6:
                for x in self:
                    x[:, 1] /= t
        elif axis != 1:
            raise ValueError(
                "contingencies can be normalized only with axis=1 or without axis"
            )
        else:
            for i, x in enumerate(self):
                t = np.sum(x[:, 1])
                if t > 1e-6:
                    x[:, 1] /= t
                    self.unknowns[i] /= t
                else:
                    if self.unknowns[i] > 1e-6:
                        self.unknowns[i] = 1


def get_contingency(dat, col_variable, row_variable=None, col_unknowns=None,
                    row_unknowns=None, unks=None):
    variable = _get_variable(col_variable, dat, "col_variable")
    if variable.is_discrete:
        return Discrete(
            dat, col_variable, row_variable, col_unknowns, row_unknowns, unks)
    elif variable.is_continuous:
        return Continuous(
            dat, col_variable, row_variable, col_unknowns, row_unknowns)
    else:
        raise TypeError(
            "cannot compute distribution of '%s'" % type(variable).__name__)


def get_contingencies(dat, skip_discrete=False, skip_continuous=False):
    vars = dat.domain.attributes
    row_var = dat.domain.class_var
    if row_var is None:
        raise ValueError("data has no target variable")
    if skip_discrete:
        if skip_continuous:
            return []
        columns = [i for i, var in enumerate(vars) if var.is_continuous]
    elif skip_continuous:
        columns = [i for i, var in enumerate(vars) if var.is_discrete]
    else:
        columns = None
    try:
        dist_unks = dat._compute_contingency(columns)
        if columns is None:
            columns = np.arange(len(vars))
        contigs = []
        for col, (cont, col_unk, row_unk, unks) in zip(columns, dist_unks):
            contigs.append(get_contingency(
                cont, vars[col], row_var, col_unk, row_unk, unks))
    except NotImplementedError:
        if columns is None:
            columns = range(len(vars))
        contigs = [get_contingency(dat, i) for i in columns]
    return contigs

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user