Source code for mlflow.entities.param

import sys

from mlflow.entities._mlflow_object import _MLflowObject
from mlflow.protos.service_pb2 import Param as ProtoParam


[docs]class Param(_MLflowObject): """ Parameter object. """ def __init__(self, key, value): if "pyspark.ml" in sys.modules: import pyspark.ml.param if isinstance(key, pyspark.ml.param.Param): key = key.name value = str(value) self._key = key self._value = value @property def key(self): """String key corresponding to the parameter name.""" return self._key @property def value(self): """String value of the parameter.""" return self._value
[docs] def to_proto(self): param = ProtoParam() param.key = self.key param.value = self.value return param
[docs] @classmethod def from_proto(cls, proto): return cls(proto.key, proto.value)