Skip to content

Commit

Permalink
优化提示
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengRyan committed Jun 11, 2023
1 parent db42d62 commit 6d1cd64
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
30 changes: 22 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@

from setuptools import setup, find_packages

with open('README.rst') as readme_file:
readme = readme_file.read()
NAME = 'xgboost2sql'

with open('HISTORY.rst') as history_file:
history = history_file.read()

requirements = ['Click>=7.0', ]

def get_requirements(stage=None):
file_name = 'requirements'

if stage is not None:
file_name = f"{file_name}-{stage}"

requirements = []
with open(f"{file_name}.txt", 'r') as f:
for line in f:
line = line.strip()
if not line or line.startswith('-'):
continue

requirements.append(line)

return requirements

test_requirements = ['pytest>=3', ]

Expand All @@ -34,12 +47,13 @@
'xgboost2sql=xgboost2sql.cli:main',
],
},
install_requires=requirements,
install_requires=get_requirements(),
license="MIT license",
long_description=readme + '\n\n' + history,
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
include_package_data=True,
keywords='xgboost2sql',
name='xgboost2sql',
name=NAME,
packages=find_packages(include=['xgboost2sql', 'xgboost2sql.*']),
test_suite='tests',
tests_require=test_requirements,
Expand Down
10 changes: 3 additions & 7 deletions xgboost2sql/xgboost2sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,10 @@ def get_model_config(self, xgb_model):
return -math.log((1 - x) / x)
except:
warnings.warn(
'xgboost model version less than :: 1.0.0, '
'If the base_score parameter is not 0.5 when developing the model, '
'Insert the base_score value into the formula "-math.log((1-x)/x)" '
'and replace the -0.0 value at +(-0.0) in the first sentence of the generated sql statement with the calculated value')
'xgboost model version less than :: 1.0.0, If the base_score parameter is not 0.5 when developing the model, Insert the base_score value into the formula "-math.log((1-x)/x)" and replace the -0.0 value at +(-0.0) in the first sentence of the generated sql statement with the calculated value')
warnings.warn(
'xgboost 模型的版本低于1.0.0,如果开发模型时, base_score 参数不是0.5,'
'请将base_score的参数取值带入"-math.log((1 - x) / x)"公式,计算出的值,替换掉生成的sql语句第1句中的+(-0.0)处的-0.0取值')
return 0
'xgboost 模型的版本低于1.0.0,如果开发模型时, base_score 参数不是0.5,请将base_score的参数取值带入"-math.log((1 - x) / x)"公式,计算出的值,替换掉生成的sql语句第1句中的+(-0.0)处的-0.0取值')
return -0.0

def pre_tree(self, lines, is_right, n):
"""
Expand Down

0 comments on commit 6d1cd64

Please sign in to comment.