hossam 0.4.6__tar.gz → 0.4.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hossam-0.4.6/hossam.egg-info → hossam-0.4.7}/PKG-INFO +3 -2
- {hossam-0.4.6 → hossam-0.4.7}/hossam/__init__.py +3 -1
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_stats.py +52 -31
- {hossam-0.4.6 → hossam-0.4.7/hossam.egg-info}/PKG-INFO +3 -2
- {hossam-0.4.6 → hossam-0.4.7}/hossam.egg-info/requires.txt +1 -0
- {hossam-0.4.6 → hossam-0.4.7}/pyproject.toml +4 -3
- {hossam-0.4.6 → hossam-0.4.7}/LICENSE +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/MANIFEST.in +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/README.md +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/NotoSansKR-Regular.ttf +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_classroom.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_gis.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_plot.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_prep.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_timeserise.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/hs_util.py +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam/leekh.png +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam.egg-info/SOURCES.txt +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam.egg-info/dependency_links.txt +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/hossam.egg-info/top_level.txt +0 -0
- {hossam-0.4.6 → hossam-0.4.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hossam
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: Hossam Data Helper
|
|
5
5
|
Author-email: Lee Kwang-Ho <leekh4232@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -12,7 +12,7 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: Topic :: Software Development :: Libraries
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.13.9
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: tqdm
|
|
@@ -39,6 +39,7 @@ Requires-Dist: flask
|
|
|
39
39
|
Requires-Dist: xgboost
|
|
40
40
|
Requires-Dist: lightgbm
|
|
41
41
|
Requires-Dist: catboost
|
|
42
|
+
Requires-Dist: kneed
|
|
42
43
|
Dynamic: license-file
|
|
43
44
|
|
|
44
45
|
---
|
|
@@ -22,7 +22,9 @@ try:
|
|
|
22
22
|
except Exception:
|
|
23
23
|
__version__ = "develop"
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
my_dpi = hs_plot.config.dpi
|
|
26
|
+
|
|
27
|
+
__all__ = ["my_dpi", "load_data", "load_info", "hs_classroom", "hs_gis", "hs_plot", "hs_prep", "hs_stats", "hs_timeserise", "hs_util"]
|
|
26
28
|
|
|
27
29
|
# 내부 모듈에서 hs_fig를 사용할 때는 아래와 같이 import 하세요.
|
|
28
30
|
# from hossam import hs_fig
|
|
@@ -1973,15 +1973,17 @@ def ols_report(
|
|
|
1973
1973
|
fit: RegressionResultsWrapper,
|
|
1974
1974
|
data: DataFrame,
|
|
1975
1975
|
full: bool = False,
|
|
1976
|
-
alpha: float = 0.05
|
|
1977
|
-
|
|
1976
|
+
alpha: float = 0.05,
|
|
1977
|
+
logvar: bool = False
|
|
1978
|
+
):
|
|
1978
1979
|
"""선형회귀 적합 결과를 요약 리포트로 변환한다.
|
|
1979
1980
|
|
|
1980
1981
|
Args:
|
|
1981
|
-
fit: statsmodels OLS 등 선형회귀 결과 객체 (`fit.summary()`를 지원해야 함).
|
|
1982
|
-
data: 종속변수와 독립변수를 모두 포함한 DataFrame.
|
|
1983
|
-
full: True이면 6개 값 반환, False이면 회귀계수 테이블(rdf)만 반환. 기본값 True.
|
|
1984
|
-
alpha: 유의수준. 기본값 0.05.
|
|
1982
|
+
fit (RegressionResultsWrapper): statsmodels OLS 등 선형회귀 결과 객체 (`fit.summary()`를 지원해야 함).
|
|
1983
|
+
data (DataFrame): 종속변수와 독립변수를 모두 포함한 DataFrame.
|
|
1984
|
+
full (bool): True이면 6개 값 반환, False이면 회귀계수 테이블(rdf)만 반환. 기본값 True.
|
|
1985
|
+
alpha (float): 유의수준. 기본값 0.05.
|
|
1986
|
+
logvar (bool): 종속변수에 로그가 적용되어 있는지 여부 (True일 때 독립변수 해석에 로그를 반영함)
|
|
1985
1987
|
|
|
1986
1988
|
Returns:
|
|
1987
1989
|
tuple: full=True일 때 다음 요소를 포함한다.
|
|
@@ -2062,20 +2064,24 @@ def ols_report(
|
|
|
2062
2064
|
stars = "***" if p < 0.001 else "**" if p < 0.01 else "*" if p < 0.05 else ""
|
|
2063
2065
|
|
|
2064
2066
|
# 한 변수에 대한 보고 정보 추가
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2067
|
+
var_row = {
|
|
2068
|
+
"종속변수": yname, # 종속변수 이름
|
|
2069
|
+
"독립변수": name, # 독립변수 이름
|
|
2070
|
+
"B": f"{b:.6f}", # 비표준화 회귀계수(B)
|
|
2071
|
+
}
|
|
2072
|
+
# logvar가 True면 exp(B) 컬럼 추가
|
|
2073
|
+
if 'logvar' in locals() and logvar:
|
|
2074
|
+
var_row["exp(B)"] = f"{np.exp(b):.6f}"
|
|
2075
|
+
var_row.update({
|
|
2076
|
+
"표준오차": f"{se:.6f}", # 계수 표준오차
|
|
2077
|
+
"Beta": beta, # 표준화 회귀계수(β)
|
|
2078
|
+
"t": f"{t:.3f}{stars}", # t-통계량(+별표)
|
|
2079
|
+
"p-value": p, # 계수 유의확률
|
|
2080
|
+
"significant": p <= alpha, # 유의성 여부 (boolean)
|
|
2081
|
+
"공차": 1 / vif, # 공차(Tolerance = 1/VIF)
|
|
2082
|
+
"vif": vif, # 분산팽창계수
|
|
2083
|
+
})
|
|
2084
|
+
variables.append(var_row)
|
|
2079
2085
|
|
|
2080
2086
|
rdf = DataFrame(variables)
|
|
2081
2087
|
|
|
@@ -2113,20 +2119,34 @@ def ols_report(
|
|
|
2113
2119
|
|
|
2114
2120
|
# 변수별 보고 문장 리스트 구성
|
|
2115
2121
|
variable_reports = []
|
|
2116
|
-
|
|
2122
|
+
s_normal = "%s가 1 증가하면 %s가 %.2f만큼 변하는 것으로 나타남. (p %s 0.05, %s)"
|
|
2123
|
+
s_log = "%s가 1 증가하면 %s가 약 %.2f배 변하는 것으로 나타남. (p %s 0.05, %s)"
|
|
2117
2124
|
|
|
2118
2125
|
for i in rdf.index:
|
|
2119
2126
|
row = rdf.iloc[i]
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2127
|
+
if logvar:
|
|
2128
|
+
effect = np.exp(float(row["B"]))
|
|
2129
|
+
variable_reports.append(
|
|
2130
|
+
s_log
|
|
2131
|
+
% (
|
|
2132
|
+
row["독립변수"],
|
|
2133
|
+
row["종속변수"],
|
|
2134
|
+
effect,
|
|
2135
|
+
"<=" if float(row["p-value"]) < 0.05 else ">",
|
|
2136
|
+
"유의함" if float(row["p-value"]) < 0.05 else "유의하지 않음",
|
|
2137
|
+
)
|
|
2138
|
+
)
|
|
2139
|
+
else:
|
|
2140
|
+
variable_reports.append(
|
|
2141
|
+
s_normal
|
|
2142
|
+
% (
|
|
2143
|
+
row["독립변수"],
|
|
2144
|
+
row["종속변수"],
|
|
2145
|
+
float(row["B"]),
|
|
2146
|
+
"<=" if float(row["p-value"]) < 0.05 else ">",
|
|
2147
|
+
"유의함" if float(row["p-value"]) < 0.05 else "유의하지 않음",
|
|
2148
|
+
)
|
|
2128
2149
|
)
|
|
2129
|
-
)
|
|
2130
2150
|
|
|
2131
2151
|
# -----------------------------
|
|
2132
2152
|
# 회귀식 자동 출력
|
|
@@ -2903,6 +2923,7 @@ def logit(
|
|
|
2903
2923
|
BinaryResultsWrapper,
|
|
2904
2924
|
Tuple[
|
|
2905
2925
|
BinaryResultsWrapper,
|
|
2926
|
+
DataFrame,
|
|
2906
2927
|
DataFrame
|
|
2907
2928
|
],
|
|
2908
2929
|
Tuple[
|
|
@@ -2986,7 +3007,7 @@ def logit(
|
|
|
2986
3007
|
cdf, rdf = logit_report(logit_fit, df, threshold=0.5, full=False, alpha=0.05) # type: ignore
|
|
2987
3008
|
# 요약에서는 result_report와 variable_reports만 포함
|
|
2988
3009
|
# 간단한 버전으로 result와 variable_reports만 생성
|
|
2989
|
-
return logit_fit, rdf
|
|
3010
|
+
return logit_fit, cdf, rdf
|
|
2990
3011
|
|
|
2991
3012
|
|
|
2992
3013
|
# ===================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hossam
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: Hossam Data Helper
|
|
5
5
|
Author-email: Lee Kwang-Ho <leekh4232@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -12,7 +12,7 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: Topic :: Software Development :: Libraries
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.13.9
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: tqdm
|
|
@@ -39,6 +39,7 @@ Requires-Dist: flask
|
|
|
39
39
|
Requires-Dist: xgboost
|
|
40
40
|
Requires-Dist: lightgbm
|
|
41
41
|
Requires-Dist: catboost
|
|
42
|
+
Requires-Dist: kneed
|
|
42
43
|
Dynamic: license-file
|
|
43
44
|
|
|
44
45
|
---
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hossam"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.7"
|
|
8
8
|
description = "Hossam Data Helper"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.13.9"
|
|
11
11
|
authors = [{ name = "Lee Kwang-Ho", email = "leekh4232@gmail.com" }]
|
|
12
12
|
license = "MIT"
|
|
13
13
|
classifiers = [
|
|
@@ -42,7 +42,8 @@ dependencies = [
|
|
|
42
42
|
"flask",
|
|
43
43
|
"xgboost",
|
|
44
44
|
"lightgbm",
|
|
45
|
-
"catboost"
|
|
45
|
+
"catboost",
|
|
46
|
+
"kneed"
|
|
46
47
|
]
|
|
47
48
|
|
|
48
49
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|