Showing 109 of 313 total issues
Function graphSigmoid
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function graphSigmoid(data) {
var sigmoid = this.neuralNetworkG.selectAll(this.svgElement + " .sigmoid")
.data([data])
Function handleImage
has a Cognitive Complexity of 22 (exceeds 5 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) {
- 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 graphSoftmaxToOutputArrows
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function graphSoftmaxToOutputArrows(data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .softmax-to-output-line")
.data(data)
Function NN_trainer
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var NN_trainer = function (svg_el, table_el, areas, prices, weight, bias, x1, y1, x2, y2,
gradientDescentButton, gradientDescent10Button, gradientDescent100Button,
gradientDescentConvergeButton, normalize, error_chart_el, heatmap_el,
weightRange, biasRange, neuralNetworkGraphEl, analyticsCategory) {
this.svg_el = svg_el;
Function draw
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw: function (layer, properties, activeRegionSVGGroup) {
var data = layer.nodeRenderingDetails,
containerElement = properties.containerElement
var inputGroups = activeRegionSVGGroup.selectAll(properties.containerElement + " .input-group")
.data(data)
Function graphInputNodes
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function graphInputNodes(data) {
var grapher = this
// JOIN
var inputGroups = this.neuralNetworkG.selectAll(this.svgElement + " .input-group")
Function initializeErrorGraph
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
NN_trainer.prototype.initializeErrorGraph = function () {
this.error_chart_history_x = 200; // How many error data points to show
this.error_chart_history_y = 100000; // How high the bar goes
this.error_history = [10000];
Function NN_trainer
has 21 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var NN_trainer = function (svg_el, table_el, areas, prices, weight, bias, x1, y1, x2, y2,
gradientDescentButton, gradientDescent10Button, gradientDescent100Button,
gradientDescentConvergeButton, normalize, error_chart_el, heatmap_el,
weightRange, biasRange, neuralNetworkGraphEl, analyticsCategory) {
Function gradientDescentStep
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
multiVariableNeuralNetworkTrainer.prototype.gradientDescentStep = function (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.weightLearningRates = [0.00000001, 0.01];
- 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 multiVariableNeuralNetworkTrainer
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var multiVariableNeuralNetworkTrainer = function (numberOfInputNodes,
svg_el, table_el,
dataPoints, labels,
weights, bias,
gradientDescentButton, gradientDescent10Button, gradientDescent100Button,
Function wrapObject
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const wrapObject = (target, wrappers = {}, metadata = {}) => {
let cache = Object.create(null)
let handlers = {
has (proxyTarget, prop) {
return prop in target || prop in cache
Function initializeHeatmap
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
NN_trainer.prototype.initializeHeatmap = function () {
this.heatmapSideNumberOfElements = 15;
//this.heatmapColors = ['#f7fcf0','#e0f3db','#ccebc5','#a8ddb5','#7bccc4','#4eb3d3','#2b8cbe','#0868ac','#084081'].reverse();
Function updateUI
has 58 lines of code (exceeds 25 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);
Function createReplacer
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer<HTMLImageElement>> {
return {
replace: async (imgEl: HTMLImageElement): Promise<HTMLImageElement> => {
const src = imgEl.src
const imgParentEl = imgEl.parentElement
File sw.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const version = '0.1.0'
let serverUrl
// Cache IDs
let coreID = `core_${version}`
let pageID = `pages_${version}`
Function replace
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
replace: async (imgEl: HTMLImageElement): Promise<HTMLImageElement> => {
const src = imgEl.src
const imgParentEl = imgEl.parentElement
if (imgParentEl.tagName === "FIGURE") {
const captionEl = imgParentEl.querySelector("figcaption")
Function initializeTable
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
neuralNetworkCalculationViz.prototype.initializeTable = function (trainingSet) {
var viz = this
var table = d3.select(this.tableElement)
Function portSearchChange
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function portSearchChange (filter) {
tableBody.innerHTML = ""
const input = (portSearchInput.value || "").toLowerCase().trim()
/**
Function run
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async run(context: SsgContext, inputPattern: string): Promise<void> {
const inputFiles = await glob(inputPattern)
const dictionary = new Dictionary(this.logger)
const dictWords = await dictionary.read(this.dictionaryFile)
this.logger.debug("Looking for files", inputPattern)
Function compute
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
compute: function (probable) {
var zerosCount = {}
var max = 0
var questions = self.questions
for (var q in questions) {