Skip to content

Commit 34dd852

Browse files
committed
add Javadoc for the zscore methods
1 parent a8276af commit 34dd852

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

src/main/java/net/jamu/matrix/Statistics.java

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,95 @@ public static ComplexMatrixF centerInplace(ComplexMatrixF A) {
197197
return A;
198198
}
199199

200+
/**
201+
* Creates a standard-scored copy of matrix {@code A}, i.e., the values in
202+
* each column of the copy have the mean of the corresponding column in
203+
* {@code A} subtracted and are then scaled to the unit variance of this
204+
* column by dividing the differences by the standard deviation of the
205+
* column values. The result is the signed number of standard deviations
206+
* (z-score) by which the value is above (below) the mean value of what is
207+
* being measured in the corresponding column. Matrix {@code A} doesn't get
208+
* mutated by this computation.
209+
*
210+
* @param A
211+
* the matrix whose columns contain the observations to be
212+
* z-scored
213+
* @return a copy of A that has been z-scored
214+
*/
200215
public static MatrixD zscore(MatrixD A) {
201216
return zscoreInplace(A.copy());
202217
}
203218

219+
/**
220+
* Creates a standard-scored copy of matrix {@code A}, i.e., the values in
221+
* each column of the copy have the mean of the corresponding column in
222+
* {@code A} subtracted and are then scaled to the unit variance of this
223+
* column by dividing the differences by the standard deviation of the
224+
* column values. The result is the signed number of standard deviations
225+
* (z-score) by which the value is above (below) the mean value of what is
226+
* being measured in the corresponding column. Matrix {@code A} doesn't get
227+
* mutated by this computation.
228+
*
229+
* @param A
230+
* the matrix whose columns contain the observations to be
231+
* z-scored
232+
* @return a copy of A that has been z-scored
233+
*/
204234
public static MatrixF zscore(MatrixF A) {
205235
return zscoreInplace(A.copy());
206236
}
207237

238+
/**
239+
* Creates a standard-scored copy of matrix {@code A}, i.e., the values in
240+
* each column of the copy have the mean of the corresponding column in
241+
* {@code A} subtracted and are then scaled to the unit variance of this
242+
* column by dividing the differences by the standard deviation of the
243+
* column values. The result is the signed number of standard deviations
244+
* (z-score) by which the value is above (below) the mean value of what is
245+
* being measured in the corresponding column. Matrix {@code A} doesn't get
246+
* mutated by this computation.
247+
*
248+
* @param A
249+
* the matrix whose columns contain the observations to be
250+
* z-scored
251+
* @return a copy of A that has been z-scored
252+
*/
208253
public static ComplexMatrixD zscore(ComplexMatrixD A) {
209254
return zscoreInplace(A.copy());
210255
}
211256

257+
/**
258+
* Creates a standard-scored copy of matrix {@code A}, i.e., the values in
259+
* each column of the copy have the mean of the corresponding column in
260+
* {@code A} subtracted and are then scaled to the unit variance of this
261+
* column by dividing the differences by the standard deviation of the
262+
* column values. The result is the signed number of standard deviations
263+
* (z-score) by which the value is above (below) the mean value of what is
264+
* being measured in the corresponding column. Matrix {@code A} doesn't get
265+
* mutated by this computation.
266+
*
267+
* @param A
268+
* the matrix whose columns contain the observations to be
269+
* z-scored
270+
* @return a copy of A that has been z-scored
271+
*/
212272
public static ComplexMatrixF zscore(ComplexMatrixF A) {
213273
return zscoreInplace(A.copy());
214274
}
215275

276+
/**
277+
* Subtracts the mean of each column {@code j} from each value in that
278+
* column {@code j} and then divides the difference by the standard
279+
* deviation of the values in column {@code j}, effectively expressing the
280+
* values in each column as the signed number of standard deviations
281+
* (z-score) by which they are above or below the column's mean value. This
282+
* is a destructive operation that changes matrix {@code A} inplace.
283+
*
284+
* @param A
285+
* the matrix whose columns contain the observations to be
286+
* z-scored
287+
* @return the matrix {@code A} z-scored inplace
288+
*/
216289
public static MatrixD zscoreInplace(MatrixD A) {
217290
int rows_ = checkNotRowVector(A);
218291
int cols_ = A.numColumns();
@@ -252,6 +325,19 @@ public static MatrixD zscoreInplace(MatrixD A) {
252325
return A;
253326
}
254327

328+
/**
329+
* Subtracts the mean of each column {@code j} from each value in that
330+
* column {@code j} and then divides the difference by the standard
331+
* deviation of the values in column {@code j}, effectively expressing the
332+
* values in each column as the signed number of standard deviations
333+
* (z-score) by which they are above or below the column's mean value. This
334+
* is a destructive operation that changes matrix {@code A} inplace.
335+
*
336+
* @param A
337+
* the matrix whose columns contain the observations to be
338+
* z-scored
339+
* @return the matrix {@code A} z-scored inplace
340+
*/
255341
public static MatrixF zscoreInplace(MatrixF A) {
256342
int rows_ = checkNotRowVector(A);
257343
int cols_ = A.numColumns();
@@ -291,6 +377,19 @@ public static MatrixF zscoreInplace(MatrixF A) {
291377
return A;
292378
}
293379

380+
/**
381+
* Subtracts the mean of each column {@code j} from each value in that
382+
* column {@code j} and then divides the difference by the standard
383+
* deviation of the values in column {@code j}, effectively expressing the
384+
* values in each column as the signed number of standard deviations
385+
* (z-score) by which they are above or below the column's mean value. This
386+
* is a destructive operation that changes matrix {@code A} inplace.
387+
*
388+
* @param A
389+
* the matrix whose columns contain the observations to be
390+
* z-scored
391+
* @return the matrix {@code A} z-scored inplace
392+
*/
294393
public static ComplexMatrixD zscoreInplace(ComplexMatrixD A) {
295394
int rows_ = checkNotRowVector(A);
296395
int cols_ = A.numColumns();
@@ -351,6 +450,19 @@ public static ComplexMatrixD zscoreInplace(ComplexMatrixD A) {
351450
return A;
352451
}
353452

453+
/**
454+
* Subtracts the mean of each column {@code j} from each value in that
455+
* column {@code j} and then divides the difference by the standard
456+
* deviation of the values in column {@code j}, effectively expressing the
457+
* values in each column as the signed number of standard deviations
458+
* (z-score) by which they are above or below the column's mean value. This
459+
* is a destructive operation that changes matrix {@code A} inplace.
460+
*
461+
* @param A
462+
* the matrix whose columns contain the observations to be
463+
* z-scored
464+
* @return the matrix {@code A} z-scored inplace
465+
*/
354466
public static ComplexMatrixF zscoreInplace(ComplexMatrixF A) {
355467
int rows_ = checkNotRowVector(A);
356468
int cols_ = A.numColumns();

0 commit comments

Comments
 (0)