File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1- const ck = require ( 'chalk' )
21const { join} = require ( 'path' )
2+ const ck = require ( 'chalk' )
33const labels = require ( join ( __dirname , './labels.json' ) )
44const cats = require ( join ( __dirname , './categories.json' ) )
55
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class ConfusionMatrix {
8181 this . matrix = objectify ( this . classes )
8282 for ( const category in this . matrix ) {
8383 if ( this . matrix . hasOwnProperty ( category ) )
84- this . matrix [ category ] = objectify ( this . classes , 0 )
84+ { this . matrix [ category ] = objectify ( this . classes , 0 ) }
8585 }
8686 } else this . matrix = matrix
8787 }
@@ -130,7 +130,7 @@ class ConfusionMatrix {
130130 */
131131 static fromData ( actual , predictions , classes = [ ] ) {
132132 if ( actual . length !== predictions . length )
133- throw new Error ( "actual and predictions don't have the same length" )
133+ { throw new Error ( "actual and predictions don't have the same length" ) }
134134 const cm = new ConfusionMatrix (
135135 classes . length ? classes : [ ...actual , ...predictions ] ,
136136 )
Original file line number Diff line number Diff line change @@ -102,14 +102,14 @@ class Learner {
102102 predicted . push ( guess ) //Ignores the rest (as it only wants one guess)
103103 if ( log ) {
104104 if ( guess === data . output )
105- succ ( `Classified "${ data . input } " as "${ guess } "` )
105+ { succ ( `Classified "${ data . input } " as "${ guess } "` ) }
106106 else
107- error (
107+ { error (
108108 `Classified "${ data . input } " as "${ guess } " instead of "${ use (
109109 'info' ,
110110 data . output ,
111111 ) } "`,
112- )
112+ ) }
113113 }
114114 spinner . message (
115115 `Evaluating instances (${ Math . round ( ( idx ++ / len ) * 10000 ) / 100 } %)` ,
@@ -337,7 +337,7 @@ class Learner {
337337 ++ res [ data . output ] . overall
338338 if ( hasInput ( this . trainSet , data . input ) ) ++ res [ data . output ] . train
339339 if ( hasInput ( this . validationSet , data . input ) )
340- ++ res [ data . output ] . validation
340+ { ++ res [ data . output ] . validation }
341341 if ( hasInput ( this . testSet , data . input ) ) ++ res [ data . output ] . test
342342 } )
343343
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const copy = el => {
1111 typeof el === 'number' ||
1212 typeof el === 'boolean'
1313 )
14- return el
14+ { return el }
1515 //As they are immutable types
1616 else {
1717 const clone = { }
@@ -124,7 +124,7 @@ const rmEmpty = matrix => {
124124 const nonEmpty = { }
125125 for ( const row in matrix ) {
126126 if ( matrix . hasOwnProperty ( row ) && ! empty . includes ( row ) )
127- nonEmpty [ row ] = matrix [ row ]
127+ { nonEmpty [ row ] = matrix [ row ] }
128128 }
129129 return nonEmpty
130130}
@@ -140,7 +140,7 @@ const rmEmpty = matrix => {
140140 */
141141const hexSeries = ( position , start = 0.1 , inc = 0.1 ) => {
142142 if ( position < 0 || position > 2 )
143- throw new Error ( 'position needs be between 0 and 2' )
143+ { throw new Error ( 'position needs be between 0 and 2' ) }
144144 const TEMPLATE = [ '00' , '00' , '00' ]
145145 const res = [ ]
146146 for ( let i = start ; i <= 1 ; i += inc ) {
You can’t perform that action at this time.
0 commit comments