data.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #
  2. # Copyright 2019 The FATE Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. from pipeline.backend.config import VERSION
  17. class Data(object):
  18. def __init__(self, data=None, train_data=None, validate_data=None, test_data=None, predict_input=None):
  19. self._data = data
  20. self._train_data = train_data
  21. self._validate_data = validate_data
  22. self._test_data = test_data
  23. self._predict_input = predict_input
  24. def __getattr__(self, data_key):
  25. if data_key == "train_data":
  26. return self._train_data
  27. elif data_key == "validate_data":
  28. return self._validate_data
  29. elif data_key == "test_data":
  30. return self._test_data
  31. elif data_key == "data":
  32. return self._data
  33. elif data_key == "predict_input":
  34. return self._predict_input
  35. else:
  36. raise ValueError("data key {} not support".format(data_key))