Rewrite ObjectiveValueComponent.sample_xy

This commit is contained in:
2021-04-11 21:27:25 -05:00
parent 2da60dd293
commit d90d7762e3
5 changed files with 108 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ from typing import Any, List, TYPE_CHECKING, Tuple, Dict, Hashable
import numpy as np
from overrides import EnforceOverrides
from miplearn.features import TrainingSample, Features
from miplearn.features import TrainingSample, Features, Sample
from miplearn.instance.base import Instance
from miplearn.types import LearningSolveStats
@@ -119,6 +119,14 @@ class Component:
"""
pass
def sample_xy(self, sample: Sample) -> Tuple[Dict, Dict]:
"""
Returns a pair of x and y dictionaries containing, respectively, the matrices
of ML features and the labels for the sample. If the training sample does not
include label information, returns (x, {}).
"""
pass
def xy_instances(
self,
instances: List[Instance],