Skip to content

Commit

Permalink
Removed explicit inheritance from "object" (not needed in python > 3) (
Browse files Browse the repository at this point in the history
  • Loading branch information
nanounanue authored Jul 3, 2020
1 parent d490c28 commit d9e1e6f
Show file tree
Hide file tree
Showing 43 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/tests/audition_tests/test_distance_from_best.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_BestDistancePlotter_plot():


def test_BestDistancePlotter_plot_bounds():
class FakeDistanceTable(object):
class FakeDistanceTable:
@property
def observed_bounds(self):
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
TRAIN_END_TIMES = ["2014-01-01", "2015-01-01"]


class MockSelectionRulePicker(object):
class MockSelectionRulePicker:
def results_for_rule(*args, **kwargs):
return [
{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/catwalk_tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tests.utils import CallSpy


class SomeClass(object):
class SomeClass:

def __init__(self, val):
self.val = val
Expand Down
2 changes: 1 addition & 1 deletion src/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def fake_labels(length):
return numpy.array([random.choice([True, False]) for i in range(0, length)])


class MockTrainedModel(object):
class MockTrainedModel:
def predict_proba(self, dataset):
return numpy.random.rand(len(dataset), len(dataset))

Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from triage.util.pandas import downcast_matrix


class BuilderBase(object):
class BuilderBase:
def __init__(
self,
db_config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DEFAULT_ACTIVE_STATE = "active"


class EntityDateTableGenerator(object):
class EntityDateTableGenerator:
"""Create a table containing state membership on different dates
The structure of the output table is:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from triage.util.structs import FeatureNameList


class FeatureDictionaryCreator(object):
class FeatureDictionaryCreator:
def __init__(self, features_schema_name, db_engine):
self.features_schema_name = features_schema_name
self.db_engine = db_engine
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/feature_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)


class FeatureGenerator(object):
class FeatureGenerator:
def __init__(
self,
db_engine,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/feature_group_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def all_subsetter(config_item, table, features):
return features


class FeatureGroupCreator(object):
class FeatureGroupCreator:
"""Divides a feature dictionary into groups based on given criteria"""

subsetters = {
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/feature_group_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def all_features(feature_groups):
return [feature_dict]


class FeatureGroupMixer(object):
class FeatureGroupMixer:
"""Generates different combinations of feature groups
based on a list of strategies"""

Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/architect/label_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
DEFAULT_LABEL_NAME = "outcome"


class LabelGeneratorNoOp(object):
class LabelGeneratorNoOp:
def generate_all_labels(self, labels_table, as_of_dates, label_timespans):
logging.warning(
"No label configuration is available, so no labels will be created"
Expand All @@ -21,7 +21,7 @@ def clean_up(self, labels_table_name):
pass


class LabelGenerator(object):
class LabelGenerator:
def __init__(self, db_engine, query, label_name=None, replace=True):
self.db_engine = db_engine
self.replace = replace
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from . import utils, entity_date_table_generators


class Planner(object):
class Planner:
def __init__(
self,
feature_start_time,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/architect/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def fake_labels(length):
return numpy.array([random.choice([True, False]) for i in range(0, length)])


class MockTrainedModel(object):
class MockTrainedModel:
def predict_proba(self, dataset):
return numpy.random.rand(len(dataset), len(dataset))

Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/audition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .pre_audition import PreAudition


class Auditioner(object):
class Auditioner:
def __init__(
self,
db_engine,
Expand Down Expand Up @@ -354,7 +354,7 @@ def register_selection_rule_grid(self, rule_grid, plot=True):
self.plot_selection_rules()


class AuditionRunner(object):
class AuditionRunner:
def __init__(self, config_dict, db_engine, directory=None):
self.dir = directory
self.config = config_dict
Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/audition/distance_from_best.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .plotting import plot_cats, plot_bounds


class DistanceFromBestTable(object):
class DistanceFromBestTable:
def __init__(self, db_engine, models_table, distance_table):
"""A database table that stores the distance from models and the
best model for that train end time for a variety of chosen metrics
Expand Down Expand Up @@ -207,7 +207,7 @@ def dataframe_as_of(self, model_group_ids, train_end_time):
return base_df[base_df["train_end_time"] == train_end_time]


class BestDistancePlotter(object):
class BestDistancePlotter:
def __init__(self, distance_from_best_table, directory=None):
"""Generate a plot illustrating the effect of different below-best maximum
thresholds across the dataset.
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/audition/model_group_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .utils import str_in_sql


class ModelGroupPerformancePlotter(object):
class ModelGroupPerformancePlotter:
def __init__(self, distance_from_best_table, directory=None):
"""Generate a plot illustrating the performance of a model group over time
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/audition/pre_audition.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd


class PreAudition(object):
class PreAudition:
def __init__(self, db_engine):
"""Prepare the model_groups and train_end_times for Auditioner to use
Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/audition/regrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .plotting import plot_cats, plot_bounds


class SelectionRulePicker(object):
class SelectionRulePicker:
def __init__(self, distance_from_best_table):
"""Runs simulations of different model group selection rules
Expand Down Expand Up @@ -102,7 +102,7 @@ def model_group_from_rule(
return bound_selection_rule.pick(localized_df, train_end_time)


class SelectionRulePlotter(object):
class SelectionRulePlotter:
"""Plot selection rules
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/audition/rules_maker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class BaseRules(object):
class BaseRules:
def __init__(self):
self._metric = None
self._parameter = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .plotting import plot_cats


class SelectionRulePerformancePlotter(object):
class SelectionRulePerformancePlotter:
"""Plot regrets over time
Generates a simple line chart with audition.BoundSelectionRule objects as
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/audition/selection_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def wm(x):
}


class BoundSelectionRule(object):
class BoundSelectionRule:
"""A selection rule bound with a set of arguments
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/audition/thresholding.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def model_groups_filter(
return model_group_ids


class ModelGroupThresholder(object):
class ModelGroupThresholder:
def __init__(
self,
distance_from_best_table,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TaskBatch = namedtuple('TaskBatch', ['parallelizable', 'tasks', 'description'])


class ModelTrainTester(object):
class ModelTrainTester:
def __init__(
self,
matrix_storage_engine,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/baselines/rankers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from triage.component.catwalk.exceptions import BaselineFeatureNotInMatrix


class PercentileRankOneFeature(object):
class PercentileRankOneFeature:
def __init__(self, feature, descend=False):
self.feature = feature # which feature to rank on
self.descend = (
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/baselines/thresholders.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_operator_method(operator_string):
return operator_method


class SimpleThresholder(object):
class SimpleThresholder:
""" The simple thresholder applies a set of predetermined logical rules to a
test matrix to classify entities. By default, it will classify entities as 1
if they satisfy any of the rules. When 'and' is set as the logical_operator,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class MetricEvaluationResult(typing.NamedTuple):
num_positive_labels: int


class ModelEvaluator(object):
class ModelEvaluator:
"""An object that can score models based on its known metrics"""

"""Available metric calculation functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def save(self, importance_records, model_id, as_of_date, method_name):



class IndividualImportanceCalculator(object):
class IndividualImportanceCalculator:
"""Calculates and saves individual importance scores and rankings using different methods
Args:
Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/catwalk/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import numpy


class Metric(object):
class Metric:
"""decorator for metrics: result will be a callable metric with an
`greater_is_better` parameter defined as either True or False
depending on whether larger or smaller metric values indicate
Expand All @@ -35,7 +35,7 @@ def __init__(self, greater_is_better):
self.greater_is_better = greater_is_better

def __call__(self, function, *params, **kwparams):
class DecoratedMetric(object):
class DecoratedMetric:
def __init__(self, greater_is_better, function):
self.greater_is_better = greater_is_better
self.function = function
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/model_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
]


class ModelGrouper(object):
class ModelGrouper:
"""Assign a model group id to given model input based on default or custom configuration
This class is a wrapper around the `get_model_group_id` stored procedure,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/model_trainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def flatten_grid_config(grid_config):
yield class_path, parameters


class ModelTrainer(object):
class ModelTrainer:
"""Trains a series of classifiers using the same training set
Args:
project_path (string) path to project folder,
Expand Down
2 changes: 1 addition & 1 deletion src/triage/component/catwalk/predictors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ModelNotFoundError(ValueError):
pass


class Predictor(object):
class Predictor:
expected_matrix_ts_format = "%Y-%m-%d %H:%M:%S"
available_tiebreakers = AVAILABLE_TIEBREAKERS

Expand Down
4 changes: 2 additions & 2 deletions src/triage/component/catwalk/protected_groups_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from triage.component.catwalk.storage import MatrixStore


class ProtectedGroupsGeneratorNoOp(object):
class ProtectedGroupsGeneratorNoOp:
def generate_all_dates(self, *args, **kwargs):
logging.warning(
"No bias audit configuration is available, so protected groups will not be created"
Expand All @@ -23,7 +23,7 @@ def as_dataframe(self, *args, **kwargs):
return pandas.DataFrame()


class ProtectedGroupsGenerator(object):
class ProtectedGroupsGenerator:
def __init__(self, db_engine, from_obj, attribute_columns, entity_id_column, knowledge_date_column, protected_groups_table_name, replace=True):
self.db_engine = db_engine
self.replace = replace
Expand Down
Loading

0 comments on commit d9e1e6f

Please sign in to comment.