[SOLVED] import numpy as np

$25

File Name: import_numpy_as_np.zip
File Size: 169.56 KB

5/5 - (1 vote)

import numpy as np

def rescaleNormalization(dataArray):
min = dataArray.min()
denom = dataArray.max() min
newValues = []
for x in dataArray:
newX = (x min) / denom
newValues.append(newX)
return newValues

def rescaleMatrix(dataMatrix):
colCount = len(dataMatrix[0])
rowCount = len(dataMatrix)
newMatrix = np.zeros(dataMatrix.shape)
for i in range(0, colCount):
min = dataMatrix[:,i].min()
denom = dataMatrix[:,i].max() min
for k in range(0, rowCount):
newX = (dataMatrix[k,i] min) / denom
newMatrix[k,i] = newX
return newMatrix

def meanNormalization(dataArray):
mean = np.mean(dataArray)
denom = dataArray.max() dataArray.min()
newValues = []
for x in dataArray:
newX = (x mean) / denom
newValues.append(newX)
return newValues

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] import numpy as np
$25