{
    "file_diffs": [
        {
            "old_file_content": "import numpy as np\nimport scipy.sparse as sp\n\nimport Orange.data\nfrom Orange.statistics import distribution, basic_stats\nfrom Orange.util import Reprable\nfrom .transformation import Transformation, Lookup\n\n__all__ = [\"ReplaceUnknowns\", \"Average\", \"DoNotImpute\", \"DropInstances\",\n           \"Model\", \"AsValue\", \"Random\", \"Default\"]\n\n\nclass ReplaceUnknowns(Transformation):\n    \"\"\"\n    A column transformation which replaces unknown values with a fixed `value`.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    value : int or float\n        The value with which to replace the unknown values\n    \"\"\"\n    def __init__(self, variable, value=0):\n        super().__init__(variable)\n        self.value = value\n\n    def transform(self, c):\n        if sp.issparse(c):\n            c.data = np.where(np.isnan(c.data), self.value, c.data)\n            return c\n        else:\n            return np.where(np.isnan(c), self.value, c)\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.value == other.value\n\n    def __hash__(self):\n        return hash((type(self), self.variable, float(self.value)))\n\n\nclass BaseImputeMethod(Reprable):\n    name = \"\"\n    short_name = \"\"\n    description = \"\"\n    format = \"{var.name} -> {self.short_name}\"\n    columns_only = False\n\n    def __call__(self, data, variable):\n        \"\"\" Imputes table along variable column.\n\n        Args:\n            data (Table): A table to impute.\n            variable (Variable): Variable for completing missing values.\n\n        Returns:\n            A new Variable instance with completed missing values or\n            a array mask of rows to drop out.\n        \"\"\"\n        raise NotImplementedError\n\n    def format_variable(self, var):\n        return self.format.format(var=var, self=self)\n\n    def __str__(self):\n        return self.name\n\n    def copy(self):\n        return self\n\n    @classmethod\n    def supports_variable(cls, variable):\n        return True\n\n\nclass DoNotImpute(BaseImputeMethod):\n    name = \"Don't impute\"\n    short_name = \"leave\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        return variable\n\n\nclass DropInstances(BaseImputeMethod):\n    name = \"Remove instances with unknown values\"\n    short_name = \"drop\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        col, _ = data.get_column_view(variable)\n        return np.isnan(col)\n\n\nclass Average(BaseImputeMethod):\n    name = \"Average/Most frequent\"\n    short_name = \"average\"\n    description = \"Replace with average/mode of the column\"\n\n    def __call__(self, data, variable, value=None):\n        variable = data.domain[variable]\n        if value is None:\n            if variable.is_continuous:\n                stats = basic_stats.BasicStats(data, variable)\n                value = stats.mean\n            elif variable.is_discrete:\n                dist = distribution.get_distribution(data, variable)\n                value = dist.modus()\n            else:\n                raise TypeError(\"Variable must be continuous or discrete\")\n\n        a = variable.copy(compute_value=ReplaceUnknowns(variable, value))\n        a.to_sql = ImputeSql(variable, value)\n        return a\n\n\nclass ImputeSql(Reprable):\n    def __init__(self, var, default):\n        self.var = var\n        self.default = default\n\n    def __call__(self):\n        return 'coalesce(%s, %s)' % (self.var.to_sql(), str(self.default))\n\n\nclass Default(BaseImputeMethod):\n    name = \"Value\"\n    short_name = \"value\"\n    description = \"\"\n    columns_only = True\n    format = '{var} -> {self.default}'\n\n    def __init__(self, default=0):\n        self.default = default\n\n    def __call__(self, data, variable, *, default=None):\n        variable = data.domain[variable]\n        default = default if default is not None else self.default\n        return variable.copy(compute_value=ReplaceUnknowns(variable, default))\n\n    def copy(self):\n        return Default(self.default)\n\n\nclass ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            column = np.array([float(data[self.variable])])\n        else:\n            column = np.array(data.get_column_view(self.variable)[0],\n                              copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if isinstance(data, Orange.data.Instance):\n            predicted = self.model(data)\n        else:\n            predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column\n\n\nclass Model(BaseImputeMethod):\n    _name = \"Model-based imputer\"\n    short_name = \"model\"\n    description = \"\"\n    format = BaseImputeMethod.format + \" ({self.learner.name})\"\n    @property\n    def name(self):\n        return \"{} ({})\".format(self._name, getattr(self.learner, 'name', ''))\n\n    def __init__(self, learner):\n        self.learner = learner\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        domain = domain_with_class_var(data.domain, variable)\n\n        if self.learner.check_learner_adequacy(domain):\n            data = data.transform(domain)\n            model = self.learner(data)\n            assert model.domain.class_var == variable\n            return variable.copy(\n                compute_value=ReplaceUnknownsModel(variable, model))\n        else:\n            raise ValueError(\"`{}` doesn't support domain type\"\n                             .format(self.learner.name))\n\n    def copy(self):\n        return Model(self.learner)\n\n    def supports_variable(self, variable):\n        domain = Orange.data.Domain([], class_vars=variable)\n        return self.learner.check_learner_adequacy(domain)\n\n\ndef domain_with_class_var(domain, class_var):\n    \"\"\"\n    Return a domain with class_var as output domain.class_var.\n\n    If class_var is in the input domain's attributes it is removed from the\n    output's domain.attributes.\n    \"\"\"\n    if domain.class_var is class_var:\n        return domain\n    elif class_var in domain.attributes:\n        attrs = [var for var in domain.attributes\n                 if var is not class_var]\n    else:\n        attrs = domain.attributes\n    return Orange.data.Domain(attrs, class_var)\n\n\nclass IsDefined(Transformation):\n    def transform(self, c):\n        if sp.issparse(c):\n            c = c.toarray()\n        return ~np.isnan(c)\n\n\nclass AsValue(BaseImputeMethod):\n    name = \"As a distinct value\"\n    short_name = \"new value\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        if variable.is_discrete:\n            fmt = \"{var.name}\"\n            value = \"N/A\"\n            var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=variable.values + (value, ),\n                compute_value=Lookup(\n                    variable,\n                    np.arange(len(variable.values), dtype=int),\n                    unknown=len(variable.values)),\n                sparse=variable.sparse,\n                )\n            return var\n\n        elif variable.is_continuous:\n            fmt = \"{var.name}_def\"\n            indicator_var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=(\"undef\", \"def\"),\n                compute_value=IsDefined(variable),\n                sparse=variable.sparse,\n            )\n            stats = basic_stats.BasicStats(data, variable)\n            return (variable.copy(compute_value=ReplaceUnknowns(variable,\n                                                                stats.mean)),\n                    indicator_var)\n        else:\n            raise TypeError(type(variable))\n\n\nclass ReplaceUnknownsRandom(Transformation):\n    \"\"\"\n    A column transformation replacing unknowns with values drawn randomly from\n    an empirical distribution.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    distribution : Orange.statistics.distribution.Distribution\n        The corresponding sampling distribution\n    \"\"\"\n    def __init__(self, variable, distribution):\n        assert distribution.size > 0\n        assert distribution.variable == variable\n        super().__init__(variable)\n        self.distribution = distribution\n\n        if variable.is_discrete:\n            counts = np.array(distribution)\n        elif variable.is_continuous:\n            counts = np.array(distribution)[1, :]\n        else:\n            raise TypeError(\"Only discrete and continuous \"\n                            \"variables are supported\")\n        csum = np.sum(counts)\n        if csum > 0:\n            self.sample_prob = counts / csum\n        else:\n            self.sample_prob = np.ones_like(counts) / len(counts)\n\n    def transform(self, c):\n        if not sp.issparse(c):\n            c = np.array(c, copy=True)\n        else:\n            c = c.toarray().ravel()\n        nanindices = np.flatnonzero(np.isnan(c))\n\n        if self.variable.is_discrete:\n            sample = np.random.choice(\n                len(self.variable.values), size=len(nanindices),\n                replace=True, p=self.sample_prob)\n        else:\n            sample = np.random.choice(\n                np.asarray(self.distribution)[0, :], size=len(nanindices),\n                replace=True, p=self.sample_prob)\n\n        c[nanindices] = sample\n        return c\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.distribution == other.distribution\n\n    def __hash__(self):\n        return hash((type(self), self.variable, self.distribution))\n\n\nclass Random(BaseImputeMethod):\n    name = \"Random values\"\n    short_name = \"random\"\n    description = \"Replace with a random value\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        dist = distribution.get_distribution(data, variable)\n        # A distribution is invalid if a continuous variable's column does not\n        # contain any known values or if a discrete variable's .values == []\n        isinvalid = dist.size == 0\n        if isinvalid and variable.is_discrete:\n            assert len(variable.values) == 0\n            raise ValueError(\"'{}' has no values\".format(variable))\n        elif isinvalid and variable.is_continuous:\n            raise ValueError(\"'{}' has an unknown distribution\"\n                             .format(variable))\n\n        if variable.is_discrete and np.sum(dist) == 0:\n            dist += 1 / len(dist)\n        elif variable.is_continuous and np.sum(dist[1, :]) == 0:\n            dist[1, :] += 1 / dist.shape[1]\n        return variable.copy(\n            compute_value=ReplaceUnknownsRandom(variable, dist))\n",
            "new_file_content": "import numpy as np\nimport scipy.sparse as sp\n\nimport Orange.data\nfrom Orange.statistics import distribution, basic_stats\nfrom Orange.util import Reprable\nfrom .transformation import Transformation, Lookup\n\n__all__ = [\"ReplaceUnknowns\", \"Average\", \"DoNotImpute\", \"DropInstances\",\n           \"Model\", \"AsValue\", \"Random\", \"Default\"]\n\n\nclass ReplaceUnknowns(Transformation):\n    \"\"\"\n    A column transformation which replaces unknown values with a fixed `value`.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    value : int or float\n        The value with which to replace the unknown values\n    \"\"\"\n    def __init__(self, variable, value=0):\n        super().__init__(variable)\n        self.value = value\n\n    def transform(self, c):\n        if sp.issparse(c):\n            c.data = np.where(np.isnan(c.data), self.value, c.data)\n            return c\n        else:\n            return np.where(np.isnan(c), self.value, c)\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.value == other.value\n\n    def __hash__(self):\n        return hash((type(self), self.variable, float(self.value)))\n\n\nclass BaseImputeMethod(Reprable):\n    name = \"\"\n    short_name = \"\"\n    description = \"\"\n    format = \"{var.name} -> {self.short_name}\"\n    columns_only = False\n\n    def __call__(self, data, variable):\n        \"\"\" Imputes table along variable column.\n\n        Args:\n            data (Table): A table to impute.\n            variable (Variable): Variable for completing missing values.\n\n        Returns:\n            A new Variable instance with completed missing values or\n            a array mask of rows to drop out.\n        \"\"\"\n        raise NotImplementedError\n\n    def format_variable(self, var):\n        return self.format.format(var=var, self=self)\n\n    def __str__(self):\n        return self.name\n\n    def copy(self):\n        return self\n\n    @classmethod\n    def supports_variable(cls, variable):\n        return True\n\n\nclass DoNotImpute(BaseImputeMethod):\n    name = \"Don't impute\"\n    short_name = \"leave\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        return variable\n\n\nclass DropInstances(BaseImputeMethod):\n    name = \"Remove instances with unknown values\"\n    short_name = \"drop\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        col, _ = data.get_column_view(variable)\n        return np.isnan(col)\n\n\nclass Average(BaseImputeMethod):\n    name = \"Average/Most frequent\"\n    short_name = \"average\"\n    description = \"Replace with average/mode of the column\"\n\n    def __call__(self, data, variable, value=None):\n        variable = data.domain[variable]\n        if value is None:\n            if variable.is_continuous:\n                stats = basic_stats.BasicStats(data, variable)\n                value = stats.mean\n            elif variable.is_discrete:\n                dist = distribution.get_distribution(data, variable)\n                value = dist.modus()\n            else:\n                raise TypeError(\"Variable must be continuous or discrete\")\n\n        a = variable.copy(compute_value=ReplaceUnknowns(variable, value))\n        a.to_sql = ImputeSql(variable, value)\n        return a\n\n\nclass ImputeSql(Reprable):\n    def __init__(self, var, default):\n        self.var = var\n        self.default = default\n\n    def __call__(self):\n        return 'coalesce(%s, %s)' % (self.var.to_sql(), str(self.default))\n\n\nclass Default(BaseImputeMethod):\n    name = \"Value\"\n    short_name = \"value\"\n    description = \"\"\n    columns_only = True\n    format = '{var} -> {self.default}'\n\n    def __init__(self, default=0):\n        self.default = default\n\n    def __call__(self, data, variable, *, default=None):\n        variable = data.domain[variable]\n        default = default if default is not None else self.default\n        return variable.copy(compute_value=ReplaceUnknowns(variable, default))\n\n    def copy(self):\n        return Default(self.default)\n\n\nclass ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            data = Orange.data.Table.from_list(data.domain, [data])\n        domain = data.domain\n        column = np.array(data.get_column_view(self.variable)[0], copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if domain.class_vars:\n            # cannot have class var in domain (due to backmappers in model)\n            data = data.transform(\n                Orange.data.Domain(domain.attributes, None, domain.metas)\n            )\n        predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column\n\n\nclass Model(BaseImputeMethod):\n    _name = \"Model-based imputer\"\n    short_name = \"model\"\n    description = \"\"\n    format = BaseImputeMethod.format + \" ({self.learner.name})\"\n    @property\n    def name(self):\n        return \"{} ({})\".format(self._name, getattr(self.learner, 'name', ''))\n\n    def __init__(self, learner):\n        self.learner = learner\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        domain = domain_with_class_var(data.domain, variable)\n\n        if self.learner.check_learner_adequacy(domain):\n            data = data.transform(domain)\n            model = self.learner(data)\n            assert model.domain.class_var == variable\n            return variable.copy(\n                compute_value=ReplaceUnknownsModel(variable, model))\n        else:\n            raise ValueError(\"`{}` doesn't support domain type\"\n                             .format(self.learner.name))\n\n    def copy(self):\n        return Model(self.learner)\n\n    def supports_variable(self, variable):\n        domain = Orange.data.Domain([], class_vars=variable)\n        return self.learner.check_learner_adequacy(domain)\n\n\ndef domain_with_class_var(domain, class_var):\n    \"\"\"\n    Return a domain with class_var as output domain.class_var.\n\n    If class_var is in the input domain's attributes it is removed from the\n    output's domain.attributes.\n    \"\"\"\n    if domain.class_var is class_var:\n        return domain\n    elif class_var in domain.attributes:\n        attrs = [var for var in domain.attributes\n                 if var is not class_var]\n    else:\n        attrs = domain.attributes\n    return Orange.data.Domain(attrs, class_var)\n\n\nclass IsDefined(Transformation):\n    def transform(self, c):\n        if sp.issparse(c):\n            c = c.toarray()\n        return ~np.isnan(c)\n\n\nclass AsValue(BaseImputeMethod):\n    name = \"As a distinct value\"\n    short_name = \"new value\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        if variable.is_discrete:\n            fmt = \"{var.name}\"\n            value = \"N/A\"\n            var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=variable.values + (value, ),\n                compute_value=Lookup(\n                    variable,\n                    np.arange(len(variable.values), dtype=int),\n                    unknown=len(variable.values)),\n                sparse=variable.sparse,\n                )\n            return var\n\n        elif variable.is_continuous:\n            fmt = \"{var.name}_def\"\n            indicator_var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=(\"undef\", \"def\"),\n                compute_value=IsDefined(variable),\n                sparse=variable.sparse,\n            )\n            stats = basic_stats.BasicStats(data, variable)\n            return (variable.copy(compute_value=ReplaceUnknowns(variable,\n                                                                stats.mean)),\n                    indicator_var)\n        else:\n            raise TypeError(type(variable))\n\n\nclass ReplaceUnknownsRandom(Transformation):\n    \"\"\"\n    A column transformation replacing unknowns with values drawn randomly from\n    an empirical distribution.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    distribution : Orange.statistics.distribution.Distribution\n        The corresponding sampling distribution\n    \"\"\"\n    def __init__(self, variable, distribution):\n        assert distribution.size > 0\n        assert distribution.variable == variable\n        super().__init__(variable)\n        self.distribution = distribution\n\n        if variable.is_discrete:\n            counts = np.array(distribution)\n        elif variable.is_continuous:\n            counts = np.array(distribution)[1, :]\n        else:\n            raise TypeError(\"Only discrete and continuous \"\n                            \"variables are supported\")\n        csum = np.sum(counts)\n        if csum > 0:\n            self.sample_prob = counts / csum\n        else:\n            self.sample_prob = np.ones_like(counts) / len(counts)\n\n    def transform(self, c):\n        if not sp.issparse(c):\n            c = np.array(c, copy=True)\n        else:\n            c = c.toarray().ravel()\n        nanindices = np.flatnonzero(np.isnan(c))\n\n        if self.variable.is_discrete:\n            sample = np.random.choice(\n                len(self.variable.values), size=len(nanindices),\n                replace=True, p=self.sample_prob)\n        else:\n            sample = np.random.choice(\n                np.asarray(self.distribution)[0, :], size=len(nanindices),\n                replace=True, p=self.sample_prob)\n\n        c[nanindices] = sample\n        return c\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.distribution == other.distribution\n\n    def __hash__(self):\n        return hash((type(self), self.variable, self.distribution))\n\n\nclass Random(BaseImputeMethod):\n    name = \"Random values\"\n    short_name = \"random\"\n    description = \"Replace with a random value\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        dist = distribution.get_distribution(data, variable)\n        # A distribution is invalid if a continuous variable's column does not\n        # contain any known values or if a discrete variable's .values == []\n        isinvalid = dist.size == 0\n        if isinvalid and variable.is_discrete:\n            assert len(variable.values) == 0\n            raise ValueError(\"'{}' has no values\".format(variable))\n        elif isinvalid and variable.is_continuous:\n            raise ValueError(\"'{}' has an unknown distribution\"\n                             .format(variable))\n\n        if variable.is_discrete and np.sum(dist) == 0:\n            dist += 1 / len(dist)\n        elif variable.is_continuous and np.sum(dist[1, :]) == 0:\n            dist[1, :] += 1 / dist.shape[1]\n        return variable.copy(\n            compute_value=ReplaceUnknownsRandom(variable, dist))\n",
            "header": {
                "file": {
                    "path": "Orange/preprocess/impute.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "ee9e4fc50",
                "new_commit_hash": "d774247f2",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/preprocess/impute.py"
            },
            "plus_file": {
                "path": "b/Orange/preprocess/impute.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 160,
                            "length": 19
                        },
                        "new_range": {
                            "start": 160,
                            "length": 20
                        },
                        "section": "class ReplaceUnknownsModel(Reprable):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __call__(self, data):",
                                "type": "context"
                            },
                            {
                                "content": "        if isinstance(data, Orange.data.Instance):",
                                "type": "context"
                            },
                            {
                                "content": "            column = np.array([float(data[self.variable])])",
                                "type": "deleted"
                            },
                            {
                                "content": "        else:",
                                "type": "deleted"
                            },
                            {
                                "content": "            column = np.array(data.get_column_view(self.variable)[0],",
                                "type": "deleted"
                            },
                            {
                                "content": "                              copy=True)",
                                "type": "deleted"
                            },
                            {
                                "content": "            data = Orange.data.Table.from_list(data.domain, [data])",
                                "type": "added"
                            },
                            {
                                "content": "        domain = data.domain",
                                "type": "added"
                            },
                            {
                                "content": "        column = np.array(data.get_column_view(self.variable)[0], copy=True)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        mask = np.isnan(column)",
                                "type": "context"
                            },
                            {
                                "content": "        if not np.any(mask):",
                                "type": "context"
                            },
                            {
                                "content": "            return column",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        if isinstance(data, Orange.data.Instance):",
                                "type": "deleted"
                            },
                            {
                                "content": "            predicted = self.model(data)",
                                "type": "deleted"
                            },
                            {
                                "content": "        else:",
                                "type": "deleted"
                            },
                            {
                                "content": "            predicted = self.model(data[mask])",
                                "type": "deleted"
                            },
                            {
                                "content": "        if domain.class_vars:",
                                "type": "added"
                            },
                            {
                                "content": "            # cannot have class var in domain (due to backmappers in model)",
                                "type": "added"
                            },
                            {
                                "content": "            data = data.transform(",
                                "type": "added"
                            },
                            {
                                "content": "                Orange.data.Domain(domain.attributes, None, domain.metas)",
                                "type": "added"
                            },
                            {
                                "content": "            )",
                                "type": "added"
                            },
                            {
                                "content": "        predicted = self.model(data[mask])",
                                "type": "added"
                            },
                            {
                                "content": "        column[mask] = predicted",
                                "type": "context"
                            },
                            {
                                "content": "        return column",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/preprocess/impute.py",
                            "type": "class",
                            "name": "ReplaceUnknownsModel",
                            "content": "class ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            column = np.array([float(data[self.variable])])\n        else:\n            column = np.array(data.get_column_view(self.variable)[0],\n                              copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if isinstance(data, Orange.data.Instance):\n            predicted = self.model(data)\n        else:\n            predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 145,
                            "end_lineno": 177,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/preprocess/impute.py",
                            "type": "method",
                            "name": "ReplaceUnknownsModel.__call__",
                            "content": "class ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            column = np.array([float(data[self.variable])])\n        else:\n            column = np.array(data.get_column_view(self.variable)[0],\n                              copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if isinstance(data, Orange.data.Instance):\n            predicted = self.model(data)\n        else:\n            predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 161,
                            "end_lineno": 177,
                            "parent": {
                                "file_name": "Orange/preprocess/impute.py",
                                "type": "class",
                                "name": "ReplaceUnknownsModel",
                                "content": "class ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            column = np.array([float(data[self.variable])])\n        else:\n            column = np.array(data.get_column_view(self.variable)[0],\n                              copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if isinstance(data, Orange.data.Instance):\n            predicted = self.model(data)\n        else:\n            predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 145,
                                "end_lineno": 177,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom functools import reduce\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange import preprocess\nfrom Orange.preprocess import impute\nfrom Orange import data\nfrom Orange.data import Unknown, Table\n\nfrom Orange.classification import MajorityLearner, SimpleTreeLearner\nfrom Orange.regression import MeanLearner\nfrom Orange.tests import test_filename\n\n\nclass TestReplaceUnknowns(unittest.TestCase):\n    def test_replacement(self):\n        a = np.arange(10, dtype=float)\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None).transform(a)\n        np.testing.assert_equal(ia, [0, 0, 2, 3, 4, 0, 6, 7, 8, 9])\n\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None, value=42).transform(a)\n        np.testing.assert_equal(ia, [0, 42, 2, 3, 4, 42, 6, 7, 8, 9])\n\n    def test_sparse(self):\n        m = sp.csr_matrix(np.eye(10))\n        rm = preprocess.ReplaceUnknowns(None, value=42).transform(m)\n        self.assertEqual((m != rm).nnz, 0)\n\n    def test_sparse_nans(self):\n        \"\"\"\n        Remove nans from sparse matrix.\n        GH-2295\n        GH-2178\n        \"\"\"\n        m = sp.csr_matrix(np.ones((3, 3)))\n        m[0, :] = np.nan\n        self.assertTrue(np.isnan(m.data).any())\n        preprocess.ReplaceUnknowns(None, value=42.).transform(m)\n        self.assertFalse(np.isnan(m.data).any())\n\n\nclass TestDropInstances(unittest.TestCase):\n    def test_drop(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        drop = impute.DropInstances()\n        ind = drop(table, table.domain[1])\n        self.assertEqual(list(ind), [False, False, False, True, True])\n\n\nclass TestDoNotImpute(unittest.TestCase):\n    def test_str(self):\n        table = data.Table.from_file(\"iris\")\n        imputer = impute.BaseImputeMethod()\n        var = table.domain[0]\n        self.assertIn(var.name, imputer.format_variable(var))\n        self.assertIn(imputer.short_name, imputer.format_variable(var))\n        self.assertIn(imputer.name, str(imputer))\n\n    def test_copy(self):\n        imputer = impute.BaseImputeMethod()\n        self.assertIs(imputer, imputer.copy())\n\n    def test_call(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        imputer = impute.DoNotImpute()\n        var = imputer(table, table.domain[1])\n        self.assertEqual(var, table.domain[1])\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.DoNotImpute()\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n\nclass TestAverage(unittest.TestCase):\n    def test_replacement(self):\n        s = [0] * 50 + [1] * 50\n        c1 = np.array(s).reshape((100, 1))\n        s = [0] * 5 + [1] * 5 + [2] * 90\n        c2 = np.array(s).reshape((100, 1))\n        x = np.hstack([c1, c2])\n        domain = data.Domain([data.ContinuousVariable(\"a\"),\n                              data.DiscreteVariable(\"b\", values=\"ABC\")],\n                             data.ContinuousVariable(\"c\"),)\n        table = Table(domain, x, c1)\n        for col, computed_value in ((0, 0.5), (1, 2)):\n            var1 = preprocess.Average()(table, col)\n            self.assertIsInstance(var1.compute_value, preprocess.ReplaceUnknowns)\n            self.assertEqual(var1.compute_value.value, computed_value)\n\n\nclass TestDefault(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n\n        table = Table.from_numpy(None, np.array(X))\n        var1 = impute.Default(0.0)(table, 0)\n        self.assertTrue(np.all(np.isfinite(var1.compute_value(table))))\n        self.assertTrue(all(var1.compute_value(table) == [1.0, 2.0, 0.0]))\n\n        imputer = preprocess.Impute(method=impute.Default(42))\n        idata = imputer(table)\n        np.testing.assert_allclose(\n            idata.X,\n            [[1.0, 42., 0.0],\n             [2.0, 1.0, 3.0],\n             [42., 42., 42.]])\n\n    def test_default(self):\n        nan = np.nan\n        X = [[nan, 0.0],\n             [1.0, 3.0],\n             [nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"B\", values=(\"a\", \"b\", \"c\")),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v2 = impute.Default(42)(table, domain[\"C\"])\n        self.assertEqual(v2.compute_value.value, 42)\n\n        v3 = impute.Default()(table, domain[\"C\"], default=42)\n        self.assertEqual(v3.compute_value.value, 42)\n\n    def test_copy(self):\n        imputer = impute.Default(1)\n        copied = imputer.copy()\n        imputer.default = 2\n        self.assertEqual(copied.default, 1)\n\n    def test_str(self):\n        imputer = impute.Default(1)\n        self.assertIn('1', imputer.format_variable(data.Variable(\"y\")))\n\n\nclass TestAsValue(unittest.TestCase):\n    def _create_table(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        return data.Table.from_numpy(domain, np.array(X))\n\n    def test_replacement(self):\n        table = self._create_table()\n        domain = table.domain\n\n        v1 = impute.AsValue()(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(v1.compute_value(table) == [1., 2., 3.]))\n        self.assertEqual([v1.str_val(v) for v in v1.compute_value(table)],\n                         [\"1\", \"2\", \"N/A\"])\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertTrue(np.all(v2.compute_value(table) == [0., 1., 0.]))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n        vars = reduce(lambda acc, v:\n                      acc + (list(v) if isinstance(v, (tuple, list))\n                             else [v]),\n                      [impute.AsValue()(table, var) for var in table.domain.variables],\n                      [])\n        domain = data.Domain(vars)\n        idata = table.from_table(domain, table)\n\n        np.testing.assert_allclose(\n            idata.X,\n            [[1, 1.0, 0, 0.0, 1],\n             [2, 1.0, 1, 3.0, 1],\n             [3, 1.0, 0, 1.5, 0]]\n        )\n\n    def test_sparse(self):\n        \"\"\"\n        Impute: As a distinct value test. Sparse support.\n        GH-2357\n        \"\"\"\n        table = self._create_table()\n        domain = table.domain\n        table.X = sp.csr_matrix(table.X)\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n\nclass TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])\n\n\nclass TestRandom(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        for i in range(0, 3):\n            v = impute.Random()(table, domain[i])\n            self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n\n        imputer = preprocess.Impute(method=impute.Random())\n        itable = imputer(table)\n        self.assertTrue(np.all(np.isfinite(itable.X)))\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(unknowns == np.isnan(table.X)))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n\nclass TestImputer(unittest.TestCase):\n    def test_imputer(self):\n        auto = data.Table(test_filename('datasets/imports-85.tab'))\n        auto2 = preprocess.Impute()(auto)\n        self.assertFalse(np.isnan(auto2.X).any())\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom functools import reduce\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange import preprocess\nfrom Orange.preprocess import impute\nfrom Orange import data\nfrom Orange.data import Unknown, Table\n\nfrom Orange.classification import MajorityLearner, SimpleTreeLearner\nfrom Orange.regression import MeanLearner\nfrom Orange.tests import test_filename\n\n\nclass TestReplaceUnknowns(unittest.TestCase):\n    def test_replacement(self):\n        a = np.arange(10, dtype=float)\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None).transform(a)\n        np.testing.assert_equal(ia, [0, 0, 2, 3, 4, 0, 6, 7, 8, 9])\n\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None, value=42).transform(a)\n        np.testing.assert_equal(ia, [0, 42, 2, 3, 4, 42, 6, 7, 8, 9])\n\n    def test_sparse(self):\n        m = sp.csr_matrix(np.eye(10))\n        rm = preprocess.ReplaceUnknowns(None, value=42).transform(m)\n        self.assertEqual((m != rm).nnz, 0)\n\n    def test_sparse_nans(self):\n        \"\"\"\n        Remove nans from sparse matrix.\n        GH-2295\n        GH-2178\n        \"\"\"\n        m = sp.csr_matrix(np.ones((3, 3)))\n        m[0, :] = np.nan\n        self.assertTrue(np.isnan(m.data).any())\n        preprocess.ReplaceUnknowns(None, value=42.).transform(m)\n        self.assertFalse(np.isnan(m.data).any())\n\n\nclass TestDropInstances(unittest.TestCase):\n    def test_drop(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        drop = impute.DropInstances()\n        ind = drop(table, table.domain[1])\n        self.assertEqual(list(ind), [False, False, False, True, True])\n\n\nclass TestDoNotImpute(unittest.TestCase):\n    def test_str(self):\n        table = data.Table.from_file(\"iris\")\n        imputer = impute.BaseImputeMethod()\n        var = table.domain[0]\n        self.assertIn(var.name, imputer.format_variable(var))\n        self.assertIn(imputer.short_name, imputer.format_variable(var))\n        self.assertIn(imputer.name, str(imputer))\n\n    def test_copy(self):\n        imputer = impute.BaseImputeMethod()\n        self.assertIs(imputer, imputer.copy())\n\n    def test_call(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        imputer = impute.DoNotImpute()\n        var = imputer(table, table.domain[1])\n        self.assertEqual(var, table.domain[1])\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.DoNotImpute()\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n\nclass TestAverage(unittest.TestCase):\n    def test_replacement(self):\n        s = [0] * 50 + [1] * 50\n        c1 = np.array(s).reshape((100, 1))\n        s = [0] * 5 + [1] * 5 + [2] * 90\n        c2 = np.array(s).reshape((100, 1))\n        x = np.hstack([c1, c2])\n        domain = data.Domain([data.ContinuousVariable(\"a\"),\n                              data.DiscreteVariable(\"b\", values=\"ABC\")],\n                             data.ContinuousVariable(\"c\"),)\n        table = Table(domain, x, c1)\n        for col, computed_value in ((0, 0.5), (1, 2)):\n            var1 = preprocess.Average()(table, col)\n            self.assertIsInstance(var1.compute_value, preprocess.ReplaceUnknowns)\n            self.assertEqual(var1.compute_value.value, computed_value)\n\n\nclass TestDefault(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n\n        table = Table.from_numpy(None, np.array(X))\n        var1 = impute.Default(0.0)(table, 0)\n        self.assertTrue(np.all(np.isfinite(var1.compute_value(table))))\n        self.assertTrue(all(var1.compute_value(table) == [1.0, 2.0, 0.0]))\n\n        imputer = preprocess.Impute(method=impute.Default(42))\n        idata = imputer(table)\n        np.testing.assert_allclose(\n            idata.X,\n            [[1.0, 42., 0.0],\n             [2.0, 1.0, 3.0],\n             [42., 42., 42.]])\n\n    def test_default(self):\n        nan = np.nan\n        X = [[nan, 0.0],\n             [1.0, 3.0],\n             [nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"B\", values=(\"a\", \"b\", \"c\")),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v2 = impute.Default(42)(table, domain[\"C\"])\n        self.assertEqual(v2.compute_value.value, 42)\n\n        v3 = impute.Default()(table, domain[\"C\"], default=42)\n        self.assertEqual(v3.compute_value.value, 42)\n\n    def test_copy(self):\n        imputer = impute.Default(1)\n        copied = imputer.copy()\n        imputer.default = 2\n        self.assertEqual(copied.default, 1)\n\n    def test_str(self):\n        imputer = impute.Default(1)\n        self.assertIn('1', imputer.format_variable(data.Variable(\"y\")))\n\n\nclass TestAsValue(unittest.TestCase):\n    def _create_table(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        return data.Table.from_numpy(domain, np.array(X))\n\n    def test_replacement(self):\n        table = self._create_table()\n        domain = table.domain\n\n        v1 = impute.AsValue()(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(v1.compute_value(table) == [1., 2., 3.]))\n        self.assertEqual([v1.str_val(v) for v in v1.compute_value(table)],\n                         [\"1\", \"2\", \"N/A\"])\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertTrue(np.all(v2.compute_value(table) == [0., 1., 0.]))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n        vars = reduce(lambda acc, v:\n                      acc + (list(v) if isinstance(v, (tuple, list))\n                             else [v]),\n                      [impute.AsValue()(table, var) for var in table.domain.variables],\n                      [])\n        domain = data.Domain(vars)\n        idata = table.from_table(domain, table)\n\n        np.testing.assert_allclose(\n            idata.X,\n            [[1, 1.0, 0, 0.0, 1],\n             [2, 1.0, 1, 3.0, 1],\n             [3, 1.0, 0, 1.5, 0]]\n        )\n\n    def test_sparse(self):\n        \"\"\"\n        Impute: As a distinct value test. Sparse support.\n        GH-2357\n        \"\"\"\n        table = self._create_table()\n        domain = table.domain\n        table.X = sp.csr_matrix(table.X)\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n\nclass TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\")),\n            # the class is here to ensure the backmapper in model does not\n            # run and raise exception\n            data.DiscreteVariable(\"Z\", values=(\"P\", \"M\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X), [0,] * 3)\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])\n\n\nclass TestRandom(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        for i in range(0, 3):\n            v = impute.Random()(table, domain[i])\n            self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n\n        imputer = preprocess.Impute(method=impute.Random())\n        itable = imputer(table)\n        self.assertTrue(np.all(np.isfinite(itable.X)))\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(unknowns == np.isnan(table.X)))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n\nclass TestImputer(unittest.TestCase):\n    def test_imputer(self):\n        auto = data.Table(test_filename('datasets/imports-85.tab'))\n        auto2 = preprocess.Impute()(auto)\n        self.assertFalse(np.isnan(auto2.X).any())\n",
            "header": {
                "file": {
                    "path": "Orange/tests/test_impute.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "4dd6ff1d5",
                "new_commit_hash": "3b3ec9be3",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/tests/test_impute.py"
            },
            "plus_file": {
                "path": "b/Orange/tests/test_impute.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 229,
                            "length": 9
                        },
                        "new_range": {
                            "start": 229,
                            "length": 12
                        },
                        "section": "class TestModel(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        domain = data.Domain(",
                                "type": "context"
                            },
                            {
                                "content": "            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),",
                                "type": "context"
                            },
                            {
                                "content": "             data.ContinuousVariable(\"B\"),",
                                "type": "context"
                            },
                            {
                                "content": "             data.ContinuousVariable(\"C\"))",
                                "type": "deleted"
                            },
                            {
                                "content": "             data.ContinuousVariable(\"C\")),",
                                "type": "added"
                            },
                            {
                                "content": "            # the class is here to ensure the backmapper in model does not",
                                "type": "added"
                            },
                            {
                                "content": "            # run and raise exception",
                                "type": "added"
                            },
                            {
                                "content": "            data.DiscreteVariable(\"Z\", values=(\"P\", \"M\"))",
                                "type": "added"
                            },
                            {
                                "content": "        )",
                                "type": "context"
                            },
                            {
                                "content": "        table = data.Table.from_numpy(domain, np.array(X))",
                                "type": "deleted"
                            },
                            {
                                "content": "        table = data.Table.from_numpy(domain, np.array(X), [0,] * 3)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        v = impute.Model(MajorityLearner())(table, domain[0])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/tests/test_impute.py",
                            "type": "method",
                            "name": "TestModel.test_replacement",
                            "content": "class TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 220,
                            "end_lineno": 260,
                            "parent": {
                                "file_name": "Orange/tests/test_impute.py",
                                "type": "class",
                                "name": "TestModel",
                                "content": "class TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 219,
                                "end_lineno": 290,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/tests/test_impute.py",
                            "type": "class",
                            "name": "TestModel",
                            "content": "class TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 219,
                            "end_lineno": 290,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "d061f534144f633583f6c7b59fec1d401ebd22fa^",
    "new_commit_hash": "d061f534144f633583f6c7b59fec1d401ebd22fa",
    "commit_message": "impute: Remove class vars from input data for ReplaceUnknownsModel\n\n`ReplaceUnknownsModel` did not work on input dataset with `class_vars`\nsince gh-3925 due to error raised by backmapping.",
    "commit_date": "2020-11-11T14:30:51+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "d061f534144f633583f6c7b59fec1d401ebd22fa",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom functools import reduce\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom Orange import preprocess\nfrom Orange.preprocess import impute\nfrom Orange import data\nfrom Orange.data import Unknown, Table\n\nfrom Orange.classification import MajorityLearner, SimpleTreeLearner\nfrom Orange.regression import MeanLearner\nfrom Orange.tests import test_filename\n\n\nclass TestReplaceUnknowns(unittest.TestCase):\n    def test_replacement(self):\n        a = np.arange(10, dtype=float)\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None).transform(a)\n        np.testing.assert_equal(ia, [0, 0, 2, 3, 4, 0, 6, 7, 8, 9])\n\n        a[1] = a[5] = Unknown\n        ia = preprocess.ReplaceUnknowns(None, value=42).transform(a)\n        np.testing.assert_equal(ia, [0, 42, 2, 3, 4, 42, 6, 7, 8, 9])\n\n    def test_sparse(self):\n        m = sp.csr_matrix(np.eye(10))\n        rm = preprocess.ReplaceUnknowns(None, value=42).transform(m)\n        self.assertEqual((m != rm).nnz, 0)\n\n    def test_sparse_nans(self):\n        \"\"\"\n        Remove nans from sparse matrix.\n        GH-2295\n        GH-2178\n        \"\"\"\n        m = sp.csr_matrix(np.ones((3, 3)))\n        m[0, :] = np.nan\n        self.assertTrue(np.isnan(m.data).any())\n        preprocess.ReplaceUnknowns(None, value=42.).transform(m)\n        self.assertFalse(np.isnan(m.data).any())\n\n\nclass TestDropInstances(unittest.TestCase):\n    def test_drop(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        drop = impute.DropInstances()\n        ind = drop(table, table.domain[1])\n        self.assertEqual(list(ind), [False, False, False, True, True])\n\n\nclass TestDoNotImpute(unittest.TestCase):\n    def test_str(self):\n        table = data.Table.from_file(\"iris\")\n        imputer = impute.BaseImputeMethod()\n        var = table.domain[0]\n        self.assertIn(var.name, imputer.format_variable(var))\n        self.assertIn(imputer.short_name, imputer.format_variable(var))\n        self.assertIn(imputer.name, str(imputer))\n\n    def test_copy(self):\n        imputer = impute.BaseImputeMethod()\n        self.assertIs(imputer, imputer.copy())\n\n    def test_call(self):\n        X = np.random.rand(5, 3)\n        X[3:5, 1] = np.nan\n        table = data.Table.from_numpy(None, X)\n        imputer = impute.DoNotImpute()\n        var = imputer(table, table.domain[1])\n        self.assertEqual(var, table.domain[1])\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.DoNotImpute()\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n\nclass TestAverage(unittest.TestCase):\n    def test_replacement(self):\n        s = [0] * 50 + [1] * 50\n        c1 = np.array(s).reshape((100, 1))\n        s = [0] * 5 + [1] * 5 + [2] * 90\n        c2 = np.array(s).reshape((100, 1))\n        x = np.hstack([c1, c2])\n        domain = data.Domain([data.ContinuousVariable(\"a\"),\n                              data.DiscreteVariable(\"b\", values=\"ABC\")],\n                             data.ContinuousVariable(\"c\"),)\n        table = Table(domain, x, c1)\n        for col, computed_value in ((0, 0.5), (1, 2)):\n            var1 = preprocess.Average()(table, col)\n            self.assertIsInstance(var1.compute_value, preprocess.ReplaceUnknowns)\n            self.assertEqual(var1.compute_value.value, computed_value)\n\n\nclass TestDefault(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n\n        table = Table.from_numpy(None, np.array(X))\n        var1 = impute.Default(0.0)(table, 0)\n        self.assertTrue(np.all(np.isfinite(var1.compute_value(table))))\n        self.assertTrue(all(var1.compute_value(table) == [1.0, 2.0, 0.0]))\n\n        imputer = preprocess.Impute(method=impute.Default(42))\n        idata = imputer(table)\n        np.testing.assert_allclose(\n            idata.X,\n            [[1.0, 42., 0.0],\n             [2.0, 1.0, 3.0],\n             [42., 42., 42.]])\n\n    def test_default(self):\n        nan = np.nan\n        X = [[nan, 0.0],\n             [1.0, 3.0],\n             [nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"B\", values=(\"a\", \"b\", \"c\")),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        v2 = impute.Default(42)(table, domain[\"C\"])\n        self.assertEqual(v2.compute_value.value, 42)\n\n        v3 = impute.Default()(table, domain[\"C\"], default=42)\n        self.assertEqual(v3.compute_value.value, 42)\n\n    def test_copy(self):\n        imputer = impute.Default(1)\n        copied = imputer.copy()\n        imputer.default = 2\n        self.assertEqual(copied.default, 1)\n\n    def test_str(self):\n        imputer = impute.Default(1)\n        self.assertIn('1', imputer.format_variable(data.Variable(\"y\")))\n\n\nclass TestAsValue(unittest.TestCase):\n    def _create_table(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        return data.Table.from_numpy(domain, np.array(X))\n\n    def test_replacement(self):\n        table = self._create_table()\n        domain = table.domain\n\n        v1 = impute.AsValue()(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(v1.compute_value(table) == [1., 2., 3.]))\n        self.assertEqual([v1.str_val(v) for v in v1.compute_value(table)],\n                         [\"1\", \"2\", \"N/A\"])\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v1.compute_value(table))))\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertTrue(np.all(v2.compute_value(table) == [0., 1., 0.]))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n        vars = reduce(lambda acc, v:\n                      acc + (list(v) if isinstance(v, (tuple, list))\n                             else [v]),\n                      [impute.AsValue()(table, var) for var in table.domain.variables],\n                      [])\n        domain = data.Domain(vars)\n        idata = table.from_table(domain, table)\n\n        np.testing.assert_allclose(\n            idata.X,\n            [[1, 1.0, 0, 0.0, 1],\n             [2, 1.0, 1, 3.0, 1],\n             [3, 1.0, 0, 1.5, 0]]\n        )\n\n    def test_sparse(self):\n        \"\"\"\n        Impute: As a distinct value test. Sparse support.\n        GH-2357\n        \"\"\"\n        table = self._create_table()\n        domain = table.domain\n        table.X = sp.csr_matrix(table.X)\n\n        v1, v2 = impute.AsValue()(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v2.compute_value(table))))\n        self.assertEqual([v2.str_val(v) for v in v2.compute_value(table)],\n                         [\"undef\", \"def\", \"undef\"])\n\n\nclass TestModel(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\")),\n            # the class is here to ensure the backmapper in model does not\n            # run and raise exception\n            data.DiscreteVariable(\"Z\", values=(\"P\", \"M\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X), [0,] * 3)\n\n        v = impute.Model(MajorityLearner())(table, domain[0])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 2., 1.]) or\n                        np.all(v.compute_value(table) == [1., 2., 2.]))\n        v = impute.Model(MeanLearner())(table, domain[1])\n        self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n        self.assertTrue(np.all(v.compute_value(table) == [1., 1., 1.]))\n\n        imputer = preprocess.Impute(impute.Model(SimpleTreeLearner()))\n        itable = imputer(table)\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(np.isnan(table.X) == unknowns))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n        Aimp = itable.domain[\"A\"].compute_value\n        self.assertIsInstance(Aimp, impute.ReplaceUnknownsModel)\n\n        col = Aimp(table)\n        self.assertEqual(col.shape, (len(table),))\n        self.assertTrue(np.all(np.isfinite(col)))\n\n        v = Aimp(table[-1])\n        self.assertEqual(v.shape, (1,))\n        self.assertTrue(np.all(np.isfinite(v)))\n\n    def test_copy(self):\n        imputer = impute.Model(MajorityLearner())\n        copied = imputer.copy()\n        imputer.learner = MajorityLearner()\n        self.assertIsNot(copied.learner, imputer.learner)\n\n    def test_support(self):\n        table = data.Table.from_file(\"iris\")\n        continuous = table.domain.variables[0]\n        discrete = table.domain.variables[-1]\n\n        imputer = impute.Model(MajorityLearner())\n        self.assertTrue(imputer.supports_variable(discrete))\n        self.assertFalse(imputer.supports_variable(continuous))\n\n        imputer = impute.Model(MeanLearner())\n        self.assertFalse(imputer.supports_variable(discrete))\n        self.assertTrue(imputer.supports_variable(continuous))\n\n    def test_str(self):\n        imputer = impute.Model(MajorityLearner())\n        self.assertIn(MajorityLearner().name,\n                      imputer.format_variable(data.Variable(\"y\")))\n\n    def test_bad_domain(self):\n        table = data.Table.from_file('iris')\n        imputer = impute.Model(MajorityLearner())\n        self.assertRaises(ValueError, imputer, data=table,\n                          variable=table.domain[0])\n\n\nclass TestRandom(unittest.TestCase):\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n\n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X))\n\n        for i in range(0, 3):\n            v = impute.Random()(table, domain[i])\n            self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n\n        imputer = preprocess.Impute(method=impute.Random())\n        itable = imputer(table)\n        self.assertTrue(np.all(np.isfinite(itable.X)))\n\n        # Original data should keep unknowns\n        self.assertTrue(np.all(unknowns == np.isnan(table.X)))\n        self.assertTrue(np.all(itable.X[~unknowns] == table.X[~unknowns]))\n\n\nclass TestImputer(unittest.TestCase):\n    def test_imputer(self):\n        auto = data.Table(test_filename('datasets/imports-85.tab'))\n        auto2 = preprocess.Impute()(auto)\n        self.assertFalse(np.isnan(auto2.X).any())\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/tmpyw4cdqmh/tmp\ncreating /tmp/tmpyw4cdqmh/tmp/tmpyw4cdqmh\ncompile options: '-MMD -MF /tmp/tmpyw4cdqmh/file.c.d -c'\ncc: /tmp/tmpyw4cdqmh/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/tmp3zjyhe1v/tmp\ncreating /tmp/tmp3zjyhe1v/tmp/tmp3zjyhe1v\ncompile options: '-MMD -MF /tmp/tmp3zjyhe1v/file.c.d -c'\ncc: /tmp/tmp3zjyhe1v/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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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/tmpwnumaj23/tmp\ncreating /tmp/tmpwnumaj23/tmp/tmpwnumaj23\ncompile options: '-MMD -MF /tmp/tmpwnumaj23/file.c.d -c'\ncc: /tmp/tmpwnumaj23/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/tmp9apadodi/tmp\ncreating /tmp/tmp9apadodi/tmp/tmp9apadodi\ncompile options: '-MMD -MF /tmp/tmp9apadodi/file.c.d -c'\ncc: /tmp/tmp9apadodi/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.28.0.dev0+d061f53 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa\nProcessing dependencies for Orange3==3.28.0.dev0+d061f53\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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for httpx==0.14.3\nBest match: httpx 0.14.3\nAdding httpx 0.14.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for chardet==3.0.4\nBest match: chardet 3.0.4\nAdding chardet 3.0.4 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.10.2\nBest match: httpcore 0.10.2\nAdding httpcore 0.10.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nSearching for h11==0.9.0\nBest match: h11 0.9.0\nAdding h11 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.28.0.dev0+d061f53\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 66ms\nPrepared 18 packages in 18ms\nInstalled 18 packages in 112ms\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 53 packages in 333ms\nInstalled 47 packages in 757ms\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==3.0.4\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.9.0\n + httpcore==0.10.2\n + httpx==0.14.3\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 + kiwisolver==1.4.5\n + matplotlib==3.5.3\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 + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\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 + rfc3986==1.5.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 + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 72ms\nInstalled 13 packages in 422ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\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 29ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 6ms\nAudited 2 packages in 2ms\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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:627:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa/.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_d061f534144f633583f6c7b59fec1d401ebd22fa\ncollected 23 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_d061f534144f633583f6c7b59fec1d401ebd22fa/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_d061f534144f633583f6c7b59fec1d401ebd22fa/Orange/tests/__init__.py:65\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_replacement\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_sparse\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_sparse_nans\nPASSED r2e_tests/test_1.py::TestDropInstances::test_drop\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_call\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_copy\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_str\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_support\nPASSED r2e_tests/test_1.py::TestAverage::test_replacement\nPASSED r2e_tests/test_1.py::TestDefault::test_copy\nPASSED r2e_tests/test_1.py::TestDefault::test_default\nPASSED r2e_tests/test_1.py::TestDefault::test_replacement\nPASSED r2e_tests/test_1.py::TestDefault::test_str\nPASSED r2e_tests/test_1.py::TestAsValue::test_replacement\nPASSED r2e_tests/test_1.py::TestAsValue::test_sparse\nPASSED r2e_tests/test_1.py::TestModel::test_bad_domain\nPASSED r2e_tests/test_1.py::TestModel::test_copy\nPASSED r2e_tests/test_1.py::TestModel::test_replacement\nPASSED r2e_tests/test_1.py::TestModel::test_str\nPASSED r2e_tests/test_1.py::TestModel::test_support\nPASSED r2e_tests/test_1.py::TestRandom::test_replacement\nPASSED r2e_tests/test_1.py::TestImputer::test_imputer\nERROR r2e_tests/test_1.py::test_filename\n========================= 22 passed, 1 error in 2.38s ==========================\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_d061f534144f633583f6c7b59fec1d401ebd22fa\ncollected 23 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_d061f534144f633583f6c7b59fec1d401ebd22fa/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_d061f534144f633583f6c7b59fec1d401ebd22fa/Orange/tests/__init__.py:65\n=================================== FAILURES ===================================\n__________________________ TestModel.test_replacement __________________________\n\nself = <r2e_tests.test_1.TestModel testMethod=test_replacement>\n\n    def test_replacement(self):\n        nan = np.nan\n        X = [\n            [1.0, nan, 0.0],\n            [2.0, 1.0, 3.0],\n            [nan, nan, nan]\n        ]\n        unknowns = np.isnan(X)\n    \n        domain = data.Domain(\n            (data.DiscreteVariable(\"A\", values=(\"0\", \"1\", \"2\")),\n             data.ContinuousVariable(\"B\"),\n             data.ContinuousVariable(\"C\")),\n            # the class is here to ensure the backmapper in model does not\n            # run and raise exception\n            data.DiscreteVariable(\"Z\", values=(\"P\", \"M\"))\n        )\n        table = data.Table.from_numpy(domain, np.array(X), [0,] * 3)\n    \n        v = impute.Model(MajorityLearner())(table, domain[0])\n>       self.assertTrue(np.all(np.isfinite(v.compute_value(table))))\n\nr2e_tests/test_1.py:240: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nOrange/preprocess/impute.py:175: in __call__\n    predicted = self.model(data[mask])\nOrange/base.py:437: in __call__\n    backmappers, n_values = self.get_backmappers(data)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = ConstantModel(dist=array([0. , 0.5, 0.5]), unif_maj=1)\ndata = [[?, ?, ? | P]\n]\n\n    def get_backmappers(self, data):\n        backmappers = []\n        n_values = []\n    \n        dataclasses = data.domain.class_vars\n        modelclasses = self.domain.class_vars\n        if not (modelclasses and dataclasses):\n            return None, []  # classless model or data; don't touch\n        if len(dataclasses) != len(modelclasses):\n            raise DomainTransformationError(\n                \"Mismatching number of model's classes and data classes\")\n        for dataclass, modelclass in zip(dataclasses, modelclasses):\n            if dataclass != modelclass:\n                if dataclass.name != modelclass.name:\n                    raise DomainTransformationError(\n>                       f\"Model for '{modelclass.name}' \"\n                        f\"cannot predict '{dataclass.name}'\")\nE                   Orange.data.table.DomainTransformationError: Model for 'A' cannot predict 'Z'\n\nOrange/base.py:248: DomainTransformationError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_replacement\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_sparse\nPASSED r2e_tests/test_1.py::TestReplaceUnknowns::test_sparse_nans\nPASSED r2e_tests/test_1.py::TestDropInstances::test_drop\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_call\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_copy\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_str\nPASSED r2e_tests/test_1.py::TestDoNotImpute::test_support\nPASSED r2e_tests/test_1.py::TestAverage::test_replacement\nPASSED r2e_tests/test_1.py::TestDefault::test_copy\nPASSED r2e_tests/test_1.py::TestDefault::test_default\nPASSED r2e_tests/test_1.py::TestDefault::test_replacement\nPASSED r2e_tests/test_1.py::TestDefault::test_str\nPASSED r2e_tests/test_1.py::TestAsValue::test_replacement\nPASSED r2e_tests/test_1.py::TestAsValue::test_sparse\nPASSED r2e_tests/test_1.py::TestModel::test_bad_domain\nPASSED r2e_tests/test_1.py::TestModel::test_copy\nPASSED r2e_tests/test_1.py::TestModel::test_str\nPASSED r2e_tests/test_1.py::TestModel::test_support\nPASSED r2e_tests/test_1.py::TestRandom::test_replacement\nPASSED r2e_tests/test_1.py::TestImputer::test_imputer\nERROR r2e_tests/test_1.py::test_filename\nFAILED r2e_tests/test_1.py::TestModel::test_replacement - Orange.data.table.D...\n==================== 1 failed, 21 passed, 1 error in 1.73s =====================\n",
    "old_commit_res_stderr": ""
}
Orange/preprocess/impute.py Orange/tests/test_impute.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** ReplaceUnknownsModel Fails with Class Variables in Input Data

**Description:**
When using `ReplaceUnknownsModel` on a dataset that includes class variables, an error is raised due to issues with backmapping. This prevents the model from handling datasets appropriately when class variables are present.

**Example Code:**
```python
import numpy as np
from Orange.data import Domain, DiscreteVariable, ContinuousVariable, Table
from Orange.preprocess.impute import ReplaceUnknownsModel
from Orange.classification import MajorityLearner

# Create a dataset with class variables
domain = Domain(
    [DiscreteVariable("A", values=("0", "1", "2")),
     ContinuousVariable("B"),
     ContinuousVariable("C")],
    class_vars=DiscreteVariable("Z", values=("P", "M"))
)
data = Table.from_numpy(domain, np.array([
    [1.0, np.nan, 0.0,  "P"],
    [2.0, 1.0,      3.0,  "M"],
    [np.nan, np.nan, np.nan, "P"]
]))

# Attempt to impute unknowns
model = ReplaceUnknownsModel(MajorityLearner())
imputed_data = model(data, domain[0])
```

**Expected Behavior:**
`ReplaceUnknownsModel` should successfully impute unknown values in the dataset without raising errors, even when class variables are present. The model should handle or appropriately ignore class variables to perform the imputation.

**Actual Behavior:**
An error is raised indicating a mismatch in class variables:
```
Orange.data.table.DomainTransformationError: Model for 'A' cannot predict 'Z'
```
This error occurs because the presence of class variables interferes with the backmapping process within the model.

[/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/preprocess/impute.py
import numpy as np
import scipy.sparse as sp

import Orange.data
from Orange.statistics import distribution, basic_stats
from Orange.util import Reprable
from .transformation import Transformation, Lookup

__all__ = ["ReplaceUnknowns", "Average", "DoNotImpute", "DropInstances",
           "Model", "AsValue", "Random", "Default"]


class ReplaceUnknowns(Transformation):
    """
    A column transformation which replaces unknown values with a fixed `value`.

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for imputation.
    value : int or float
        The value with which to replace the unknown values
    """
    def __init__(self, variable, value=0):
        super().__init__(variable)
        self.value = value

    def transform(self, c):
        if sp.issparse(c):
            c.data = np.where(np.isnan(c.data), self.value, c.data)
            return c
        else:
            return np.where(np.isnan(c), self.value, c)

    def __eq__(self, other):
        return super().__eq__(other) and self.value == other.value

    def __hash__(self):
        return hash((type(self), self.variable, float(self.value)))


class BaseImputeMethod(Reprable):
    name = ""
    short_name = ""
    description = ""
    format = "{var.name} -> {self.short_name}"
    columns_only = False

    def __call__(self, data, variable):
        """ Imputes table along variable column.

        Args:
            data (Table): A table to impute.
            variable (Variable): Variable for completing missing values.

        Returns:
            A new Variable instance with completed missing values or
            a array mask of rows to drop out.
        """
        raise NotImplementedError

    def format_variable(self, var):
        return self.format.format(var=var, self=self)

    def __str__(self):
        return self.name

    def copy(self):
        return self

    @classmethod
    def supports_variable(cls, variable):
        return True


class DoNotImpute(BaseImputeMethod):
    name = "Don't impute"
    short_name = "leave"
    description = ""

    def __call__(self, data, variable):
        return variable


class DropInstances(BaseImputeMethod):
    name = "Remove instances with unknown values"
    short_name = "drop"
    description = ""

    def __call__(self, data, variable):
        col, _ = data.get_column_view(variable)
        return np.isnan(col)


class Average(BaseImputeMethod):
    name = "Average/Most frequent"
    short_name = "average"
    description = "Replace with average/mode of the column"

    def __call__(self, data, variable, value=None):
        variable = data.domain[variable]
        if value is None:
            if variable.is_continuous:
                stats = basic_stats.BasicStats(data, variable)
                value = stats.mean
            elif variable.is_discrete:
                dist = distribution.get_distribution(data, variable)
                value = dist.modus()
            else:
                raise TypeError("Variable must be continuous or discrete")

        a = variable.copy(compute_value=ReplaceUnknowns(variable, value))
        a.to_sql = ImputeSql(variable, value)
        return a


class ImputeSql(Reprable):
    def __init__(self, var, default):
        self.var = var
        self.default = default

    def __call__(self):
        return 'coalesce(%s, %s)' % (self.var.to_sql(), str(self.default))


class Default(BaseImputeMethod):
    name = "Value"
    short_name = "value"
    description = ""
    columns_only = True
    format = '{var} -> {self.default}'

    def __init__(self, default=0):
        self.default = default

    def __call__(self, data, variable, *, default=None):
        variable = data.domain[variable]
        default = default if default is not None else self.default
        return variable.copy(compute_value=ReplaceUnknowns(variable, default))

    def copy(self):
        return Default(self.default)


class ReplaceUnknownsModel(Reprable):
    """
    Replace unknown values with predicted values using a `Orange.base.Model`

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for the imputation.
    model : Orange.base.Model
        A fitted model predicting `variable`.
    """
    def __init__(self, variable, model):
        assert model.domain.class_var == variable
        self.variable = variable
        self.model = model

    def __call__(self, data):
        if isinstance(data, Orange.data.Instance):
            column = np.array([float(data[self.variable])])
        else:
            column = np.array(data.get_column_view(self.variable)[0],
                              copy=True)

        mask = np.isnan(column)
        if not np.any(mask):
            return column

        if isinstance(data, Orange.data.Instance):
            predicted = self.model(data)
        else:
            predicted = self.model(data[mask])
        column[mask] = predicted
        return column


class Model(BaseImputeMethod):
    _name = "Model-based imputer"
    short_name = "model"
    description = ""
    format = BaseImputeMethod.format + " ({self.learner.name})"
    @property
    def name(self):
        return "{} ({})".format(self._name, getattr(self.learner, 'name', ''))

    def __init__(self, learner):
        self.learner = learner

    def __call__(self, data, variable):
        variable = data.domain[variable]
        domain = domain_with_class_var(data.domain, variable)

        if self.learner.check_learner_adequacy(domain):
            data = data.transform(domain)
            model = self.learner(data)
            assert model.domain.class_var == variable
            return variable.copy(
                compute_value=ReplaceUnknownsModel(variable, model))
        else:
            raise ValueError("`{}` doesn't support domain type"
                             .format(self.learner.name))

    def copy(self):
        return Model(self.learner)

    def supports_variable(self, variable):
        domain = Orange.data.Domain([], class_vars=variable)
        return self.learner.check_learner_adequacy(domain)


def domain_with_class_var(domain, class_var):
    """
    Return a domain with class_var as output domain.class_var.

    If class_var is in the input domain's attributes it is removed from the
    output's domain.attributes.
    """
    if domain.class_var is class_var:
        return domain
    elif class_var in domain.attributes:
        attrs = [var for var in domain.attributes
                 if var is not class_var]
    else:
        attrs = domain.attributes
    return Orange.data.Domain(attrs, class_var)


class IsDefined(Transformation):
    def transform(self, c):
        if sp.issparse(c):
            c = c.toarray()
        return ~np.isnan(c)


class AsValue(BaseImputeMethod):
    name = "As a distinct value"
    short_name = "new value"
    description = ""

    def __call__(self, data, variable):
        variable = data.domain[variable]
        if variable.is_discrete:
            fmt = "{var.name}"
            value = "N/A"
            var = Orange.data.DiscreteVariable(
                fmt.format(var=variable),
                values=variable.values + (value, ),
                compute_value=Lookup(
                    variable,
                    np.arange(len(variable.values), dtype=int),
                    unknown=len(variable.values)),
                sparse=variable.sparse,
                )
            return var

        elif variable.is_continuous:
            fmt = "{var.name}_def"
            indicator_var = Orange.data.DiscreteVariable(
                fmt.format(var=variable),
                values=("undef", "def"),
                compute_value=IsDefined(variable),
                sparse=variable.sparse,
            )
            stats = basic_stats.BasicStats(data, variable)
            return (variable.copy(compute_value=ReplaceUnknowns(variable,
                                                                stats.mean)),
                    indicator_var)
        else:
            raise TypeError(type(variable))


class ReplaceUnknownsRandom(Transformation):
    """
    A column transformation replacing unknowns with values drawn randomly from
    an empirical distribution.

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for imputation.
    distribution : Orange.statistics.distribution.Distribution
        The corresponding sampling distribution
    """
    def __init__(self, variable, distribution):
        assert distribution.size > 0
        assert distribution.variable == variable
        super().__init__(variable)
        self.distribution = distribution

        if variable.is_discrete:
            counts = np.array(distribution)
        elif variable.is_continuous:
            counts = np.array(distribution)[1, :]
        else:
            raise TypeError("Only discrete and continuous "
                            "variables are supported")
        csum = np.sum(counts)
        if csum > 0:
            self.sample_prob = counts / csum
        else:
            self.sample_prob = np.ones_like(counts) / len(counts)

    def transform(self, c):
        if not sp.issparse(c):
            c = np.array(c, copy=True)
        else:
            c = c.toarray().ravel()
        nanindices = np.flatnonzero(np.isnan(c))

        if self.variable.is_discrete:
            sample = np.random.choice(
                len(self.variable.values), size=len(nanindices),
                replace=True, p=self.sample_prob)
        else:
            sample = np.random.choice(
                np.asarray(self.distribution)[0, :], size=len(nanindices),
                replace=True, p=self.sample_prob)

        c[nanindices] = sample
        return c

    def __eq__(self, other):
        return super().__eq__(other) and self.distribution == other.distribution

    def __hash__(self):
        return hash((type(self), self.variable, self.distribution))


class Random(BaseImputeMethod):
    name = "Random values"
    short_name = "random"
    description = "Replace with a random value"

    def __call__(self, data, variable):
        variable = data.domain[variable]
        dist = distribution.get_distribution(data, variable)
        # A distribution is invalid if a continuous variable's column does not
        # contain any known values or if a discrete variable's .values == []
        isinvalid = dist.size == 0
        if isinvalid and variable.is_discrete:
            assert len(variable.values) == 0
            raise ValueError("'{}' has no values".format(variable))
        elif isinvalid and variable.is_continuous:
            raise ValueError("'{}' has an unknown distribution"
                             .format(variable))

        if variable.is_discrete and np.sum(dist) == 0:
            dist += 1 / len(dist)
        elif variable.is_continuous and np.sum(dist[1, :]) == 0:
            dist[1, :] += 1 / dist.shape[1]
        return variable.copy(
            compute_value=ReplaceUnknownsRandom(variable, dist))

```
--- 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:** ReplaceUnknownsModel Fails with Class Variables in Input Data

**Description:**
When using `ReplaceUnknownsModel` on a dataset that includes class variables, an error is raised due to issues with backmapping. This prevents the model from handling datasets appropriately when class variables are present.

**Example Code:**
```python
import numpy as np
from Orange.data import Domain, DiscreteVariable, ContinuousVariable, Table
from Orange.preprocess.impute import ReplaceUnknownsModel
from Orange.classification import MajorityLearner

# Create a dataset with class variables
domain = Domain(
    [DiscreteVariable("A", values=("0", "1", "2")),
     ContinuousVariable("B"),
     ContinuousVariable("C")],
    class_vars=DiscreteVariable("Z", values=("P", "M"))
)
data = Table.from_numpy(domain, np.array([
    [1.0, np.nan, 0.0,  "P"],
    [2.0, 1.0,      3.0,  "M"],
    [np.nan, np.nan, np.nan, "P"]
]))

# Attempt to impute unknowns
model = ReplaceUnknownsModel(MajorityLearner())
imputed_data = model(data, domain[0])
```

**Expected Behavior:**
`ReplaceUnknownsModel` should successfully impute unknown values in the dataset without raising errors, even when class variables are present. The model should handle or appropriately ignore class variables to perform the imputation.

**Actual Behavior:**
An error is raised indicating a mismatch in class variables:
```
Orange.data.table.DomainTransformationError: Model for 'A' cannot predict 'Z'
```
This error occurs because the presence of class variables interferes with the backmapping process within the model.

[/ISSUE]
{
    "TestReplaceUnknowns.test_replacement": "PASSED",
    "TestReplaceUnknowns.test_sparse": "PASSED",
    "TestReplaceUnknowns.test_sparse_nans": "PASSED",
    "TestDropInstances.test_drop": "PASSED",
    "TestDoNotImpute.test_call": "PASSED",
    "TestDoNotImpute.test_copy": "PASSED",
    "TestDoNotImpute.test_str": "PASSED",
    "TestDoNotImpute.test_support": "PASSED",
    "TestAverage.test_replacement": "PASSED",
    "TestDefault.test_copy": "PASSED",
    "TestDefault.test_default": "PASSED",
    "TestDefault.test_replacement": "PASSED",
    "TestDefault.test_str": "PASSED",
    "TestAsValue.test_replacement": "PASSED",
    "TestAsValue.test_sparse": "PASSED",
    "TestModel.test_bad_domain": "PASSED",
    "TestModel.test_copy": "PASSED",
    "TestModel.test_replacement": "PASSED",
    "TestModel.test_str": "PASSED",
    "TestModel.test_support": "PASSED",
    "TestRandom.test_replacement": "PASSED",
    "TestImputer.test_imputer": "PASSED",
    "test_filename": "ERROR"
}
diff --git a/Orange/preprocess/impute.py b/Orange/preprocess/impute.py
index ee9e4fc50..d774247f2 100644
--- a/Orange/preprocess/impute.py
+++ b/Orange/preprocess/impute.py
@@ -160,19 +160,20 @@ class ReplaceUnknownsModel(Reprable):
 
     def __call__(self, data):
         if isinstance(data, Orange.data.Instance):
-            column = np.array([float(data[self.variable])])
-        else:
-            column = np.array(data.get_column_view(self.variable)[0],
-                              copy=True)
+            data = Orange.data.Table.from_list(data.domain, [data])
+        domain = data.domain
+        column = np.array(data.get_column_view(self.variable)[0], copy=True)
 
         mask = np.isnan(column)
         if not np.any(mask):
             return column
 
-        if isinstance(data, Orange.data.Instance):
-            predicted = self.model(data)
-        else:
-            predicted = self.model(data[mask])
+        if domain.class_vars:
+            # cannot have class var in domain (due to backmappers in model)
+            data = data.transform(
+                Orange.data.Domain(domain.attributes, None, domain.metas)
+            )
+        predicted = self.model(data[mask])
         column[mask] = predicted
         return column
 

{"Orange/preprocess/impute.py": "import numpy as np\nimport scipy.sparse as sp\n\nimport Orange.data\nfrom Orange.statistics import distribution, basic_stats\nfrom Orange.util import Reprable\nfrom .transformation import Transformation, Lookup\n\n__all__ = [\"ReplaceUnknowns\", \"Average\", \"DoNotImpute\", \"DropInstances\",\n           \"Model\", \"AsValue\", \"Random\", \"Default\"]\n\n\nclass ReplaceUnknowns(Transformation):\n    \"\"\"\n    A column transformation which replaces unknown values with a fixed `value`.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    value : int or float\n        The value with which to replace the unknown values\n    \"\"\"\n    def __init__(self, variable, value=0):\n        super().__init__(variable)\n        self.value = value\n\n    def transform(self, c):\n        if sp.issparse(c):\n            c.data = np.where(np.isnan(c.data), self.value, c.data)\n            return c\n        else:\n            return np.where(np.isnan(c), self.value, c)\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.value == other.value\n\n    def __hash__(self):\n        return hash((type(self), self.variable, float(self.value)))\n\n\nclass BaseImputeMethod(Reprable):\n    name = \"\"\n    short_name = \"\"\n    description = \"\"\n    format = \"{var.name} -> {self.short_name}\"\n    columns_only = False\n\n    def __call__(self, data, variable):\n        \"\"\" Imputes table along variable column.\n\n        Args:\n            data (Table): A table to impute.\n            variable (Variable): Variable for completing missing values.\n\n        Returns:\n            A new Variable instance with completed missing values or\n            a array mask of rows to drop out.\n        \"\"\"\n        raise NotImplementedError\n\n    def format_variable(self, var):\n        return self.format.format(var=var, self=self)\n\n    def __str__(self):\n        return self.name\n\n    def copy(self):\n        return self\n\n    @classmethod\n    def supports_variable(cls, variable):\n        return True\n\n\nclass DoNotImpute(BaseImputeMethod):\n    name = \"Don't impute\"\n    short_name = \"leave\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        return variable\n\n\nclass DropInstances(BaseImputeMethod):\n    name = \"Remove instances with unknown values\"\n    short_name = \"drop\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        col, _ = data.get_column_view(variable)\n        return np.isnan(col)\n\n\nclass Average(BaseImputeMethod):\n    name = \"Average/Most frequent\"\n    short_name = \"average\"\n    description = \"Replace with average/mode of the column\"\n\n    def __call__(self, data, variable, value=None):\n        variable = data.domain[variable]\n        if value is None:\n            if variable.is_continuous:\n                stats = basic_stats.BasicStats(data, variable)\n                value = stats.mean\n            elif variable.is_discrete:\n                dist = distribution.get_distribution(data, variable)\n                value = dist.modus()\n            else:\n                raise TypeError(\"Variable must be continuous or discrete\")\n\n        a = variable.copy(compute_value=ReplaceUnknowns(variable, value))\n        a.to_sql = ImputeSql(variable, value)\n        return a\n\n\nclass ImputeSql(Reprable):\n    def __init__(self, var, default):\n        self.var = var\n        self.default = default\n\n    def __call__(self):\n        return 'coalesce(%s, %s)' % (self.var.to_sql(), str(self.default))\n\n\nclass Default(BaseImputeMethod):\n    name = \"Value\"\n    short_name = \"value\"\n    description = \"\"\n    columns_only = True\n    format = '{var} -> {self.default}'\n\n    def __init__(self, default=0):\n        self.default = default\n\n    def __call__(self, data, variable, *, default=None):\n        variable = data.domain[variable]\n        default = default if default is not None else self.default\n        return variable.copy(compute_value=ReplaceUnknowns(variable, default))\n\n    def copy(self):\n        return Default(self.default)\n\n\nclass ReplaceUnknownsModel(Reprable):\n    \"\"\"\n    Replace unknown values with predicted values using a `Orange.base.Model`\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for the imputation.\n    model : Orange.base.Model\n        A fitted model predicting `variable`.\n    \"\"\"\n    def __init__(self, variable, model):\n        assert model.domain.class_var == variable\n        self.variable = variable\n        self.model = model\n\n    def __call__(self, data):\n        if isinstance(data, Orange.data.Instance):\n            column = np.array([float(data[self.variable])])\n        else:\n            column = np.array(data.get_column_view(self.variable)[0],\n                              copy=True)\n\n        mask = np.isnan(column)\n        if not np.any(mask):\n            return column\n\n        if isinstance(data, Orange.data.Instance):\n            predicted = self.model(data)\n        else:\n            predicted = self.model(data[mask])\n        column[mask] = predicted\n        return column\n\n\nclass Model(BaseImputeMethod):\n    _name = \"Model-based imputer\"\n    short_name = \"model\"\n    description = \"\"\n    format = BaseImputeMethod.format + \" ({self.learner.name})\"\n    @property\n    def name(self):\n        return \"{} ({})\".format(self._name, getattr(self.learner, 'name', ''))\n\n    def __init__(self, learner):\n        self.learner = learner\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        domain = domain_with_class_var(data.domain, variable)\n\n        if self.learner.check_learner_adequacy(domain):\n            data = data.transform(domain)\n            model = self.learner(data)\n            assert model.domain.class_var == variable\n            return variable.copy(\n                compute_value=ReplaceUnknownsModel(variable, model))\n        else:\n            raise ValueError(\"`{}` doesn't support domain type\"\n                             .format(self.learner.name))\n\n    def copy(self):\n        return Model(self.learner)\n\n    def supports_variable(self, variable):\n        domain = Orange.data.Domain([], class_vars=variable)\n        return self.learner.check_learner_adequacy(domain)\n\n\ndef domain_with_class_var(domain, class_var):\n    \"\"\"\n    Return a domain with class_var as output domain.class_var.\n\n    If class_var is in the input domain's attributes it is removed from the\n    output's domain.attributes.\n    \"\"\"\n    if domain.class_var is class_var:\n        return domain\n    elif class_var in domain.attributes:\n        attrs = [var for var in domain.attributes\n                 if var is not class_var]\n    else:\n        attrs = domain.attributes\n    return Orange.data.Domain(attrs, class_var)\n\n\nclass IsDefined(Transformation):\n    def transform(self, c):\n        if sp.issparse(c):\n            c = c.toarray()\n        return ~np.isnan(c)\n\n\nclass AsValue(BaseImputeMethod):\n    name = \"As a distinct value\"\n    short_name = \"new value\"\n    description = \"\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        if variable.is_discrete:\n            fmt = \"{var.name}\"\n            value = \"N/A\"\n            var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=variable.values + (value, ),\n                compute_value=Lookup(\n                    variable,\n                    np.arange(len(variable.values), dtype=int),\n                    unknown=len(variable.values)),\n                sparse=variable.sparse,\n                )\n            return var\n\n        elif variable.is_continuous:\n            fmt = \"{var.name}_def\"\n            indicator_var = Orange.data.DiscreteVariable(\n                fmt.format(var=variable),\n                values=(\"undef\", \"def\"),\n                compute_value=IsDefined(variable),\n                sparse=variable.sparse,\n            )\n            stats = basic_stats.BasicStats(data, variable)\n            return (variable.copy(compute_value=ReplaceUnknowns(variable,\n                                                                stats.mean)),\n                    indicator_var)\n        else:\n            raise TypeError(type(variable))\n\n\nclass ReplaceUnknownsRandom(Transformation):\n    \"\"\"\n    A column transformation replacing unknowns with values drawn randomly from\n    an empirical distribution.\n\n    Parameters\n    ----------\n    variable : Orange.data.Variable\n        The target variable for imputation.\n    distribution : Orange.statistics.distribution.Distribution\n        The corresponding sampling distribution\n    \"\"\"\n    def __init__(self, variable, distribution):\n        assert distribution.size > 0\n        assert distribution.variable == variable\n        super().__init__(variable)\n        self.distribution = distribution\n\n        if variable.is_discrete:\n            counts = np.array(distribution)\n        elif variable.is_continuous:\n            counts = np.array(distribution)[1, :]\n        else:\n            raise TypeError(\"Only discrete and continuous \"\n                            \"variables are supported\")\n        csum = np.sum(counts)\n        if csum > 0:\n            self.sample_prob = counts / csum\n        else:\n            self.sample_prob = np.ones_like(counts) / len(counts)\n\n    def transform(self, c):\n        if not sp.issparse(c):\n            c = np.array(c, copy=True)\n        else:\n            c = c.toarray().ravel()\n        nanindices = np.flatnonzero(np.isnan(c))\n\n        if self.variable.is_discrete:\n            sample = np.random.choice(\n                len(self.variable.values), size=len(nanindices),\n                replace=True, p=self.sample_prob)\n        else:\n            sample = np.random.choice(\n                np.asarray(self.distribution)[0, :], size=len(nanindices),\n                replace=True, p=self.sample_prob)\n\n        c[nanindices] = sample\n        return c\n\n    def __eq__(self, other):\n        return super().__eq__(other) and self.distribution == other.distribution\n\n    def __hash__(self):\n        return hash((type(self), self.variable, self.distribution))\n\n\nclass Random(BaseImputeMethod):\n    name = \"Random values\"\n    short_name = \"random\"\n    description = \"Replace with a random value\"\n\n    def __call__(self, data, variable):\n        variable = data.domain[variable]\n        dist = distribution.get_distribution(data, variable)\n        # A distribution is invalid if a continuous variable's column does not\n        # contain any known values or if a discrete variable's .values == []\n        isinvalid = dist.size == 0\n        if isinvalid and variable.is_discrete:\n            assert len(variable.values) == 0\n            raise ValueError(\"'{}' has no values\".format(variable))\n        elif isinvalid and variable.is_continuous:\n            raise ValueError(\"'{}' has an unknown distribution\"\n                             .format(variable))\n\n        if variable.is_discrete and np.sum(dist) == 0:\n            dist += 1 / len(dist)\n        elif variable.is_continuous and np.sum(dist[1, :]) == 0:\n            dist[1, :] += 1 / dist.shape[1]\n        return variable.copy(\n            compute_value=ReplaceUnknownsRandom(variable, dist))\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:** ReplaceUnknownsModel Fails with Class Variables in Input Data

**Description:**
When using `ReplaceUnknownsModel` on a dataset that includes class variables, an error is raised due to issues with backmapping. This prevents the model from handling datasets appropriately when class variables are present.

**Example Code:**
```python
import numpy as np
from Orange.data import Domain, DiscreteVariable, ContinuousVariable, Table
from Orange.preprocess.impute import ReplaceUnknownsModel
from Orange.classification import MajorityLearner

# Create a dataset with class variables
domain = Domain(
    [DiscreteVariable("A", values=("0", "1", "2")),
     ContinuousVariable("B"),
     ContinuousVariable("C")],
    class_vars=DiscreteVariable("Z", values=("P", "M"))
)
data = Table.from_numpy(domain, np.array([
    [1.0, np.nan, 0.0,  "P"],
    [2.0, 1.0,      3.0,  "M"],
    [np.nan, np.nan, np.nan, "P"]
]))

# Attempt to impute unknowns
model = ReplaceUnknownsModel(MajorityLearner())
imputed_data = model(data, domain[0])
```

**Expected Behavior:**
`ReplaceUnknownsModel` should successfully impute unknown values in the dataset without raising errors, even when class variables are present. The model should handle or appropriately ignore class variables to perform the imputation.

**Actual Behavior:**
An error is raised indicating a mismatch in class variables:
```
Orange.data.table.DomainTransformationError: Model for 'A' cannot predict 'Z'
```
This error occurs because the presence of class variables interferes with the backmapping process within the model.

[/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/preprocess/impute.py
import numpy as np
import scipy.sparse as sp

import Orange.data
from Orange.statistics import distribution, basic_stats
from Orange.util import Reprable
from .transformation import Transformation, Lookup

__all__ = ["ReplaceUnknowns", "Average", "DoNotImpute", "DropInstances",
           "Model", "AsValue", "Random", "Default"]


class ReplaceUnknowns(Transformation):
    """
    A column transformation which replaces unknown values with a fixed `value`.

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for imputation.
    value : int or float
        The value with which to replace the unknown values
    """
    def __init__(self, variable, value=0):
        super().__init__(variable)
        self.value = value

    def transform(self, c):
        if sp.issparse(c):
            c.data = np.where(np.isnan(c.data), self.value, c.data)
            return c
        else:
            return np.where(np.isnan(c), self.value, c)

    def __eq__(self, other):
        return super().__eq__(other) and self.value == other.value

    def __hash__(self):
        return hash((type(self), self.variable, float(self.value)))


class BaseImputeMethod(Reprable):
    name = ""
    short_name = ""
    description = ""
    format = "{var.name} -> {self.short_name}"
    columns_only = False

    def __call__(self, data, variable):
        """ Imputes table along variable column.

        Args:
            data (Table): A table to impute.
            variable (Variable): Variable for completing missing values.

        Returns:
            A new Variable instance with completed missing values or
            a array mask of rows to drop out.
        """
        raise NotImplementedError

    def format_variable(self, var):
        return self.format.format(var=var, self=self)

    def __str__(self):
        return self.name

    def copy(self):
        return self

    @classmethod
    def supports_variable(cls, variable):
        return True


class DoNotImpute(BaseImputeMethod):
    name = "Don't impute"
    short_name = "leave"
    description = ""

    def __call__(self, data, variable):
        return variable


class DropInstances(BaseImputeMethod):
    name = "Remove instances with unknown values"
    short_name = "drop"
    description = ""

    def __call__(self, data, variable):
        col, _ = data.get_column_view(variable)
        return np.isnan(col)


class Average(BaseImputeMethod):
    name = "Average/Most frequent"
    short_name = "average"
    description = "Replace with average/mode of the column"

    def __call__(self, data, variable, value=None):
        variable = data.domain[variable]
        if value is None:
            if variable.is_continuous:
                stats = basic_stats.BasicStats(data, variable)
                value = stats.mean
            elif variable.is_discrete:
                dist = distribution.get_distribution(data, variable)
                value = dist.modus()
            else:
                raise TypeError("Variable must be continuous or discrete")

        a = variable.copy(compute_value=ReplaceUnknowns(variable, value))
        a.to_sql = ImputeSql(variable, value)
        return a


class ImputeSql(Reprable):
    def __init__(self, var, default):
        self.var = var
        self.default = default

    def __call__(self):
        return 'coalesce(%s, %s)' % (self.var.to_sql(), str(self.default))


class Default(BaseImputeMethod):
    name = "Value"
    short_name = "value"
    description = ""
    columns_only = True
    format = '{var} -> {self.default}'

    def __init__(self, default=0):
        self.default = default

    def __call__(self, data, variable, *, default=None):
        variable = data.domain[variable]
        default = default if default is not None else self.default
        return variable.copy(compute_value=ReplaceUnknowns(variable, default))

    def copy(self):
        return Default(self.default)


class ReplaceUnknownsModel(Reprable):
    """
    Replace unknown values with predicted values using a `Orange.base.Model`

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for the imputation.
    model : Orange.base.Model
        A fitted model predicting `variable`.
    """
    def __init__(self, variable, model):
        assert model.domain.class_var == variable
        self.variable = variable
        self.model = model

    def __call__(self, data):
        if isinstance(data, Orange.data.Instance):
            column = np.array([float(data[self.variable])])
        else:
            column = np.array(data.get_column_view(self.variable)[0],
                              copy=True)

        mask = np.isnan(column)
        if not np.any(mask):
            return column

        if isinstance(data, Orange.data.Instance):
            predicted = self.model(data)
        else:
            predicted = self.model(data[mask])
        column[mask] = predicted
        return column


class Model(BaseImputeMethod):
    _name = "Model-based imputer"
    short_name = "model"
    description = ""
    format = BaseImputeMethod.format + " ({self.learner.name})"
    @property
    def name(self):
        return "{} ({})".format(self._name, getattr(self.learner, 'name', ''))

    def __init__(self, learner):
        self.learner = learner

    def __call__(self, data, variable):
        variable = data.domain[variable]
        domain = domain_with_class_var(data.domain, variable)

        if self.learner.check_learner_adequacy(domain):
            data = data.transform(domain)
            model = self.learner(data)
            assert model.domain.class_var == variable
            return variable.copy(
                compute_value=ReplaceUnknownsModel(variable, model))
        else:
            raise ValueError("`{}` doesn't support domain type"
                             .format(self.learner.name))

    def copy(self):
        return Model(self.learner)

    def supports_variable(self, variable):
        domain = Orange.data.Domain([], class_vars=variable)
        return self.learner.check_learner_adequacy(domain)


def domain_with_class_var(domain, class_var):
    """
    Return a domain with class_var as output domain.class_var.

    If class_var is in the input domain's attributes it is removed from the
    output's domain.attributes.
    """
    if domain.class_var is class_var:
        return domain
    elif class_var in domain.attributes:
        attrs = [var for var in domain.attributes
                 if var is not class_var]
    else:
        attrs = domain.attributes
    return Orange.data.Domain(attrs, class_var)


class IsDefined(Transformation):
    def transform(self, c):
        if sp.issparse(c):
            c = c.toarray()
        return ~np.isnan(c)


class AsValue(BaseImputeMethod):
    name = "As a distinct value"
    short_name = "new value"
    description = ""

    def __call__(self, data, variable):
        variable = data.domain[variable]
        if variable.is_discrete:
            fmt = "{var.name}"
            value = "N/A"
            var = Orange.data.DiscreteVariable(
                fmt.format(var=variable),
                values=variable.values + (value, ),
                compute_value=Lookup(
                    variable,
                    np.arange(len(variable.values), dtype=int),
                    unknown=len(variable.values)),
                sparse=variable.sparse,
                )
            return var

        elif variable.is_continuous:
            fmt = "{var.name}_def"
            indicator_var = Orange.data.DiscreteVariable(
                fmt.format(var=variable),
                values=("undef", "def"),
                compute_value=IsDefined(variable),
                sparse=variable.sparse,
            )
            stats = basic_stats.BasicStats(data, variable)
            return (variable.copy(compute_value=ReplaceUnknowns(variable,
                                                                stats.mean)),
                    indicator_var)
        else:
            raise TypeError(type(variable))


class ReplaceUnknownsRandom(Transformation):
    """
    A column transformation replacing unknowns with values drawn randomly from
    an empirical distribution.

    Parameters
    ----------
    variable : Orange.data.Variable
        The target variable for imputation.
    distribution : Orange.statistics.distribution.Distribution
        The corresponding sampling distribution
    """
    def __init__(self, variable, distribution):
        assert distribution.size > 0
        assert distribution.variable == variable
        super().__init__(variable)
        self.distribution = distribution

        if variable.is_discrete:
            counts = np.array(distribution)
        elif variable.is_continuous:
            counts = np.array(distribution)[1, :]
        else:
            raise TypeError("Only discrete and continuous "
                            "variables are supported")
        csum = np.sum(counts)
        if csum > 0:
            self.sample_prob = counts / csum
        else:
            self.sample_prob = np.ones_like(counts) / len(counts)

    def transform(self, c):
        if not sp.issparse(c):
            c = np.array(c, copy=True)
        else:
            c = c.toarray().ravel()
        nanindices = np.flatnonzero(np.isnan(c))

        if self.variable.is_discrete:
            sample = np.random.choice(
                len(self.variable.values), size=len(nanindices),
                replace=True, p=self.sample_prob)
        else:
            sample = np.random.choice(
                np.asarray(self.distribution)[0, :], size=len(nanindices),
                replace=True, p=self.sample_prob)

        c[nanindices] = sample
        return c

    def __eq__(self, other):
        return super().__eq__(other) and self.distribution == other.distribution

    def __hash__(self):
        return hash((type(self), self.variable, self.distribution))


class Random(BaseImputeMethod):
    name = "Random values"
    short_name = "random"
    description = "Replace with a random value"

    def __call__(self, data, variable):
        variable = data.domain[variable]
        dist = distribution.get_distribution(data, variable)
        # A distribution is invalid if a continuous variable's column does not
        # contain any known values or if a discrete variable's .values == []
        isinvalid = dist.size == 0
        if isinvalid and variable.is_discrete:
            assert len(variable.values) == 0
            raise ValueError("'{}' has no values".format(variable))
        elif isinvalid and variable.is_continuous:
            raise ValueError("'{}' has an unknown distribution"
                             .format(variable))

        if variable.is_discrete and np.sum(dist) == 0:
            dist += 1 / len(dist)
        elif variable.is_continuous and np.sum(dist[1, :]) == 0:
            dist[1, :] += 1 / dist.shape[1]
        return variable.copy(
            compute_value=ReplaceUnknownsRandom(variable, dist))

```
--- 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