y-ohr-n / optgbm Goto Github PK
View Code? Open in Web Editor NEWOptuna + LightGBM = OptGBM
License: MIT License
Optuna + LightGBM = OptGBM
License: MIT License
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-6/test_fit_twice_without_study__0'), n_jobs = -1
@pytest.mark.parametrize("n_jobs", [-1, 1])
def test_fit_twice_without_study(tmp_path: pathlib.Path, n_jobs: int) -> None:
X, y = load_breast_cancer(return_X_y=True)
clf = OGBMClassifier(
n_estimators=n_estimators,
n_jobs=n_jobs,
n_trials=n_trials,
random_state=random_state,
train_dir=tmp_path,
)
clf.fit(X, y)
df = clf.study_.trials_dataframe()
values = df["value"]
clf = OGBMClassifier(
bagging_fraction=1.0,
bagging_freq=0,
feature_fraction=1.0,
lambda_l1=0.0,
lambda_l2=0.0,
min_data_in_leaf=20,
n_estimators=n_estimators,
n_jobs=n_jobs,
n_trials=n_trials,
random_state=random_state,
train_dir=tmp_path,
)
clf.fit(X, y)
df = clf.study_.trials_dataframe()
> np.testing.assert_array_equal(values, df["value"])
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 1 / 5 (20%)
E Max absolute difference: 5.55111512e-17
E Max relative difference: 1.84773566e-16
E x: array([0.690443, 0.315822, 0.300428, 0.690443, 0.308651])
E y: array([0.690443, 0.315822, 0.300428, 0.690443, 0.308651])
tests/test_sklearn.py:289: AssertionError
LightGBM: 2.2.1
Versions
scikit-learn: 0.22
LightGBM: 2.2.1
lightgbm: 2.2.0
_evals_result: Dict[str, Dict[str, List[float]] = {
"cv_agg": {eval_name: eval_hist[f"{eval_name}-mean"]}
}
feature_importances_
is not working when n_jobs=-1
.
min(int(0.05 * n_estimators), 50)
10.0 / learning_rate
Hello - I'm a big fan of this package. It quickly matches the performance I get from much more complicated tuning approaches. However, I was wondering if it would be possible to improve the documentation somewhat? Specifically, I'm interested in seeing how I can see the final parameters selected by the model, and how early stopping is handled? Any other user exposed parameters would also be useful to see documented.
Thanks!
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_fit_with_empty_param_dist0')
def test_fit_with_empty_param_distributions(tmp_path: pathlib.Path) -> None:
X, y = load_breast_cancer(return_X_y=True)
clf = OGBMClassifier(
colsample_bytree=0.1,
n_estimators=n_estimators,
n_trials=n_trials,
param_distributions={},
train_dir=tmp_path,
)
clf.fit(X, y)
df = clf.study_.trials_dataframe()
values = df["value"]
> assert values.nunique() == 1
E assert 2 == 1
E + where 2 = <bound method IndexOpsMixin.nunique of 0 0.302962\n1 0.302962\n2 0.302962\n3 0.302962\n4 0.302962\nName: value, dtype: float64>()
E + where <bound method IndexOpsMixin.nunique of 0 0.302962\n1 0.302962\n2 0.302962\n3 0.302962\n4 0.302962\nName: value, dtype: float64> = 0 0.302962\n1 0.302962\n2 0.302962\n3 0.302962\n4 0.302962\nName: value, dtype: float64.nunique
tests/test_sklearn.py:182: AssertionError
lightgbm.basic.LightGBMError: Cannot construct Dataset since there are no useful features.
It should be at least two unique rows.
If the num_row (num_data) is small, you can set min_data=1 and min_data_in_bin=1 to fix this.
Otherwise, please make sure you are using the right dataset
LightGBM: 2.2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.