Ejemplo n.º 1
0
desc = " Test for explicitly setting 'var_' attribute "  #sparse csr_matrix

# initializing the Frovedis server
argvs = sys.argv
argc = len(argvs)
if (argc < 2):
    print(
        'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 /opt/nec/frovedis/ve/bin/frovedis_server")'
    )
    quit()
FrovedisServer.initialize(argvs[1])

#dense data
train_mat = np.loadtxt("./input/gmm_data.txt")
sparseMatrix = sparse.csr_matrix(train_mat)

# creating Standard Scaler object
ss = StandardScaler(True, False, True, False, 0)

# fitting the training matrix on Standard Scaler object
ss.fit(sparseMatrix)

try:
    ss.var_ = [32.75, 3.5]
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Ejemplo n.º 2
0
        'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 /opt/nec/frovedis/ve/bin/frovedis_server")'
    )
    quit()
FrovedisServer.initialize(argvs[1])

#dense data
train_mat = np.loadtxt("./input/kmeans_data.txt")

#sparse data
#train_mat = csr_matrix(train_mat)

# creating Standard Scaler object
ss = StandardScaler(with_mean=True, with_std=True)

# fitting the training matrix on Standard Scaler object
ss.fit(train_mat)

#attributes
print("Mean: ")
print(ss.mean_)
print("Var: ")
print(ss.var_)

#transform
trans_mat = ss.transform(train_mat)
print("transformed data::")
print(trans_mat)

#inverse transform
inverse_trans_mat = ss.inverse_transform(trans_mat)
print("inversed data")
Ejemplo n.º 3
0
desc = "Testing StandardScaler inverse_transform(), with fit. "  #sparse csr_matrix

# initializing the Frovedis server
argvs = sys.argv
argc = len(argvs)
if (argc < 2):
    print(
        'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 /opt/nec/frovedis/ve/bin/frovedis_server")'
    )
    quit()
FrovedisServer.initialize(argvs[1])

#dense data
train_mat = np.loadtxt("./input/gmm_data.txt")

mat = FrovedisColmajorMatrix(train_mat)

# creating Standard Scaler object
ss = StandardScaler(True, True, True, False, 0)

try:
    ss.fit(mat)
    trans_mat = ss.transform(mat)
    inverse_tran_mat = ss.inverse_transform(trans_mat)
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()