Пример #1
0
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/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)
Пример #2
0
from scipy.sparse import csr_matrix
from scipy import sparse

desc = "Testing StandardScaler inverse_transform(), without 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")
sparseMatrix = sparse.csr_matrix(train_mat)

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

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

FrovedisServer.shut_down()
Пример #3
0
from frovedis.mllib.preprocessing import StandardScaler

desc = "Testing StandardScaler transform(), with fit. "  #on dense data(numpy.array)

# 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")

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

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

try:
    trans_mat = ss.transform(train_mat)
    print(desc, "Passed")
except:
    print(desc, "Failed")

FrovedisServer.shut_down()
Пример #4
0
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.preprocessing import StandardScaler

desc = "Testing for accessing 'var_' attribute after calling fit() on Dense data(numpy.array) "

# 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")

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

ss.fit(train_mat)

try:
    ss.var_
    print(desc, "Passed")
except:
    print(desc, "Failed")

FrovedisServer.shut_down()
Пример #5
0
import sys
import numpy as np
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.preprocessing import StandardScaler

desc = "Testing for accessing 'mean_' attribute without calling fit() on Dense data(numpy.array)"

# 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")

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

try:
    ss.mean_
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #6
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()
Пример #7
0
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.preprocessing import StandardScaler
from frovedis.matrix.dense import FrovedisColmajorMatrix

desc = "Testing StandardScaler transform(), without 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:
    trans_mat = ss.transform(mat)
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #8
0
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.preprocessing import StandardScaler

desc = "Test with_mean and with_std is None"

# 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")

try:
    ss = StandardScaler(True, None, None, False)
    ss.fit(train_mat)
    trans_mat = ss.transform(train_mat)
    inverse_trans_mat = ss.inverse_transform(trans_mat)
    print(ss.mean_)
    print(ss.var_)
    print(desc, "Passed")
except:
    print(desc, "Failed")

FrovedisServer.shut_down()

Пример #9
0
from scipy.sparse import csr_matrix
from scipy import sparse

desc = "Testing StandardScaler transform(), with fit, with_mean = true "  #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, True, True, False, 0)

try:
    ss.fit(sparseMatrix)
    trans_mat = ss.transform(train_mat)
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #10
0
from frovedis.mllib.preprocessing import StandardScaler
from scipy.sparse import csr_matrix
from scipy import sparse

desc = "Testing for accessing 'var_' attribute after calling fit(), with_mean = true "  # 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)

try:
    ss = StandardScaler(True, True, True, False, 0)
    ss.fit(sparseMatrix)
    ss.var_
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #11
0
from scipy import sparse

desc =  " Test for explicitly setting 'mean' 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.mean_ = [5.5, 2.0]
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #12
0
from frovedis.mllib.preprocessing import StandardScaler

desc = " Test for explicitly setting 'mean' attribute "

# 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")

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

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

try:
    ss.mean_ = [5.5, 2.0]
    print(desc, "Failed")
except:
    print(desc, "Passed")

FrovedisServer.shut_down()
Пример #13
0
from frovedis.exrpc.server import FrovedisServer
from frovedis.mllib.preprocessing import StandardScaler

desc =  " Testing for explicitly setting 'variance' attribute on Dense data(numpy.array) "

# 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")

# creating Standard Scaler object
ss = StandardScaler(True, True, True, False, 0)
# fitting the training matrix on Standard Scaler object
ss.fit(train_mat)
ss.transform(train_mat)


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

FrovedisServer.shut_down()