prepare fix for joblib support in C# environment, related to #23
This commit is contained in:
parent
58fd5bd921
commit
214659c7f1
20
pdm.lock
generated
20
pdm.lock
generated
@ -2611,8 +2611,8 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "xgboost"
|
||||
version = "2.1.4"
|
||||
requires_python = ">=3.8"
|
||||
version = "3.0.0"
|
||||
requires_python = ">=3.10"
|
||||
summary = "XGBoost Python Package"
|
||||
groups = ["default"]
|
||||
dependencies = [
|
||||
@ -2621,12 +2621,12 @@ dependencies = [
|
||||
"scipy",
|
||||
]
|
||||
files = [
|
||||
{file = "xgboost-2.1.4-py3-none-macosx_10_15_x86_64.macosx_11_0_x86_64.macosx_12_0_x86_64.whl", hash = "sha256:78d88da184562deff25c820d943420342014dd55e0f4c017cc4563c2148df5ee"},
|
||||
{file = "xgboost-2.1.4-py3-none-macosx_12_0_arm64.whl", hash = "sha256:523db01d4e74b05c61a985028bde88a4dd380eadc97209310621996d7d5d14a7"},
|
||||
{file = "xgboost-2.1.4-py3-none-manylinux2014_aarch64.whl", hash = "sha256:57c7e98111aceef4b689d7d2ce738564a1f7fe44237136837a47847b8b33bade"},
|
||||
{file = "xgboost-2.1.4-py3-none-manylinux2014_x86_64.whl", hash = "sha256:f1343a512e634822eab30d300bfc00bf777dc869d881cc74854b42173cfcdb14"},
|
||||
{file = "xgboost-2.1.4-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:d366097d0db047315736f46af852feaa907f6d7371716af741cdce488ae36d20"},
|
||||
{file = "xgboost-2.1.4-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:8df6da72963969ab2bf49a520c3e147b1e15cbeddd3aa0e3e039b3532c739339"},
|
||||
{file = "xgboost-2.1.4-py3-none-win_amd64.whl", hash = "sha256:8bbfe4fedc151b83a52edbf0de945fd94358b09a81998f2945ad330fd5f20cd6"},
|
||||
{file = "xgboost-2.1.4.tar.gz", hash = "sha256:ab84c4bbedd7fae1a26f61e9dd7897421d5b08454b51c6eb072abc1d346d08d7"},
|
||||
{file = "xgboost-3.0.0-py3-none-macosx_10_15_x86_64.whl", hash = "sha256:ed8cffd7998bd9431c3b0287a70bec8e45c09b43c9474d9dfd261627713bd890"},
|
||||
{file = "xgboost-3.0.0-py3-none-macosx_12_0_arm64.whl", hash = "sha256:314104bd3a1426a40f0c9662eef40e9ab22eb7a8068a42a8d198ce40412db75c"},
|
||||
{file = "xgboost-3.0.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:72c3405e8dfc37048f9fe339a058fa12b9f0f03bc31d3e56f0887eed2ed2baa1"},
|
||||
{file = "xgboost-3.0.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:72d39e74649e9b628c4221111aa6a8caa860f2e853b25480424403ee61085126"},
|
||||
{file = "xgboost-3.0.0-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:7bdee5787f86b83bebd75e2c96caf854760788e5f4203d063da50db5bf0efc5f"},
|
||||
{file = "xgboost-3.0.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:61c7e391e373b8a5312503525c0689f83ef1912a1236377022865ab340f465a4"},
|
||||
{file = "xgboost-3.0.0-py3-none-win_amd64.whl", hash = "sha256:0ea74e97f95b1eddfd27a46b7f22f72ec5a5322e1dc7cb41c9c23fb580763df9"},
|
||||
{file = "xgboost-3.0.0.tar.gz", hash = "sha256:45e95416df6f6f01d9a62e60cf09fc57e5ee34697f3858337c796fac9ce3b9ed"},
|
||||
]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "delta-barth"
|
||||
version = "0.5.7"
|
||||
version = "0.5.8dev11"
|
||||
description = "workflows and pipelines for the Python-based Plugin of Delta Barth's ERP system"
|
||||
authors = [
|
||||
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
||||
@ -74,7 +74,7 @@ directory = "reports/coverage"
|
||||
|
||||
|
||||
[tool.bumpversion]
|
||||
current_version = "0.5.7"
|
||||
current_version = "0.5.8dev11"
|
||||
parse = """(?x)
|
||||
(?P<major>0|[1-9]\\d*)\\.
|
||||
(?P<minor>0|[1-9]\\d*)\\.
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# os.environ["JOBLIB_DISABLE_SHARED_MEMORY"] = "1"
|
||||
|
||||
interpreter = r"A:\Arbeitsaufgaben\Delta-Barth\cs-wrapper\dopt.DeltaBarth\python\python.exe"
|
||||
intp_pth = Path(interpreter).resolve()
|
||||
|
||||
assert intp_pth.exists(), f"interpreter path seems not to exist: {intp_pth}"
|
||||
|
||||
# multiprocessing.set_executable(str(intp_pth))
|
||||
# setattr(sys, "frozen", True) # !! causes termination
|
||||
# sys.executable = str(intp_pth)
|
||||
setattr(sys, "executable", str(intp_pth))
|
||||
setattr(sys, "_base_executable", str(intp_pth))
|
||||
# multiprocessing.set_start_method("spawn", force=True)
|
||||
|
||||
|
||||
target = Path(r"A:\Arbeitsaufgaben\Delta-Barth\cs-wrapper\dopt.DeltaBarth")
|
||||
file = target / "executed.txt"
|
||||
file.touch()
|
||||
@ -8,6 +8,11 @@ from dataclasses import asdict
|
||||
from datetime import datetime as Datetime
|
||||
from typing import TYPE_CHECKING, Final, TypeAlias, cast
|
||||
|
||||
import joblib
|
||||
import joblib.externals
|
||||
import joblib.externals.loky
|
||||
import joblib.externals.loky.backend
|
||||
import joblib.externals.loky.backend.popen_loky_win32
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import scipy.stats
|
||||
@ -291,18 +296,22 @@ def _process_sales(
|
||||
if len(train[train[SALES_FEAT] > 0]) >= (base_num_data_points_months + 10 * add_year):
|
||||
too_few_month_points = False
|
||||
|
||||
rand = RandomizedSearchCV(
|
||||
XGBRegressor(),
|
||||
params,
|
||||
scoring="neg_mean_absolute_error",
|
||||
cv=kfold,
|
||||
n_jobs=-1,
|
||||
n_iter=100,
|
||||
verbose=0,
|
||||
)
|
||||
rand.fit(
|
||||
X_train, y_train, eval_set=[(X_train, y_train), (X_test, y_test)], verbose=0
|
||||
)
|
||||
with joblib.parallel_config(backend="loky"):
|
||||
rand = RandomizedSearchCV(
|
||||
XGBRegressor(),
|
||||
params,
|
||||
scoring="neg_mean_absolute_error",
|
||||
cv=kfold,
|
||||
n_jobs=-1,
|
||||
n_iter=100,
|
||||
verbose=0,
|
||||
)
|
||||
rand.fit(
|
||||
X_train,
|
||||
y_train,
|
||||
eval_set=[(X_train, y_train), (X_test, y_test)],
|
||||
verbose=0,
|
||||
)
|
||||
y_pred = rand.best_estimator_.predict(X_test) # type: ignore
|
||||
|
||||
if len(np.unique(y_pred)) != 1:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user