From 7d405c614fdd2ad699ed62056492205586798e38 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 9 Oct 2021 04:18:19 +0300 Subject: [PATCH] fix all default objective and metric --- .vsts-ci.yml | 305 +--------------------------------------------- src/io/config.cpp | 10 +- 2 files changed, 5 insertions(+), 310 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 059ebf9d35b4..4f26c25313da 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,7 +1,7 @@ trigger: branches: include: - - master + - fix_default_metric tags: include: - v* @@ -22,238 +22,6 @@ resources: image: rocker/r-base jobs: ########################################### -- job: Linux -########################################### - variables: - COMPILER: gcc - SETUP_CONDA: 'false' - OS_NAME: 'linux' - PRODUCES_ARTIFACTS: 'true' - pool: sh-ubuntu - container: ubuntu1404 - strategy: - matrix: - regular: - TASK: regular - sdist: - TASK: sdist - PYTHON_VERSION: 3.7 - bdist: - TASK: bdist - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: 3.8 - gpu_source: - TASK: gpu - METHOD: source - swig: - TASK: swig - steps: - - script: | - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - echo "##vso[task.prependpath]$CONDA/bin" - AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK - echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" - LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" - echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" - displayName: 'Set variables' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container -########################################### -- job: Linux_latest -########################################### - variables: - COMPILER: clang - DEBIAN_FRONTEND: 'noninteractive' - IN_UBUNTU_LATEST_CONTAINER: 'true' - OS_NAME: 'linux' - SETUP_CONDA: 'true' - pool: sh-ubuntu - container: ubuntu-latest - strategy: - matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.6 - sdist: - TASK: sdist - bdist: - TASK: bdist - PYTHON_VERSION: 3.8 - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - mpi_pip: - TASK: mpi - METHOD: pip - PYTHON_VERSION: 3.8 - mpi_wheel: - TASK: mpi - METHOD: wheel - PYTHON_VERSION: 3.7 - gpu_source: - TASK: gpu - METHOD: source - gpu_pip: - TASK: gpu - METHOD: pip - PYTHON_VERSION: 3.6 - gpu_wheel: - TASK: gpu - METHOD: wheel - PYTHON_VERSION: 3.7 - cpp_tests: - TASK: cpp-tests - METHOD: with-sanitizers - steps: - - script: | - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - CONDA=$HOME/miniconda - echo "##vso[task.setvariable variable=CONDA]$CONDA" - echo "##vso[task.prependpath]$CONDA/bin" - AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK - echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" - LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" - echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" - displayName: 'Set variables' - # https://github.com/microsoft/azure-pipelines-agent/issues/2043#issuecomment-687983301 - - script: | - /tmp/docker exec -t -u 0 ci-container \ - sh -c "apt-get update && apt-get -o Dpkg::Options::="--force-confold" -y install sudo" - displayName: 'Install sudo' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test -########################################### -- job: QEMU_multiarch -########################################### - variables: - COMPILER: gcc - OS_NAME: 'linux' - PRODUCES_ARTIFACTS: 'true' - pool: - vmImage: ubuntu-latest - timeoutInMinutes: 180 - strategy: - matrix: - bdist: - TASK: bdist - ARCH: aarch64 - steps: - - script: | - sudo apt-get update - sudo apt-get install --no-install-recommends -y \ - binfmt-support \ - qemu \ - qemu-user \ - qemu-user-static - displayName: 'Install QEMU' - - script: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - displayName: 'Enable Docker multi-architecture support' - - script: | - export ROOT_DOCKER_FOLDER=/LightGBM - cat > docker.env < docker-script.sh <& params } } -void GetMetricType(const std::unordered_map& params, std::vector* metric) { +void GetMetricType(const std::unordered_map& params, std::vector* metric, + const std::string& objective) { std::string value; if (Config::GetString(params, "metric", &value)) { std::transform(value.begin(), value.end(), value.begin(), Common::tolower); @@ -93,10 +94,7 @@ void GetMetricType(const std::unordered_map& params, s } // add names of objective function if not providing metric if (metric->empty() && value.size() == 0) { - if (Config::GetString(params, "objective", &value)) { - std::transform(value.begin(), value.end(), value.begin(), Common::tolower); - ParseMetrics(value, metric); - } + ParseMetrics(objective, metric); } } @@ -208,8 +206,8 @@ void Config::Set(const std::unordered_map& params) { GetTaskType(params, &task); GetBoostingType(params, &boosting); - GetMetricType(params, &metric); GetObjectiveType(params, &objective); + GetMetricType(params, &metric, objective); GetDeviceType(params, &device_type); if (device_type == std::string("cuda")) { LGBM_config_::current_device = lgbm_device_cuda;