Showing 109 of 313 total issues
Function graphSoftmaxOutputs
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function graphSoftmaxOutputs(softmaxOutputs) {
var grapher = this
var data = []
for (var i = 0; i < this.softmaxOutputs.length; i++) {
data.push({
Function graphSoftmaxToOutputArrows
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
shallowNeuralNetworkGrapher.prototype.graphSoftmaxToOutputArrows = function (data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .softmax-to-output-line").data(data);
inputToBiasLines.exit().remove();
Function graphInputToBiasLines
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
shallowNeuralNetworkGrapher.prototype.graphInputToBiasLines = function (data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .input-to-bias-line")
.data(data);
inputToBiasLines.exit()
Function drawGraphOld
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
neuralNetworkCalculationViz.prototype.drawGraphOld = function () {
var grapher = this
// Let's calculate our coordinates for all the nodes
// Let's start with the X coordiantes for each layer
Function process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
protected async process(context: HtmlRR0SsgContext, data: RR0Data) {
this.processTitle(context, data)
this.processURL(context, data)
const events = data.events.sort(
(event1, event2) => event1.time ? event2.time ? event1.time.isBefore(event2.time) ? -1 : 1 : -1 : 1)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get (proxyTarget, prop, receiver) {
if (prop in cache) {
return cache[prop]
}
if (!(prop in target)) {
Function activate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var activate = function (d) {
console.log("INSIDE", viz.layerValues[1])
if (viz.layerValues[1]) {
// Set up the tooltip to show the inputs and their sum
var rows = "<table class=\"softmax-calculation\">", total = 0,
Function fileSearchChange
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fileSearchChange (e) {
tableBody.innerHTML = ""
const input = (fileSearchInput.value || "").toLowerCase().trim()
/**
Function graphInputNodes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
shallowNeuralNetworkGrapher.prototype.graphInputNodes = function (data) {
// JOIN
var inputGroups = this.neuralNetworkG.selectAll(this.svgElement + " .input-group").data(data);
// EXIT old elements not present in new data.
Function graphOutputNodes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
shallowNeuralNetworkGrapher.prototype.graphOutputNodes = function (data) {
// JOIN
var inputGroups = this.neuralNetworkG.selectAll(this.svgElement + " .output-group")
.data(data);
Function onclick
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
speechEl.onclick = (e) => {
e.preventDefault()
e.stopPropagation()
const anotherSpeech = speechMsg && speechMsg.text !== text
if (!speechMsg || anotherSpeech) {
Function graphBiasNodes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
shallowNeuralNetworkGrapher.prototype.graphBiasNodes = function (data) {
// JOIN
var biasNodes = this.neuralNetworkG.selectAll(this.svgElement + " .bias-group").data(data);
// EXIT old elements not present in new data.
Function wrapAsyncFunction
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const wrapAsyncFunction = (name, metadata) => {
return function asyncFunctionWrapper (target, ...args) {
if (args.length < metadata.minArgs) {
throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`)
}
Function readCases
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected async readCases(context: RR0SsgContext): Promise<GeipanCaseSummary[]> {
const time = context.time
const day = time.getDayOfMonth()
const dayStartStr = day ? String(day).padStart(2, "0") : "01"
const dayEndStr = day ? String(day).padStart(2, "0") : "31"
Function draw
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw: function (layer, properties, activeRegionSVGGroup) {
// JOIN
// Each node has an SVG group of its own. In that group is an SVG circle and SVG text label
var nodeGroups = activeRegionSVGGroup.selectAll(properties.containerElement + " .layer-" + layer.index)
Function neuralNetworkCalculationViz
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var neuralNetworkCalculationViz = function (inputs, inputNodeCount, outputNodeCount, activation, containerElement, weights, biases, tableElement,
trainingSet, classes) {
Function updateUI
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
NN_trainer.prototype.updateUI = function (mean_delta_sum, errorLineValues) {
//Update error chart if available
if (this.error_chart_el !== "")
this.addErrorPoint(mean_delta_sum);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function gradientDescentStep
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
NN_trainer.prototype.gradientDescentStep = function (number_of_steps) {
// I probably shouldn't do this. I started doing feature normalization so we can keep to one learning rate.
// I decided to do it this way to maintain narrative continuity.
this.learningRate = 0.00000001;
Function handleImage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private handleImage(context: HtmlRR0SsgContext, imageUrl: string) {
const inputFile = context.file.name
if (imageUrl) {
const isLocal = !imageUrl.startsWith("http")
if (isLocal) {
Function asyncFunctionWrapper
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function asyncFunctionWrapper (target, ...args) {
if (args.length < metadata.minArgs) {
throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`)
}
if (args.length > metadata.maxArgs) {