Add type annotations to components

This commit is contained in:
2021-01-21 15:54:23 -06:00
parent a98a783969
commit fc0835e694
12 changed files with 122 additions and 76 deletions

View File

@@ -15,6 +15,7 @@ from sklearn.metrics import (
r2_score,
)
from miplearn.classifiers import Regressor
from miplearn.components.component import Component
from miplearn.extractors import InstanceFeaturesExtractor, ObjectiveValueExtractor
@@ -26,7 +27,10 @@ class ObjectiveValueComponent(Component):
A Component which predicts the optimal objective value of the problem.
"""
def __init__(self, regressor=LinearRegression()):
def __init__(
self,
regressor: Regressor = LinearRegression(),
) -> None:
self.ub_regressor = None
self.lb_regressor = None
self.regressor_prototype = regressor