@staticmethod
    def load_proto(filename):
        from .lopq_model_pb2 import LOPQModelParams
        from .utils import concat_new_first

        def halves(arr):
            return [arr[:len(arr) / 2], arr[len(arr) / 2:]]

        lopq_params = LOPQModelParams()

        try:
            f = open(filename)
            lopq_params.ParseFromString(f.read())
            f.close()

            Cs = [np.reshape(C.values, C.shape) for C in lopq_params.Cs]
            Rs = map(concat_new_first, halves([np.reshape(R.values, R.shape) for R in lopq_params.Rs]))
            mus = map(concat_new_first, halves([np.array(mu.values) for mu in lopq_params.mus]))
            subs = halves([np.reshape(sub.values, sub.shape) for sub in lopq_params.subs])

            return LOPQModel(parameters=(Cs, Rs, mus, subs))

        except IOError:
            print filename + ": Could not open file."
            return None
Reconstitute a model from parameters stored in protobuf format.
dataset/ETHPy150Open yahoo/lopq/python/lopq/model.py/LOPQModel.load_proto