Skip to content

Commit 22cafd4

Browse files
authored
Delete unnecessary empty line from JSDoc (#842)
* Delete unnecessary empty line from JSDoc * Update Codacy Badge
1 parent 381bf36 commit 22cafd4

File tree

466 files changed

+83
-1541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

466 files changed

+83
-1541
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![npm version](https://badge.fury.io/js/@ai-on-browser%2Fdata-analysis-models.svg)](https://badge.fury.io/js/@ai-on-browser%2Fdata-analysis-models)
44
[![Coverage Status](https://coveralls.io/repos/github/ai-on-browser/ai-on-browser.github.io/badge.svg?branch=main)](https://coveralls.io/github/ai-on-browser/ai-on-browser.github.io?branch=main)
5-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea85dab39fff442685faeaff53afa1a0)](https://www.codacy.com/gh/ai-on-browser/ai-on-browser.github.io/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ai-on-browser/ai-on-browser.github.io&utm_campaign=Badge_Grade)
5+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea85dab39fff442685faeaff53afa1a0)](https://app.codacy.com/gh/ai-on-browser/ai-on-browser.github.io/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77

88
Machine learning and data analysis package implemented in JavaScript and its online demo.

create_import_list.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ import Complex from './util/complex.js'
8787
code += `
8888
/**
8989
* Default export object.
90-
*
9190
* @module default
9291
* @property {Tensor} Tensor Tensor class
9392
* @property {Matrix} Matrix Matrix class

js/data/loader/audio.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
export default class AudioLoader {
2+
/**
3+
* Load audio data
4+
* @param {Blob} data Audio data
5+
* @returns {Promise<AudioBuffer>} Loaded AudioBuffer
6+
*/
27
static load(data) {
38
return new Promise(resolve => {
49
const reader = new FileReader()

js/data/loader/csv.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import 'https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js'
22

33
export default class CSV {
4+
/**
5+
* @param {Array<Array<*>>} data data
6+
* @param {*} config Config
7+
*/
48
constructor(data, { header = 0 } = {}) {
59
this._data = data
610
this._header = header
@@ -37,6 +41,9 @@ export default class CSV {
3741
})
3842
}
3943

44+
/**
45+
* @type {{name: string; type: string; out?: boolean}}
46+
*/
4047
get info() {
4148
const names = this.columns
4249
const types = this.type
@@ -49,10 +56,10 @@ export default class CSV {
4956
}
5057

5158
/**
52-
*
53-
* @param {string} str
54-
* @param {*} [config]
55-
* @returns {CSV}
59+
* Parse CSV string
60+
* @param {string} str CSV string
61+
* @param {*} [config] Config value
62+
* @returns {CSV} Parsed CSV data
5663
*/
5764
static parse(str, config = {}) {
5865
const delimiter = config.delimiter || ','
@@ -97,10 +104,10 @@ export default class CSV {
97104
}
98105

99106
/**
100-
*
101-
* @param {string | File} value
102-
* @param {*} [config]
103-
* @returns {Promise<CSV>}
107+
* Load CSV data
108+
* @param {string | File} value URL or File
109+
* @param {*} [config] Config
110+
* @returns {Promise<CSV>} Parsed CSV data
104111
*/
105112
static async load(value, config = {}) {
106113
if (typeof value === 'string') {

js/data/loader/document.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import 'https://cdnjs.cloudflare.com/ajax/libs/encoding-japanese/2.0.0/encoding.
44
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.js'
55

66
export default class DocumentLoader {
7+
/**
8+
* Load text data
9+
* @param {Blob} data Plain text or PDF data
10+
* @returns {Promise<string>} Loaded string
11+
*/
712
static load(data) {
813
return new Promise(resolve => {
914
const reader = new FileReader()
@@ -40,10 +45,21 @@ export default class DocumentLoader {
4045
})
4146
}
4247

48+
/**
49+
* Split text
50+
* @param {string} text text
51+
* @returns {string[]} Splitted text
52+
*/
4353
static segment(text) {
4454
return text.split(/[ -@\[-`{-~\s]+/)
4555
}
4656

57+
/**
58+
* Ordinalize texts
59+
* @param {string[]} texts Texts
60+
* @param {*} config Config
61+
* @returns {[string[], number[]]} Containing text and ordinalized texts
62+
*/
4763
static ordinal(texts, { ignoreCase = true } = {}) {
4864
const words = []
4965
const ord = []

js/data/loader/image.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ export default class ImageLoader {
6161
}
6262
}
6363

64+
/**
65+
* Load image data
66+
* @param {Blob | HTMLImageElement | HTMLVideoElement} data Audio data
67+
* @returns {Promise<number[][][]>} Loaded AudioBuffer
68+
*/
6469
static async load(data) {
6570
if (data instanceof Blob) {
6671
return new Promise(resolve => {
@@ -110,6 +115,13 @@ export default class ImageLoader {
110115
}
111116
}
112117

118+
/**
119+
* Reduce image data
120+
* @param {number[][][]} im Image data
121+
* @param {number} step Step size
122+
* @param {'mean' | 'max'} algorithm Reduce algorithm
123+
* @returns {number[][][]} Reduced image data
124+
*/
113125
static reduce(im, step, algorithm = 'mean') {
114126
const x = []
115127
const d = im[0][0].length
@@ -220,6 +232,14 @@ export default class ImageLoader {
220232
}
221233
}
222234

235+
/**
236+
* Convert color space of data
237+
* @param {number[][][]} data Input data
238+
* @param {string} space Convert space name
239+
* @param {boolean} normalize Normalize data between 0 and 1 or not
240+
* @param {number} binary_threshold Threshold for binary space
241+
* @returns {number[][][]} Converted data
242+
*/
223243
static applySpace(data, space, normalize = false, binary_threshold = 180) {
224244
const cp = []
225245
for (let i = 0; i < data.length; i++) {
@@ -231,6 +251,13 @@ export default class ImageLoader {
231251
return cp
232252
}
233253

254+
/**
255+
* Create canvas element
256+
* @param {number[][][]} data Image data
257+
* @param {number} width Width
258+
* @param {number | null} height Height
259+
* @returns {HTMLCanvasElement} Canvas
260+
*/
234261
static createCanvas(data, width = 80, height = null) {
235262
const orgwidth = data[0].length
236263
const orgheight = data.length

js/data/loader/json.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
export default class JSONLoader {
2+
/**
3+
* @param {*[]} json data
4+
* @param {*} [config] Config
5+
*/
26
constructor(json, { columnInfos } = {}) {
37
this._json = json
48
this._columnInfos = columnInfos
@@ -38,22 +42,32 @@ export default class JSONLoader {
3842
this._info[this._info.length - 1].out = true
3943
}
4044

45+
/**
46+
* @type {*[]}
47+
*/
4148
get json() {
4249
return this._json
4350
}
4451

52+
/**
53+
* @type {Array<Array<*>>}
54+
*/
4555
get data() {
4656
return this._data
4757
}
4858

59+
/**
60+
* @type {{name: string; type: string; out?: boolean}}
61+
*/
4962
get info() {
5063
return this._info
5164
}
5265

5366
/**
54-
* @param {string | File} urlOrFile
55-
* @param {*} [config]
56-
* @returns {Promise<JSONLoader>}
67+
* Load JSON data
68+
* @param {string | File} urlOrFile URL string or File
69+
* @param {*} [config] Config
70+
* @returns {Promise<JSONLoader>} JSON data
5771
*/
5872
static async load(urlOrFile, config) {
5973
if (urlOrFile instanceof File) {

lib/evaluate/classification.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Returns accuracy.
3-
*
43
* @param {*[]} pred Predicted classes
54
* @param {*[]} t True classes
65
* @returns {number} Accuracy
@@ -18,7 +17,6 @@ export function accuracy(pred, t) {
1817

1918
/**
2019
* Returns precision with macro average.
21-
*
2220
* @param {*[]} pred Predicted classes
2321
* @param {*[]} t True classes
2422
* @returns {number} Precision
@@ -44,7 +42,6 @@ export function precision(pred, t) {
4442

4543
/**
4644
* Returns recall with macro average.
47-
*
4845
* @param {*[]} pred Predicted classes
4946
* @param {*[]} t True classes
5047
* @returns {number} Recall
@@ -70,7 +67,6 @@ export function recall(pred, t) {
7067

7168
/**
7269
* Returns F-score with macro average.
73-
*
7470
* @param {*[]} pred Predicted classes
7571
* @param {*[]} t True classes
7672
* @param {number} [beta] Positive real factor. Recall is considered `beta` times as important as precision.
@@ -100,7 +96,6 @@ export function fScore(pred, t, beta = 1) {
10096

10197
/**
10298
* Returns Cohen's kappa coefficient.
103-
*
10499
* @param {*[]} pred Predicted classes
105100
* @param {*[]} t True classes
106101
* @returns {number} Cohen's kappa coefficient

lib/evaluate/clustering.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Returns Davies-Bouldin index.
3-
*
43
* @param {Array<Array<number>>} data Original data
54
* @param {*[]} pred Predicted categories
65
* @param {number} p P
@@ -64,7 +63,6 @@ export function davisBouldinIndex(data, pred, p = 2, q = 1) {
6463

6564
/**
6665
* Returns Silhouette coefficient.
67-
*
6866
* @param {Array<Array<number>>} data Original data
6967
* @param {*[]} pred Predicted categories
7068
* @returns {number[]} Silhouette coefficient
@@ -121,7 +119,6 @@ export function silhouetteCoefficient(data, pred) {
121119

122120
/**
123121
* Returns Dunn index.
124-
*
125122
* @param {Array<Array<number>>} data Original data
126123
* @param {*[]} pred Predicted categories
127124
* @param {'max' | 'mean' | 'centroid'} intra_d Intra-cluster distance type
@@ -227,7 +224,6 @@ export function dunnIndex(data, pred, intra_d = 'max', inter_d = 'centroid') {
227224

228225
/**
229226
* Returns Purity.
230-
*
231227
* @param {*[]} pred Predicted categories
232228
* @param {*[]} t True categories
233229
* @returns {number} Purity
@@ -258,7 +254,6 @@ export function purity(pred, t) {
258254

259255
/**
260256
* Returns Rand index.
261-
*
262257
* @param {*[]} pred Predicted categories
263258
* @param {*[]} t True categories
264259
* @returns {number} Rank index
@@ -280,7 +275,6 @@ export function randIndex(pred, t) {
280275

281276
/**
282277
* Returns Dice index.
283-
*
284278
* @param {*[]} pred Predicted categories
285279
* @param {*[]} t True categories
286280
* @param {number} [beta] Positive real factor. Recall is considered `beta` times as important as precision.
@@ -307,7 +301,6 @@ export function diceIndex(pred, t, beta = 1) {
307301

308302
/**
309303
* Returns Jaccard index.
310-
*
311304
* @param {*[]} pred Predicted categories
312305
* @param {*[]} t True categories
313306
* @returns {number} Jaccard index
@@ -333,7 +326,6 @@ export function jaccardIndex(pred, t) {
333326

334327
/**
335328
* Returns Fowlkes-Mallows index.
336-
*
337329
* @param {*[]} pred Predicted categories
338330
* @param {*[]} t True categories
339331
* @returns {number} Fowlkes-Mallows index

lib/evaluate/dimensionality_reduction.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Returns Co-Ranking Matrix.
3-
*
43
* @param {Array<Array<number>>} x Reduced values
54
* @param {Array<Array<number>>} z Original values
65
* @param {number} ks Rank significance

0 commit comments

Comments
 (0)