예제 #1
0
            t1 = timeit.default_timer()
            r = func(*args, **keyArgs)
            t2 = timeit.default_timer()
            times.append(t2-t1)
        print (min(times))
        return r
    return st_func


p = args.size[0]
n = args.size[1]

X = rand(p,n)
Xp = rand(p,n)
y = rand(p,n)

regr = linear_model.Ridge()

@st_time
def test_fit(X,y):
    regr.fit(X,y)

@st_time
def test_predict(X):
    regr.predict(X)

print (','.join([args.batchID, args.arch, args.prefix, "Ridge.fit", coreString(args.num_threads), "Double", "%sx%s" % (p,n)]), end=',')
test_fit(X, y)
print (','.join([args.batchID, args.arch, args.prefix, "Ridge.prediction", coreString(args.num_threads), "Double", "%sx%s" % (p,n)]), end=',')
test_predict(Xp)
예제 #2
0

@st_time
def test_transform(Xp, pca_result, eigenvalues, eigenvectors):
    return pca_transform_daal(pca_result,
                              Xp,
                              n_components,
                              X.shape[0],
                              eigenvalues,
                              eigenvectors,
                              whiten=args.whiten)


print(','.join([
    args.batchID, args.arch, args.prefix, "PCA.fit",
    coreString(args.num_threads), "Double",
    "%sx%s" % (p, n)
]),
      end=',')
res = test_fit(X)
print(','.join([
    args.batchID, args.arch, args.prefix, "PCA.transform",
    coreString(args.num_threads), "Double",
    "%sx%s" % (p, n)
]),
      end=',')
tr = test_transform(Xp, res[0], res[1], res[2])

if args.write_results:
    np.save('pca_daal4py_X.npy', X)
    np.save('pca_daal4py_Xp.npy', Xp)