Skip to content

Commit

Permalink
Prepare release of TF-DF 1.9.2 and PYDF 0.6.0
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 650123651
  • Loading branch information
rstz authored and copybara-github committed Jul 8, 2024
1 parent 9599f4d commit ff76e60
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 31 deletions.
305 changes: 303 additions & 2 deletions documentation/public/docs/hyperparameters.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions yggdrasil_decision_forests/port/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Head
## 0.6.0 - 2024-07-04

### Feature

Expand All @@ -11,13 +11,17 @@
the generally accepted logic of CART.
- `model.to_tensorflow_saved_model` support preprocessing functions which have
a different signature than the YDF model.
- Improve error messages when feeding wrong size numpy arrays.
- Improve error messages when feeding wrong size Numpy arrays.
- Add option for weighted evaluation in `model.evaluate`.

### Fix

- Fix display of confusion matrix with floating point weights.

### Known issues

- MacOS build is broken.

## 0.5.0 - 2024-06-17

### Feature
Expand Down
47 changes: 26 additions & 21 deletions yggdrasil_decision_forests/port/python/config/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@
This file is used by tools/build_pip_package.sh.
"""
import platform
import sys
import setuptools
from setuptools.command.install import install
from setuptools.dist import Distribution

_VERSION = "0.5.0"
_VERSION = "0.6.0"

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

REQUIRED_PACKAGES = [
"numpy",
"numpy<2.0.0",
"absl_py",
"protobuf>=3.14",
]
Expand All @@ -54,32 +55,36 @@ def is_pure(self):
return False


try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel

class bdist_wheel(_bdist_wheel):

def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False

def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
if platform.system() == "Darwin" and MAC_CROSS_COMPILED:
if "bdist_wheel" in sys.argv:
if "--plat-name" not in sys.argv:
if platform.system() == "Darwin":
if MAC_CROSS_COMPILED:
idx = sys.argv.index("bdist_wheel") + 1
sys.argv.insert(idx, "--plat-name")
if platform.processor() == "arm":
plat = "macosx_10_15_x86_64"
sys.argv.insert(idx + 1, "macosx_10_15_x86_64")
elif platform.processor() == "i386":
plat = "macosx_12_0_arm64"
sys.argv.insert(idx + 1, "macosx_12_0_arm64")
else:
raise ValueError(f"Unknown processor {platform.processor()}")
return python, abi, plat

except ImportError:
bdist_wheel = None
else:
idx = sys.argv.index("bdist_wheel") + 1
sys.argv.insert(idx, "--plat-name")
if platform.processor() == "arm":
sys.argv.insert(idx + 1, "macosx_12_0_arm64")
elif platform.processor() == "i386":
sys.argv.insert(idx + 1, "macosx_10_15_x86_64")
else:
raise ValueError(f"Unknown processor {platform.processor()}")
else:
print("Not on MacOS")
else:
print("--plat-name supplied")
else:
print("Not using bdist_wheel")

setuptools.setup(
cmdclass={
"bdist_wheel": bdist_wheel,
"install": InstallPlatlib,
},
name="ydf",
Expand Down
2 changes: 1 addition & 1 deletion yggdrasil_decision_forests/port/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy
numpy<2.0.0
absl-py
protobuf==4.24.3
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ docker pull $DOCKER
# Start the container
docker run -it -v $YDF_PATH:/working_dir -w /working_dir/yggdrasil_decision_forests/port/python \
$DOCKER /bin/bash -c " \
yum update && yum install -y rsync && \
curl -L -o /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64 && \
chmod +x /usr/local/bin/bazel && \
./tools/build_linux_release.sh "
5 changes: 3 additions & 2 deletions yggdrasil_decision_forests/port/python/tools/build_pydf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
set -xve

PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
ARCHITECTURE=$(uname --machine)
ARCHITECTURE=$(uname -m)
function is_macos() {
[[ "${PLATFORM}" == "darwin" ]]
}
Expand Down Expand Up @@ -102,7 +102,8 @@ function test_package() {
# Run a small example (in different folder to avoid clashes)
local current_folder=$(basename "$PWD")
pushd ..
${PIP} install pandas
${PIP} install -r $current_folder/requirements.txt
${PIP} install -r $current_folder/dev_requirements.txt
${PYTHON} $current_folder/examples/minimal.py
popd

Expand Down
2 changes: 1 addition & 1 deletion yggdrasil_decision_forests/port/python/tools/test_pydf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build_and_maybe_test () {

BAZEL=bazel
${BAZEL} version
local ARCHITECTURE=$(uname --machine)
local ARCHITECTURE=$(uname --m)

local flags="--config=linux_cpp17 --features=-fully_static_link"
if [ "$ARCHITECTURE" == "x86_64" ]; then
Expand Down
2 changes: 1 addition & 1 deletion yggdrasil_decision_forests/port/python/ydf/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version = "0.5.0"
version = "0.6.0"

0 comments on commit ff76e60

Please sign in to comment.