I'm want to use this for a project but I need to have the option to pass NAN number.
This is the test I'm running:
require('ml-xgboost').then(XGBoost => {
var booster = new XGBoost({
booster: 'gbtree',
objective: 'reg:linear',
max_depth: 3,
eta: 0.1,
min_child_weight: 1,
subsample: 0.8,
colsample_bytree: 1,
silent: 1,
iterations: 80
});
var dataset = [
[1, 0, 0, 0, 0, 0, 0],
[7, 20, 60, 60, 0, 0, 1],
[8, 60, 70, 40, 0, 0, 2],
[9, 40, 110, 40, 10, 0, 1],
[11, 120, 90, 80, 30, 0, 4],
[14, 40, 130, 90, 60, 0, 2],
[15, 40, 110, 110, 70, 10, 3],
[19, 0, 40, 90, 110, 40, 3],
[21, 0, 0, 80, 70, 60, 3]
];
var diary = new Array(dataset.length);
var predictions = new Array(dataset.length);
for (var i = 0; i < dataset.length; ++i) {
diary[i] = dataset[i].slice(1, 6);
predictions[i] = [dataset[i][6]];
}
booster.train(diary, predictions);
var predictDataset = [[0, 40, 90, 110, 40]];
var predictions = booster.predict(predictDataset);
var model = JSON.stringify(booster);
console.log(predictions); // outputs [ 2.9955782890319824 ] which is expected
}).catch(error => console.log(error));
So far everything works as expected.
But when I add a NaN in the dataset, I get this error:
[13:48:52] dmlc-core/include/dmlc/./logging.h:300: [13:48:52] src/c_api/c_api.cc:366: Check failed: nan_missing There are NAN in the matrix, however, you did not set missing=NAN 5357128 - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.
I have been looking at the source code but can't find anything about how to set the missing=NAN.
Is this possible? And if not, would it be possible to add that feature?
I'm want to use this for a project but I need to have the option to pass NAN number.
This is the test I'm running:
So far everything works as expected.
But when I add a NaN in the dataset, I get this error:
[13:48:52] dmlc-core/include/dmlc/./logging.h:300: [13:48:52] src/c_api/c_api.cc:366: Check failed: nan_missing There are NAN in the matrix, however, you did not set missing=NAN 5357128 - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.
I have been looking at the source code but can't find anything about how to set the
missing=NAN
.Is this possible? And if not, would it be possible to add that feature?