(e,r)
| 113 | */ |
| 114 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.brain = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ |
| 115 | "use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),CrossValidate=function(){function e(r,t){_classCallCheck(this,e),this.Classifier=r,this.options=t,this.json=null}return _createClass(e,[{key:"testPartition",value:function(e,r,t){var n=new this.Classifier(this.options),o=Date.now(),i=n.train(r,e),s=Date.now(),a=n.test(t),l=Date.now();return Object.assign({},a,{trainTime:s-o,testTime:l-s,iterations:i.iterations,trainError:i.error,learningRate:e.learningRate,hiddenLayers:n.hiddenLayers,network:n.toJSON()})}},{key:"shuffleArray",value:function(e){for(var r=e.length-1;r>0;r--){var t=Math.floor(Math.random()*(r+1)),n=e[r];e[r]=e[t],e[t]=n}return e}},{key:"train",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;if(e.length<=t)throw new Error("Training set size is too small for "+e.length+" k folds of "+t);var n=e.length/t;if(e.constructor===Array)this.shuffleArray(e);else{var o={};this.shuffleArray(Object.keys(e)).forEach(function(r){o[r]=e[r]}),e=o}for(var i={error:0,trainTime:0,testTime:0,iterations:0,trainError:0},s={truePos:0,trueNeg:0,falsePos:0,falseNeg:0,total:0},a=[],l=void 0,u=void 0,f=0;f<t;f++){var c=e.slice(0),h=c.splice(f*n,n),v=c,y=this.testPartition(r,v,h);for(l in i)l in i&&(u=i[l],i[l]=u+y[l]);for(l in s)l in s&&(u=s[l],s[l]=u+y[l]);a.push(y)}for(l in i)l in i&&(u=i[l],i[l]=u/t);s.precision=s.truePos/(s.truePos+s.falsePos),s.recall=s.truePos/(s.truePos+s.falseNeg),s.accuracy=(s.trueNeg+s.truePos)/s.total,s.testSize=n,s.trainSize=e.length-n,this.json={avgs:i,stats:s,sets:a}}},{key:"toNeuralNetwork",value:function(){return this.fromJSON(this.json)}},{key:"toJSON",value:function(){return this.json}},{key:"fromJSON",value:function(e){var r=this.Classifier,t=e.sets.reduce(function(e,r){return e.error<r.error?e:r},{error:1/0}).network;if(r.fromJSON)return r.fromJSON(t);var n=new r;return n.fromJSON(t),n}}]),e}();exports.default=CrossValidate; |
| 116 | },{}],2:[function(require,module,exports){ |
| 117 | "use strict";function likely(e,r){var l=r.run(e),t=null,u=-1;for(var n in l){var i=l[n];i>u&&(t=n,u=i)}return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=likely; |
| 118 |
no outgoing calls
no test coverage detected