Untitled
unknown
python
3 years ago
1.1 kB
11
Indexable
Never
def _rule( self, car_make: str, car_model: str, make_year: Union[int, str], milage: int, pred_price: int, ) -> float: """ Постобработка результата с поправкой на пробег """ def _get_corrected_resuld(mil_median: float, milage: float): result = pred_price * (mil_median / milage) ** 0.15 return result mil_median = self.MODEL_MIL_MEDIANS['level-one'].get( car_make, {} ).get( car_model ) if mil_median is not None: result = _get_corrected_resuld(mil_median, milage) return result mil_median = self.MODEL_MIL_MEDIANS['level-two'].get( str(int(make_year)) ) if mil_median is not None: result = _get_corrected_resuld(mil_median, milage) return result mil_median = self.MODEL_MIL_MEDIANS["level-three"] result = _get_corrected_resuld(mil_median, milage) return result