MCPcopy
hub / github.com/BrainJS/brain.js / _loop

Function _loop

browser.js:1898–1937  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

1896 var sum = 0;
1897
1898 var _loop = function _loop(i) {
1899 var output = _this6.runInput(data[i].input);
1900 var target = data[i].output;
1901
1902 var actual = void 0,
1903 expected = void 0;
1904 if (isBinary) {
1905 actual = output[0] > _this6.binaryThresh ? 1 : 0;
1906 expected = target[0];
1907 } else {
1908 actual = output.indexOf((0, _max2.default)(output));
1909 expected = target.indexOf((0, _max2.default)(target));
1910 }
1911
1912 if (actual !== expected) {
1913 var misclass = data[i];
1914 Object.assign(misclass, {
1915 actual: actual,
1916 expected: expected
1917 });
1918 misclasses.push(misclass);
1919 }
1920
1921 if (isBinary) {
1922 if (actual === 0 && expected === 0) {
1923 trueNeg++;
1924 } else if (actual === 1 && expected === 1) {
1925 truePos++;
1926 } else if (actual === 0 && expected === 1) {
1927 falseNeg++;
1928 } else if (actual === 1 && expected === 0) {
1929 falsePos++;
1930 }
1931 }
1932
1933 var errors = output.map(function (value, i) {
1934 return target[i] - value;
1935 });
1936 sum += (0, _mse2.default)(errors);
1937 };
1938
1939 for (var i = 0; i < data.length; i++) {
1940 _loop(i);

Callers 1

browser.jsFile · 0.85

Calls 1

runInputMethod · 0.45

Tested by

no test coverage detected