1 | import copy |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
2 | |||
3 | import numpy |
||
0 ignored issues
–
show
The import
numpy could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands. # .scrutinizer.yml
before_commands:
- sudo pip install abc # Python2
- sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use
the command for the correct version.
2. Missing __init__.py filesThis error could also result from missing ![]() |
|||
4 | |||
5 | import Orange.data |
||
0 ignored issues
–
show
|
|||
6 | from Orange.statistics import distribution, basic_stats |
||
7 | from .transformation import Transformation |
||
8 | |||
9 | __all__ = ["ReplaceUnknowns", "Average"] |
||
10 | |||
11 | |||
12 | class ReplaceUnknowns(Transformation): |
||
13 | def __init__(self, variable, value=0): |
||
14 | super().__init__(variable) |
||
15 | self.value = value |
||
16 | |||
17 | def transform(self, c): |
||
18 | return numpy.where(numpy.isnan(c), self.value, c) |
||
19 | |||
20 | |||
21 | class Average: |
||
22 | def __call__(self, data, variable, value=None): |
||
23 | variable = data.domain[variable] |
||
24 | if value is None: |
||
25 | if variable.is_continuous: |
||
26 | stats = basic_stats.BasicStats(data, variable) |
||
27 | value = stats.mean |
||
28 | elif variable.is_discrete: |
||
29 | dist = distribution.get_distribution(data, variable) |
||
30 | value = dist.modus() |
||
31 | else: |
||
32 | raise TypeError("Variable must be continuous or discrete") |
||
33 | |||
34 | return variable.copy(compute_value=ReplaceUnknowns(variable, value)) |
||
35 |