New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix jvm tests. #4903
Fix jvm tests. #4903
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,16 +110,13 @@ def normpath(path): | |
"xgboost4j/src/main/resources") | ||
|
||
print("copying train/test files") | ||
maybe_makedirs("xgboost4j-spark/src/test/resources") | ||
maybe_makedirs("xgboost4j/src/test/resources") | ||
with cd("../demo/regression"): | ||
run("{} mapfeat.py".format(sys.executable)) | ||
run("{} mknfold.py machine.txt 1".format(sys.executable)) | ||
|
||
for file in glob.glob("../demo/regression/machine.txt.t*"): | ||
cp(file, "xgboost4j-spark/src/test/resources") | ||
for file in glob.glob("../demo/data/agaricus.*"): | ||
cp(file, "xgboost4j-spark/src/test/resources") | ||
|
||
maybe_makedirs("xgboost4j/src/test/resources") | ||
for file in glob.glob("../demo/regression/machine.txt.t*"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if machine.txt.t* is only used for xgboost4j-spark, why we put it in xgboost4j? |
||
cp(file, "xgboost4j/src/test/resources") | ||
for file in glob.glob("../demo/data/agaricus.*"): | ||
cp(file, "xgboost4j/src/test/resources") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,9 @@ import java.io.File | |
import java.util.Arrays | ||
|
||
import scala.io.Source | ||
import ml.dmlc.xgboost4j.scala.{Classification, DMatrix, Regression} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why we have many adding of imports but never use them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked. We use all of those added imports. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, I think you moved Classification and Regression to xgboost4j leading to these changes |
||
|
||
import ml.dmlc.xgboost4j.scala.DMatrix | ||
import scala.util.Random | ||
|
||
import org.apache.spark.ml.feature._ | ||
import org.apache.spark.ml.{Pipeline, PipelineModel} | ||
import org.scalatest.FunSuite | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ml.dmlc.xgboost4j.java; | ||
|
||
|
||
import java.io.File; | ||
|
||
public class Classification { | ||
public static File trainFile = TrainTestData.getResourceFile("/agaricus.txt.train"); | ||
public static File testFile = TrainTestData.getResourceFile("/agaricus.txt.test"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ml.dmlc.xgboost4j.java; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.StandardCopyOption; | ||
|
||
public class TrainTestData { | ||
static File getResourceFile(String resource) { | ||
InputStream is = TrainTestData.class.getResourceAsStream(resource); | ||
if (is == null) { | ||
throw new RuntimeException("Failed to resolve resource " + resource); | ||
} | ||
try { | ||
try { | ||
File file = File.createTempFile(resource.substring(1), ""); | ||
Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); | ||
file.deleteOnExit(); | ||
return file; | ||
} finally { | ||
is.close(); | ||
} | ||
} catch (Exception e) { | ||
throw new RuntimeException("Failed to load the resource " + resource, e); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just question, what happened to them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly I do not know.
It may be worth reporting to the owner of puppycrawl.com