consts.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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. ARBITER = 'arbiter'
  17. HOST = 'host'
  18. GUEST = 'guest'
  19. MODEL_AGG = "model_agg"
  20. GRAD_AGG = "grad_agg"
  21. BINARY = 'binary'
  22. MULTY = 'multi'
  23. CLASSIFICATION = "classification"
  24. REGRESSION = 'regression'
  25. CLUSTERING = 'clustering'
  26. ONE_VS_REST = 'one_vs_rest'
  27. PAILLIER = 'Paillier'
  28. RANDOM_PADS = "RandomPads"
  29. NONE = "None"
  30. AFFINE = 'Affine'
  31. ITERATIVEAFFINE = 'IterativeAffine'
  32. RANDOM_ITERATIVEAFFINE = 'RandomIterativeAffine'
  33. L1_PENALTY = 'L1'
  34. L2_PENALTY = 'L2'
  35. FLOAT_ZERO = 1e-8
  36. OVERFLOW_THRESHOLD = 1e8
  37. OT_HAUCK = 'OT_Hauck'
  38. CE_PH = 'CommutativeEncryptionPohligHellman'
  39. XOR = 'xor'
  40. AES = 'aes'
  41. PARAM_MAXDEPTH = 5
  42. MAX_CLASSNUM = 1000
  43. MIN_BATCH_SIZE = 10
  44. SPARSE_VECTOR = "SparseVector"
  45. HETERO = "hetero"
  46. HOMO = "homo"
  47. RAW = "raw"
  48. RSA = "rsa"
  49. DH = "dh"
  50. ECDH = "ecdh"
  51. # evaluation
  52. AUC = "auc"
  53. KS = "ks"
  54. LIFT = "lift"
  55. GAIN = "gain"
  56. PRECISION = "precision"
  57. RECALL = "recall"
  58. ACCURACY = "accuracy"
  59. EXPLAINED_VARIANCE = "explained_variance"
  60. MEAN_ABSOLUTE_ERROR = "mean_absolute_error"
  61. MEAN_SQUARED_ERROR = "mean_squared_error"
  62. MEAN_SQUARED_LOG_ERROR = "mean_squared_log_error"
  63. MEDIAN_ABSOLUTE_ERROR = "median_absolute_error"
  64. R2_SCORE = "r2_score"
  65. ROOT_MEAN_SQUARED_ERROR = "root_mean_squared_error"
  66. ROC = "roc"
  67. F1_SCORE = 'f1_score'
  68. CONFUSION_MAT = 'confusion_mat'
  69. PSI = 'psi'
  70. VIF = 'vif'
  71. PEARSON = 'pearson'
  72. FEATURE_IMPORTANCE = 'feature_importance'
  73. QUANTILE_PR = 'quantile_pr'
  74. JACCARD_SIMILARITY_SCORE = 'jaccard_similarity_score'
  75. FOWLKES_MALLOWS_SCORE = 'fowlkes_mallows_score'
  76. ADJUSTED_RAND_SCORE = 'adjusted_rand_score'
  77. DAVIES_BOULDIN_INDEX = 'davies_bouldin_index'
  78. DISTANCE_MEASURE = 'distance_measure'
  79. CONTINGENCY_MATRIX = 'contingency_matrix'
  80. # evaluation alias metric
  81. ALL_METRIC_NAME = [AUC, KS, LIFT, GAIN, PRECISION, RECALL, ACCURACY, EXPLAINED_VARIANCE, MEAN_ABSOLUTE_ERROR,
  82. MEAN_SQUARED_ERROR, MEAN_SQUARED_LOG_ERROR, MEDIAN_ABSOLUTE_ERROR, R2_SCORE, ROOT_MEAN_SQUARED_ERROR,
  83. ROC, F1_SCORE, CONFUSION_MAT, PSI, QUANTILE_PR, JACCARD_SIMILARITY_SCORE, FOWLKES_MALLOWS_SCORE,
  84. ADJUSTED_RAND_SCORE, DAVIES_BOULDIN_INDEX, DISTANCE_MEASURE, CONTINGENCY_MATRIX]
  85. ALIAS = {
  86. ('l1', 'mae', 'regression_l1'): MEAN_ABSOLUTE_ERROR,
  87. ('l2', 'mse', 'regression_l2', 'regression'): MEAN_SQUARED_ERROR,
  88. ('l2_root', 'rmse'): ROOT_MEAN_SQUARED_ERROR,
  89. ('msle', ): MEAN_SQUARED_LOG_ERROR,
  90. ('r2', ): R2_SCORE,
  91. ('acc', ): ACCURACY,
  92. ('DBI', ): DAVIES_BOULDIN_INDEX,
  93. ('FMI', ): FOWLKES_MALLOWS_SCORE,
  94. ('RI', ): ADJUSTED_RAND_SCORE,
  95. ('jaccard', ): JACCARD_SIMILARITY_SCORE
  96. }
  97. # default evaluation metrics
  98. DEFAULT_BINARY_METRIC = [AUC, KS]
  99. DEFAULT_REGRESSION_METRIC = [ROOT_MEAN_SQUARED_ERROR, MEAN_ABSOLUTE_ERROR]
  100. DEFAULT_MULTI_METRIC = [ACCURACY, PRECISION, RECALL]
  101. DEFAULT_CLUSTER_METRIC = [DAVIES_BOULDIN_INDEX]
  102. # allowed metrics for different tasks
  103. ALL_BINARY_METRICS = [
  104. AUC,
  105. KS,
  106. LIFT,
  107. GAIN,
  108. ACCURACY,
  109. PRECISION,
  110. RECALL,
  111. ROC,
  112. CONFUSION_MAT,
  113. PSI,
  114. F1_SCORE,
  115. QUANTILE_PR
  116. ]
  117. ALL_REGRESSION_METRICS = [
  118. EXPLAINED_VARIANCE,
  119. MEAN_ABSOLUTE_ERROR,
  120. MEAN_SQUARED_ERROR,
  121. MEDIAN_ABSOLUTE_ERROR,
  122. R2_SCORE,
  123. ROOT_MEAN_SQUARED_ERROR
  124. ]
  125. ALL_MULTI_METRICS = [
  126. ACCURACY,
  127. PRECISION,
  128. RECALL
  129. ]
  130. ALL_CLUSTER_METRICS = [
  131. JACCARD_SIMILARITY_SCORE,
  132. FOWLKES_MALLOWS_SCORE,
  133. ADJUSTED_RAND_SCORE,
  134. DAVIES_BOULDIN_INDEX,
  135. DISTANCE_MEASURE,
  136. CONTINGENCY_MATRIX
  137. ]
  138. # single value metrics
  139. REGRESSION_SINGLE_VALUE_METRICS = [
  140. EXPLAINED_VARIANCE,
  141. MEAN_ABSOLUTE_ERROR,
  142. MEAN_SQUARED_ERROR,
  143. MEAN_SQUARED_LOG_ERROR,
  144. MEDIAN_ABSOLUTE_ERROR,
  145. R2_SCORE,
  146. ROOT_MEAN_SQUARED_ERROR,
  147. ]
  148. BINARY_SINGLE_VALUE_METRIC = [
  149. AUC,
  150. KS
  151. ]
  152. MULTI_SINGLE_VALUE_METRIC = [
  153. PRECISION,
  154. RECALL,
  155. ACCURACY
  156. ]
  157. CLUSTER_SINGLE_VALUE_METRIC = [
  158. JACCARD_SIMILARITY_SCORE,
  159. FOWLKES_MALLOWS_SCORE,
  160. ADJUSTED_RAND_SCORE,
  161. DAVIES_BOULDIN_INDEX
  162. ]
  163. # workflow
  164. TRAIN_DATA = "train_data"
  165. TEST_DATA = "test_data"
  166. # initialize method
  167. RANDOM_NORMAL = "random_normal"
  168. RANDOM_UNIFORM = 'random_uniform'
  169. ONES = 'ones'
  170. ZEROS = 'zeros'
  171. CONST = 'const'
  172. # decision tree
  173. MAX_SPLIT_NODES = 2 ** 16
  174. MAX_SPLITINFO_TO_COMPUTE = 2 ** 10
  175. NORMAL_TREE = 'normal'
  176. COMPLETE_SECURE_TREE = 'complete_secure'
  177. STD_TREE = 'std'
  178. MIX_TREE = 'mix'
  179. LAYERED_TREE = 'layered'
  180. SINGLE_OUTPUT = 'single_output'
  181. MULTI_OUTPUT = 'multi_output'
  182. TRAIN_EVALUATE = 'train_evaluate'
  183. VALIDATE_EVALUATE = 'validate_evaluate'
  184. # Feature engineering
  185. G_BIN_NUM = 10
  186. DEFAULT_COMPRESS_THRESHOLD = 10000
  187. DEFAULT_HEAD_SIZE = 10000
  188. DEFAULT_RELATIVE_ERROR = 1e-4
  189. ONE_HOT_LIMIT = 1024 # No more than 10 possible values
  190. PERCENTAGE_VALUE_LIMIT = 0.1
  191. SECURE_AGG_AMPLIFY_FACTOR = 1000
  192. QUANTILE = 'quantile'
  193. BUCKET = 'bucket'
  194. OPTIMAL = 'optimal'
  195. VIRTUAL_SUMMARY = 'virtual_summary'
  196. RECURSIVE_QUERY = 'recursive_query'
  197. # Feature selection methods
  198. UNIQUE_VALUE = 'unique_value'
  199. IV_VALUE_THRES = 'iv_value_thres'
  200. IV_PERCENTILE = 'iv_percentile'
  201. IV_TOP_K = 'iv_top_k'
  202. COEFFICIENT_OF_VARIATION_VALUE_THRES = 'coefficient_of_variation_value_thres'
  203. # COEFFICIENT_OF_VARIATION_PERCENTILE = 'coefficient_of_variation_percentile'
  204. OUTLIER_COLS = 'outlier_cols'
  205. MANUALLY_FILTER = 'manually'
  206. PERCENTAGE_VALUE = 'percentage_value'
  207. IV_FILTER = 'iv_filter'
  208. STATISTIC_FILTER = 'statistic_filter'
  209. PSI_FILTER = 'psi_filter'
  210. VIF_FILTER = 'vif_filter'
  211. CORRELATION_FILTER = 'correlation_filter'
  212. SECUREBOOST = 'sbt'
  213. HETERO_SBT_FILTER = 'hetero_sbt_filter'
  214. HOMO_SBT_FILTER = 'homo_sbt_filter'
  215. HETERO_FAST_SBT_FILTER = 'hetero_fast_sbt_filter'
  216. IV = 'iv'
  217. # Selection Pre-model
  218. STATISTIC_MODEL = 'statistic_model'
  219. BINNING_MODEL = 'binning_model'
  220. # imputer
  221. MIN = 'min'
  222. MAX = 'max'
  223. MEAN = 'mean'
  224. DESIGNATED = 'designated'
  225. STR = 'str'
  226. FLOAT = 'float'
  227. INT = 'int'
  228. ORIGIN = 'origin'
  229. MEDIAN = 'median'
  230. # min_max_scaler
  231. NORMAL = 'normal'
  232. CAP = 'cap'
  233. MINMAXSCALE = 'min_max_scale'
  234. STANDARDSCALE = 'standard_scale'
  235. ALL = 'all'
  236. COL = 'col'
  237. # intersection cache
  238. PHONE = 'phone'
  239. IMEI = 'imei'
  240. MD5 = 'md5'
  241. SHA1 = 'sha1'
  242. SHA224 = 'sha224'
  243. SHA256 = 'sha256'
  244. SHA384 = 'sha384'
  245. SHA512 = 'sha512'
  246. SM3 = 'sm3'
  247. INTERSECT_CACHE_TAG = 'Za'
  248. SHARE_INFO_COL_NAME = "share_info"
  249. # statistics
  250. COUNT = 'count'
  251. STANDARD_DEVIATION = 'stddev'
  252. SUMMARY = 'summary'
  253. DESCRIBE = 'describe'
  254. SUM = 'sum'
  255. COVARIANCE = 'cov'
  256. CORRELATION = 'corr'
  257. VARIANCE = 'variance'
  258. COEFFICIENT_OF_VARIATION = 'coefficient_of_variance'
  259. MISSING_COUNT = "missing_count"
  260. MISSING_RATIO = "missing_ratio"
  261. SKEWNESS = 'skewness'
  262. KURTOSIS = 'kurtosis'
  263. # adapters model name
  264. HOMO_SBT = 'homo_sbt'
  265. HETERO_SBT = 'hetero_sbt'
  266. HETERO_FAST_SBT = 'hetero_fast_sbt'
  267. HETERO_FAST_SBT_MIX = 'hetero_fast_sbt_mix'
  268. HETERO_FAST_SBT_LAYERED = 'hetero_fast_sbt_layered'
  269. # tree protobuf model name
  270. HETERO_SBT_GUEST_MODEL = 'HeteroSecureBoostingTreeGuest'
  271. HETERO_SBT_HOST_MODEL = 'HeteroSecureBoostingTreeHost'
  272. HETERO_FAST_SBT_GUEST_MODEL = "HeteroFastSecureBoostingTreeGuest"
  273. HETERO_FAST_SBT_HOST_MODEL = "HeteroFastSecureBoostingTreeHost"
  274. HOMO_SBT_GUEST_MODEL = "HomoSecureBoostingTreeGuest"
  275. HOMO_SBT_HOST_MODEL = "HomoSecureBoostingTreeHost"
  276. # tree decimal round to prevent float error
  277. TREE_DECIMAL_ROUND = 10
  278. # homm sbt backend
  279. MEMORY_BACKEND = 'memory'
  280. DISTRIBUTED_BACKEND = 'distributed'
  281. # column_expand
  282. MANUAL = 'manual'
  283. # scorecard
  284. CREDIT = 'credit'
  285. # sample weight
  286. BALANCED = 'balanced'
  287. # min r base fraction
  288. MIN_BASE_FRACTION = 0.01
  289. MAX_BASE_FRACTION = 0.99
  290. MAX_SAMPLE_OUTPUT_LIMIT = 10 ** 6
  291. # Hetero NN Selective BP Strategy
  292. SELECTIVE_SIZE = 1024
  293. # intersect join methods
  294. INNER_JOIN = "inner_join"
  295. LEFT_JOIN = "left_join"
  296. DEFAULT_KEY_LENGTH = 1024
  297. MIN_HASH_FUNC_COUNT = 4
  298. MAX_HASH_FUNC_COUNT = 32
  299. # curve names
  300. CURVE25519 = 'curve25519'
  301. # positive unlabeled
  302. PROBABILITY = "probability"
  303. QUANTITY = "quantity"
  304. PROPORTION = "proportion"
  305. DISTRIBUTION = "distribution"