How to use the mldb.log function in mldb

To help you get started, we’ve selected a few mldb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mldbai / mldb / testing / MLDB-1755-column-execution-memory-use.js View on Github external
resp = mldb.put('/v1/procedures/benchmark', {
    "type": "randomforest.binary.train",
    "params": {
        "trainingData": "select {* EXCLUDING(dep_delayed_15min)} as features, dep_delayed_15min = 'Y' as label from airline",
        "runOnCreation": true,
        "modelFileUrl": "file://tmp/MLDB-1755.cls",
        "functionName": "classifyme",
        "featureVectorSamplings" : 1,
        "featureSamplings" : 1,
        "maxDepth" : 1,
        "verbosity" : 10,
        "featureSamplingProp": 1
    }
});

mldb.log(resp);

// Re-run but with all optimized paths turned off
// This causes us to not use the optimized column implementation
mldb.debugSetPathOptimizationLevel("never");

resp = mldb.put('/v1/procedures/benchmark2', {
    "type": "randomforest.binary.train",
    "params": {
        "trainingData": "select {* EXCLUDING(dep_delayed_15min)} as features, dep_delayed_15min = 'Y' as label from airline",
        "runOnCreation": true,
        "modelFileUrl": "file://tmp/MLDB-1433.cls",
        "functionName": "classifyme2",
        "featureVectorSamplings" : 1,
        "featureSamplings" : 1,
        "maxDepth" : 1,
        "verbosity" : 10,
github mldbai / mldb / testing / MLDB-749-csv-dataset.js View on Github external
}

csv_conf = {
    type: "import.text",
    params: {
        dataFileUrl : "https://raw.githubusercontent.com/datacratic/mldb-pytanic-plugin/master/titanic_train.csv",
        outputDataset: {
            id: "titanic2",
        },
        named: 'lineNumber() % 10'
    }
}

mldb.put("/v1/procedures/csv_proc", csv_conf)
res = mldb.put("/v1/procedures/csv_proc/runs/0", {})
mldb.log(res);
unittest.assertEqual(res['responseCode'], 400);
unittest.assertEqual(res['json']['error'], "Duplicate row name(s) in tabular dataset: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9");

// Test correctness of parser
var correctnessConfig = {
    type: 'text.csv.tabular',
    id: 'correctness',
    params: {
        dataFileUrl: 'https://raw.githubusercontent.com/uniVocity/csv-parsers-comparison/master/src/main/resources/correctness.csv'
    }
};

csv_conf = {
    type: "import.text",
    params: {
        dataFileUrl : "https://raw.githubusercontent.com/uniVocity/csv-parsers-comparison/master/src/main/resources/correctness.csv",
github mldbai / mldb / testing / MLDB-1500-transpose-query.js View on Github external
{
         "columns" : [
            [ "width", 780, "2016-08-09T16:46:52Z" ]
         ],
         "rowName" : "\"[\"\"AskReddit\"\"]\""
      },
      {
         "columns" : [
            [ "width", 757, "2016-08-09T16:46:52Z" ]
         ],
         "rowName" : "\"[\"\"funny\"\"]\""
      }
   ];

mldb.log(res)

unittest.assertEqual(mldb.diff(expected, res.json, false /* strict */), {},
            "output was not the same as expected output in batch executor desc");

res = mldb.get('/v1/query', { q: 'select sum(horizontal_count({*})) as width from transpose(reddit) group by rowName() order by sum(horizontal_count({*})) asc, rowName() limit 2' });

//Check that we get smallest value first and second smallest second
expected = [
    {
        "columns" : [
            [ "width", 1, "2016-08-09T16:46:52Z" ]
        ],
        "rowName" : "\"[\"\"1000\"\"]\""
    },
    {
        "columns" : [
github mldbai / mldb / testing / MLDB-1315-row-table-expressions.js View on Github external
function testQuery(query, expected) {
    mldb.log("testing query", query);

    var resp = mldb.get('/v1/query', {q: query, format: 'table'});

    mldb.log("received", resp.json);
    mldb.log("expected", expected);
    
    unittest.assertEqual(resp.responseCode, 200);
    unittest.assertEqual(resp.json, expected);
}
github mldbai / mldb / testing / MLDB-1486-embedding-types.js View on Github external
function testQuery(query, expected) {
    mldb.log("testing query", query);

    var resp = mldb.get('/v1/query', {q: query, format: 'table'});

    mldb.log("received", resp.json);
    mldb.log("expected", expected);
    
    unittest.assertEqual(resp.responseCode, 200);
    unittest.assertEqual(resp.json, expected);
}
github mldbai / mldb / testing / MLDB-1319-new-executor-function-binding.js View on Github external
function testQuery(query, expected) {
    mldb.log("testing query", query);

    var resp = mldb.get('/v1/query', {q: query, format: 'table'});

    mldb.log("received", resp.json);
    mldb.log("expected", expected);
    
    unittest.assertEqual(resp.responseCode, 200);
    unittest.assertEqual(resp.json, expected);
}
github mldbai / mldb / testing / MLDB-1213-blob-support.js View on Github external
function testQuery(query, expected) {
    mldb.log("testing query", query);

    var resp = mldb.get('/v1/query', {q: query, format: 'table'});

    mldb.log("received", resp.json);
    mldb.log("expected", expected);
    
    unittest.assertEqual(resp.responseCode, 200);
    unittest.assertEqual(resp.json, expected);
}
github mldbai / mldb / testing / MLDB-1320-sql-query-whole-table.js View on Github external
function testQuery(query, expected) {
    mldb.log("testing query", query);

    var resp = mldb.get('/v1/query', {q: query, format: 'table'});

    mldb.log("received", resp.json);
    mldb.log("expected", expected);
    
    unittest.assertEqual(resp.responseCode, 200);
    unittest.assertEqual(resp.json, expected);
}
github mldbai / mldb / testing / MLDB-1567-empty-literal.js View on Github external
var resp = mldb.query('select [] as x');

mldb.log(resp);

unittest.assertEqual(resp[0].columns, expected);

resp = mldb.query('select {} as x')

mldb.log(resp);

unittest.assertEqual(resp[0].columns, undefined);

resp = mldb.get('/v1/query', {q: 'select * from transpose(select 1)'});

mldb.log(resp);

unittest.assertEqual(resp.responseCode, 400);

unittest.assertEqual(resp.json.error.indexOf("Expected to find a ')' parsing a table expression.  This is normally because of not putting a sub-SELECT within '()' characters") != -1, true, resp.json.error);

"success"
github mldbai / mldb / testing / MLDB-749-csv-dataset.js View on Github external
}
}

var res = mldb.put("/v1/procedures/csv_proc", csv_conf)
mldb.log(res);
unittest.assertEqual(res["responseCode"], 201);

var res = mldb.put("/v1/procedures/csv_proc/runs/myrun", {});

mldb.log(res);

unittest.assertEqual(res['json']['status']['numLineErrors'], 0);

res = mldb.get('/v1/datasets/iris');
unittest.assertEqual(res['json']['status']['rowCount'], 150);
mldb.log(res);


res = mldb.get('/v1/datasets/iris/query', { limit: 10, format: 'table', orderBy: 'CAST (rowName() AS NUMBER)'});

mldb.log(res.json);

csv_conf = {
    type: "import.text",
    params: {
        dataFileUrl : "https://raw.githubusercontent.com/datacratic/mldb-pytanic-plugin/master/titanic_train.csv",
        outputDataset: {
            id: "titanic",
        },
        runOnCreation: true,
    }
}

mldb

MarkLogic V6 REST API Driver for Node.js

Unrecognized
Latest version published 11 years ago

Package Health Score

36 / 100
Full package analysis