Beispiel #1
0
	def deserialize(cls, fname):
		for rvm_cls in (rvm_binding.probabilistic_function_rbf,
		 rvm_binding.probabilistic_function_ply,
		 rvm_binding.probabilistic_function_sig,
		 rvm_binding.probabilistic_function_lin):
			try:
				fn = rvm_cls()
				rvm_binding.deserialize(fn, fname)
				res = ProbabilisticFunction()
				res.fn = fn
				return res
			except RuntimeError:
				continue
		raise RuntimeError('Unable to deserialize file. Unknown function type.')
Beispiel #2
0
	def deserialize(cls, fname):
		for rvm_cls in (rvm_binding.normalized_decision_function_rbf,
		 rvm_binding.normalized_decision_function_ply,
		 rvm_binding.normalized_decision_function_sig,
		 rvm_binding.normalized_decision_function_lin,
		 rvm_binding.normalized_probabilistic_function_rbf,
		 rvm_binding.normalized_probabilistic_function_ply,
		 rvm_binding.normalized_probabilistic_function_sig,
		 rvm_binding.normalized_probabilistic_function_lin):
			try:
				fn = rvm_cls()
				rvm_binding.deserialize(fn, fname)
				# Create a temporary DecisionFunction because the NormalizedFunction
				#  constructor expects a Python object
				tmp = DecisionFunction()
				tmp.fn = fn.function
				res = NormalizedFunction(tmp)
				res.fn.normalizer = fn.normalizer
				return res
			except RuntimeError:
				continue
		raise RuntimeError('Unable to deserialize file. Unknown function type.')