Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored Dec 22, 2024
1 parent 436fb70 commit c147ba6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo 55
echo 56


ARCH=$(uname -m)
Expand All @@ -18,7 +18,7 @@ sudo apt-get install --no-install-recommends -y \
# ocl-icd-opencl-dev
# pocl-opencl-icd

mkdir -p /etc/OpenCL/vendors && echo "libOpenCL.so" > /etc/OpenCL/vendors/opencl.icd
# mkdir -p /etc/OpenCL/vendors && echo "libOpenCL.so" > /etc/OpenCL/vendors/opencl.icd

curl \
-sL \
Expand Down
62 changes: 31 additions & 31 deletions tests/python_package_test/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ def test_early_stopping_callback_accepts_non_positive_stopping_rounds(stopping_r
assert cb.enabled is False


@pytest.mark.parametrize("serializer", SERIALIZERS)
def test_log_evaluation_callback_is_picklable(serializer):
periods = 42
callback = lgb.log_evaluation(period=periods)
callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
assert callback_from_disk.order == 10
assert callback_from_disk.before_iteration is False
assert callback.period == callback_from_disk.period
assert callback.period == periods


@pytest.mark.parametrize("serializer", SERIALIZERS)
def test_record_evaluation_callback_is_picklable(serializer):
results = {}
callback = lgb.record_evaluation(eval_result=results)
callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
assert callback_from_disk.order == 20
assert callback_from_disk.before_iteration is False
assert callback.eval_result == callback_from_disk.eval_result
assert callback.eval_result is results


@pytest.mark.parametrize("serializer", SERIALIZERS)
def test_reset_parameter_callback_is_picklable(serializer):
params = {"bagging_fraction": [0.7] * 5 + [0.6] * 5, "feature_fraction": reset_feature_fraction}
callback = lgb.reset_parameter(**params)
callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
assert callback_from_disk.order == 10
assert callback_from_disk.before_iteration is True
assert callback.kwargs == callback_from_disk.kwargs
assert callback.kwargs == params
# @pytest.mark.parametrize("serializer", SERIALIZERS)
# def test_log_evaluation_callback_is_picklable(serializer):
# periods = 42
# callback = lgb.log_evaluation(period=periods)
# callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
# assert callback_from_disk.order == 10
# assert callback_from_disk.before_iteration is False
# assert callback.period == callback_from_disk.period
# assert callback.period == periods


# @pytest.mark.parametrize("serializer", SERIALIZERS)
# def test_record_evaluation_callback_is_picklable(serializer):
# results = {}
# callback = lgb.record_evaluation(eval_result=results)
# callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
# assert callback_from_disk.order == 20
# assert callback_from_disk.before_iteration is False
# assert callback.eval_result == callback_from_disk.eval_result
# assert callback.eval_result is results


# @pytest.mark.parametrize("serializer", SERIALIZERS)
# def test_reset_parameter_callback_is_picklable(serializer):
# params = {"bagging_fraction": [0.7] * 5 + [0.6] * 5, "feature_fraction": reset_feature_fraction}
# callback = lgb.reset_parameter(**params)
# callback_from_disk = pickle_and_unpickle_object(obj=callback, serializer=serializer)
# assert callback_from_disk.order == 10
# assert callback_from_disk.before_iteration is True
# assert callback.kwargs == callback_from_disk.kwargs
# assert callback.kwargs == params

0 comments on commit c147ba6

Please sign in to comment.