Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/maven-macos-aarch64.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Tribuo CI (macOS aarch64, Java SE 17, 21, 24)
name: Tribuo CI (macOS aarch64, Java SE 17, 21, 25)

on:
push:
Expand All @@ -15,12 +15,14 @@ jobs:
strategy:
matrix:
# test against supported LTS versions and latest
java: [ 21, 24 ]
java: [ 21, 25 ]
name: macOS aarch64 Java SE ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Install libomp for XGBoost
run: brew install libomp
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
uses: oracle-actions/setup-java@v1.5.0
with:
website: oracle.com
release: ${{ matrix.java }}
Expand All @@ -31,6 +33,8 @@ jobs:
name: macOS aarch64 Java SE 17
steps:
- uses: actions/checkout@v4
- name: Install libomp for XGBoost
run: brew install libomp
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
with:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/maven-macos-x64.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Tribuo CI (macOS x86_64, Java SE 17, 21, 24)
name: Tribuo CI (macOS x86_64, Java SE 17, 21, 25)

on:
push:
Expand All @@ -15,12 +15,14 @@ jobs:
strategy:
matrix:
# test against supported LTS versions and latest
java: [ 21, 24 ]
java: [ 21, 25 ]
name: macOS x86_64 Java SE ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Install libomp for XGBoost
run: brew install libomp
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
uses: oracle-actions/setup-java@v1.5.0
with:
website: oracle.com
release: ${{ matrix.java }}
Expand All @@ -31,6 +33,8 @@ jobs:
name: macOS x86_64 Java SE 17
steps:
- uses: actions/checkout@v4
- name: Install libomp for XGBoost
run: brew install libomp
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
with:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/maven-ubuntu-aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Tribuo CI (Ubuntu aarch64, Java SE 21, 25)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-24.04-arm
strategy:
matrix:
# test against supported LTS versions and latest
java: [ 21, 25 ]
name: Ubuntu Java SE ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.5.0
with:
website: oracle.com
release: ${{ matrix.java }}
- name: Build with Maven
run: mvn -B package --file pom.xml -Parm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Tribuo CI (Ubuntu x86_64, Java SE 17, 21, 24)
name: Tribuo CI (Ubuntu x86_64, Java SE 17, 21, 25)

on:
push:
Expand All @@ -15,12 +15,12 @@ jobs:
strategy:
matrix:
# test against supported LTS versions and latest
java: [ 21, 24 ]
java: [ 21, 25 ]
name: Ubuntu Java SE ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
uses: oracle-actions/setup-java@v1.5.0
with:
website: oracle.com
release: ${{ matrix.java }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven-windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Tribuo CI (Windows x86_64, Java SE 17, 21, 24)
name: Tribuo CI (Windows x86_64, Java SE 17, 21, 25)

on:
push:
Expand All @@ -15,12 +15,12 @@ jobs:
strategy:
matrix:
# test against supported LTS versions and latest
java: [ 21, 24 ]
java: [ 21, 25 ]
name: Windows Java SE ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Setup Oracle Java SE
uses: oracle-actions/setup-java@v1.4.1
uses: oracle-actions/setup-java@v1.5.0
with:
website: oracle.com
release: ${{ matrix.java }}
Expand Down
38 changes: 0 additions & 38 deletions AnomalyDetection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,42 +65,4 @@
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<show>protected</show>
<failOnError>false</failOnError>
<linksource>true</linksource>
<nohelp>true</nohelp>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>${tribuo.java.version}</release>
<testRelease>${tribuo.java.version}</testRelease>
<compilerArgument>
-Xlint:all
</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,29 @@ public Model<Label> testBagging(Pair<Dataset<Label>,Dataset<Label>> p) {
return m;
}

/**
* Tests parallel bagging with 2 threads to exercise the parallel training
* codepath.
* @param p The train/test dataset pair.
* @return The trained model.
*/
public Model<Label> testBaggingParallel(
Pair<Dataset<Label>,Dataset<Label>> p) {
BaggingTrainer<Label> parallelBagT = new BaggingTrainer<>(t,
new VotingCombiner(), 10, Trainer.DEFAULT_SEED, 2);
Model<Label> m = parallelBagT.train(p.getA());
LabelEvaluator e = new LabelEvaluator();
LabelEvaluation evaluation = e.evaluate(m,p.getB());
Map<String, List<Pair<String,Double>>> features =
m.getTopFeatures(3);
Assertions.assertNotNull(features);
Assertions.assertFalse(features.isEmpty());
features = m.getTopFeatures(-1);
Assertions.assertNotNull(features);
Assertions.assertFalse(features.isEmpty());
return m;
}

public Model<Label> testRandomForest(Pair<Dataset<Label>,Dataset<Label>> p) {
Model<Label> m = rfT.train(p.getA());
LabelEvaluator e = new LabelEvaluator();
Expand Down Expand Up @@ -163,6 +186,9 @@ public void testDenseData() {
Model<Label> bag = testBagging(p);
Helpers.testModelProtoSerialization(bag,Label.class);

Model<Label> parallelBag = testBaggingParallel(p);
Helpers.testModelProtoSerialization(parallelBag,Label.class);

Model<Label> rf = testRandomForest(p);
Helpers.testModelProtoSerialization(rf,Label.class);

Expand All @@ -175,6 +201,7 @@ public void testSparseData() {
Pair<Dataset<Label>,Dataset<Label>> p = LabelledDataGenerator.sparseTrainTest();
testAdaBoost(p);
testBagging(p);
testBaggingParallel(p);
testRandomForest(p);
testExtraTrees(p);
}
Expand All @@ -184,6 +211,7 @@ public void testSparseBinaryData() {
Pair<Dataset<Label>,Dataset<Label>> p = LabelledDataGenerator.binarySparseTrainTest();
testAdaBoost(p);
testBagging(p);
testBaggingParallel(p);
testRandomForest(p);
testExtraTrees(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ public void testDenseData() {
Map<String,Object> overrideParams = new HashMap<>();
overrideParams.put("objective","multi:softprob");
overrideParams.put("eta","0.1");
overrideParams.put("sampling_method","gradient_based");
XGBoostClassificationTrainer overrideTrainer = new XGBoostClassificationTrainer(5, overrideParams);
XGBoostModel<Label> overrideM = testXGBoost(overrideTrainer,p);

Expand All @@ -253,7 +252,6 @@ public void testDenseData() {
assertEquals(overrideParams.size(), overrideMap.size());
assertEquals(overrideParams.get("objective"), overrideMap.get("objective").getValue());
assertEquals(overrideParams.get("eta"), overrideMap.get("eta").getValue());
assertEquals(overrideParams.get("sampling_method"), overrideMap.get("sampling_method").getValue());
}

@Test
Expand Down
38 changes: 0 additions & 38 deletions Classification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,42 +72,4 @@
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<show>protected</show>
<failOnError>false</failOnError>
<linksource>true</linksource>
<nohelp>true</nohelp>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>${tribuo.java.version}</release>
<testRelease>${tribuo.java.version}</testRelease>
<compilerArgument>
-Xlint:all
</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>

</project>
38 changes: 0 additions & 38 deletions Clustering/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,4 @@
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<show>protected</show>
<failOnError>false</failOnError>
<linksource>true</linksource>
<nohelp>true</nohelp>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>${tribuo.java.version}</release>
<testRelease>${tribuo.java.version}</testRelease>
<compilerArgument>
-Xlint:all
</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</build>

</project>
4 changes: 4 additions & 0 deletions Common/XGBoost/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-java8-compat_2.12</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-collection-compat_2.12</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -229,7 +229,7 @@ public Map<String, List<Pair<String, Double>>> getTopFeatures(int n) {
}
}
List<Pair<String,Double>> list = new ArrayList<>();
while(q.size() > 0) {
while(!q.isEmpty()) {
list.add(q.poll());
}
Collections.reverse(list);
Expand All @@ -255,7 +255,7 @@ public ModelProto serialize() {
Collectors.toList()));
modelBuilder.addAllBackwardFeatureMapping(Arrays.stream(featureBackwardMapping).boxed().collect(Collectors.toList()));
try {
modelBuilder.setModel(ByteString.copyFrom(model.toByteArray()));
modelBuilder.setModel(ByteString.copyFrom(model.toByteArray("ubj")));
} catch (XGBoostError e) {
throw new IllegalStateException("Failed to serialize XGBoost model");
}
Expand Down
Loading
Loading