(data)
| 25 | * column as 1d tensors. |
| 26 | */ |
| 27 | export function determineMeanAndStddev(data) { |
| 28 | const dataMean = data.mean(0); |
| 29 | // TODO(bileschi): Simplify when and if tf.var / tf.std added to the API. |
| 30 | const diffFromMean = data.sub(dataMean); |
| 31 | const squaredDiffFromMean = diffFromMean.square(); |
| 32 | const variance = squaredDiffFromMean.mean(0); |
| 33 | const dataStd = variance.sqrt(); |
| 34 | return {dataMean, dataStd}; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Given expected mean and standard deviation, normalizes a dataset by |
nothing calls this directly
no outgoing calls
no test coverage detected