rename files/packages

This commit is contained in:
CodingCat
2016-03-01 23:35:59 -05:00
parent 55e36893cd
commit f8fff6c6fc
36 changed files with 211 additions and 199 deletions

View File

@@ -13,17 +13,19 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
import org.dmlc.xgboost4j.demo.util.DataLoader;
package ml.dmlc.xgboost4j.demo;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
import ml.dmlc.xgboost4j.demo.util.DataLoader;
/**
* a simple example of java wrapper for xgboost
*

View File

@@ -13,12 +13,15 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
package ml.dmlc.xgboost4j.demo;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
/**
* example for start from a initial base prediction
*

View File

@@ -13,15 +13,15 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.DMatrix;
import org.dmlc.xgboost4j.XGBoost;
import org.dmlc.xgboost4j.XGBoostError;
package ml.dmlc.xgboost4j.demo;
import java.io.IOException;
import java.util.HashMap;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
/**
* an example of cross validation
*

View File

@@ -13,16 +13,16 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dmlc.xgboost4j.*;
package ml.dmlc.xgboost4j.demo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import ml.dmlc.xgboost4j.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* an example user define objective and eval
* NOTE: when you do customized loss function, the default prediction value is margin
@@ -64,7 +64,7 @@ public class CustomObjective {
}
@Override
public List<float[]> getGradient(float[][] predicts, org.dmlc.xgboost4j.DMatrix dtrain) {
public List<float[]> getGradient(float[][] predicts, DMatrix dtrain) {
int nrow = predicts.length;
List<float[]> gradients = new ArrayList<float[]>();
float[] labels;
@@ -114,7 +114,7 @@ public class CustomObjective {
}
@Override
public float eval(float[][] predicts, org.dmlc.xgboost4j.DMatrix dmat) {
public float eval(float[][] predicts, DMatrix dmat) {
float error = 0f;
float[] labels;
try {
@@ -138,11 +138,9 @@ public class CustomObjective {
public static void main(String[] args) throws XGBoostError {
//load train mat (svmlight format)
org.dmlc.xgboost4j.DMatrix trainMat =
new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.train");
DMatrix trainMat = new DMatrix("../../demo/data/agaricus.txt.train");
//load valid mat (svmlight format)
org.dmlc.xgboost4j.DMatrix testMat =
new org.dmlc.xgboost4j.DMatrix("../../demo/data/agaricus.txt.test");
DMatrix testMat = new DMatrix("../../demo/data/agaricus.txt.test");
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("eta", 1.0);
@@ -154,8 +152,7 @@ public class CustomObjective {
int round = 2;
//specify watchList
HashMap<String, org.dmlc.xgboost4j.DMatrix> watches =
new HashMap<String, org.dmlc.xgboost4j.DMatrix>();
HashMap<String, DMatrix> watches = new HashMap<String, DMatrix>();
watches.put("train", trainMat);
watches.put("test", testMat);

View File

@@ -13,12 +13,15 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
package ml.dmlc.xgboost4j.demo;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
/**
* simple example for using external memory version
*

View File

@@ -13,10 +13,13 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
package ml.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
import org.dmlc.xgboost4j.demo.util.CustomEval;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
import ml.dmlc.xgboost4j.demo.util.CustomEval;
import java.util.HashMap;

View File

@@ -13,13 +13,16 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
import org.dmlc.xgboost4j.demo.util.CustomEval;
package ml.dmlc.xgboost4j.demo;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
import ml.dmlc.xgboost4j.demo.util.CustomEval;
/**
* predict first ntree
*

View File

@@ -13,13 +13,16 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo;
import org.dmlc.xgboost4j.*;
package ml.dmlc.xgboost4j.demo;
import java.util.Arrays;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
/**
* predict leaf indices
*

View File

@@ -13,13 +13,13 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo.util;
package ml.dmlc.xgboost4j.demo.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dmlc.xgboost4j.DMatrix;
import org.dmlc.xgboost4j.IEvaluation;
import org.dmlc.xgboost4j.XGBoostError;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.IEvaluation;
import ml.dmlc.xgboost4j.XGBoostError;
/**
* a util evaluation class for examples

View File

@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dmlc.xgboost4j.demo.util;
package ml.dmlc.xgboost4j.demo.util;
import org.apache.commons.lang3.ArrayUtils;