Class: Bot

Bot(networkopt, optionsopt)

new Bot(networkopt, optionsopt)

Parameters:
Name Type Attributes Description
network Network <optional>
options Object <optional>
Properties
Name Type Attributes Description
_dataset Dataset <optional>

Testing dataset

dataset Dataset <optional>

Training dataset

Source:

Methods

(static) fromDataset(dataset, optionsopt) → {Bot}

Parameters:
Name Type Attributes Description
dataset Dataset
options Object <optional>
Properties
Name Type Attributes Default Description
train boolean | number <optional>
1

Will train bot for options.train iterations before creating it

test number <optional>
0

Will use options.test ratio (e.g. 0.2 === 20%) of the dataset for testing the bot's accuracy

shuffle boolean <optional>
false

Iff true, the dataset will be shuffled before splitting the dataset or training the bot.

Source:
Returns:
Type
Bot

(static) fromJSON(json, options)

Parameters:
Name Type Description
json Array.<Object>
options Object
Properties
Name Type Description
test number

Ratio of dataset to test (e.g. 0.2 is 20%)

outputs Array.<string>

JSON Keys which hold "outputs" desired outputs - bots will try to mimic or recreate these keys given all the other keys in the objects given

Source:
Example
const dataset = require("@liquid-carrot/data.cjyvyspsy0000l2m932iv07k1");
const bot = Bot.fromJSON(dataset, {
  outputs: ["quality"],
  test: 0.2 // 20% of data will used for testing, not training
})

(static) fromPath()

Source:
Examples
JSON
const bot = Bot.fromPath("./data.train.json");

bot.test(dataset); // { error: 0.01457, accuracy: 96.453%, fitness: 34.3412 }
CSV
const bot = Bot.fromPath("./data.train.csv", { outputs: ["age", "height"] });

bot.test(dataset); // { error: 0.01457, accuracy: 96.453%, fitness: 34.3412 }
XML
const bot = Bot.fromPath("./data.train.xml");

bot.test(dataset); // { error: 0.01457, accuracy: 96.453%, fitness: 34.3412 }

(static) fromString()

Source:
Example
Advanced CSV - White Wine Quality
const dataset = require("data.cjyvyspsy0000l2m932iv07k1");
const bot = Bot.fromString(dataset, {
  type: "csv",
  headers: true,
  outputs: ["quality"],
  delimeter: ";",
  test: 0.2 // 20% of data will used for testing, not training
});

bot.test(); // { error: 0.01457, accuracy: 96.453%, fitness: 34.3412 }

(static) fromURL(url, optionsopt)

Parameters:
Name Type Attributes Description
url string
options Object <optional>
Source:
Example
const bot = Bot.fromURL(https://liquidcarrot.io/dataset/monkeys.csv)

test(options) → {number}

Test the bots performance on the test dataset

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
accuracy boolean <optional>
false

Iff true, returns model accuracy instead of error

round boolean <optional>
false

Iff true, rounds the output when testing

Source:
Returns:

Returns the average error on the test dataset

Type
number