示例#1
0
def runTest(conf):
    fiberPropotion, Size, trial, Rank, max_time, dir = conf
    print(
        "Running video trial with the following:\n\tProporion of Fibers = {}\n\tSize = {}\n\tRank = {}\n\tTrialNumber = {}\n\tMax Time = {}"
        .format(fiberPropotion, Size, Rank, trial, maxtime))
    numberOfFibers = Size**2
    FibersSampled = max(int(numberOfFibers * fiberPropotion), 1)

    # Create tensor
    X = videoToTensor("600Test.mp4")

    # init starting
    A_init = initDecomposition(Size, Rank)

    b0 = 0.25

    error, _ = AdaCPDTime(X,
                          b0,
                          FibersSampled,
                          max_time,
                          A_init,
                          sample_interval=0.5,
                          eta=1)
    saveAdaTimeTrial(X, fiberPropotion, Size, trial, Rank, b0, max_time, error,
                     dir)
def runTest(conf):
    fiberPropotion, Size, trial, Rank, max_time, nu, eps, lamb = conf
    print(
        "Running trial with the following:\n\tProporion of Fibers = {}\n\tSize = {}\n\tRank = {}\n\tTrialNumber = {}\n\tMax Time = {}\n\tnu = {}\n\teps={}"
        .format(fiberPropotion, Size, Rank, trial, maxtime, nu, eps))

    # Create tensor
    X = createTensor(Size, Rank)

    # init starting
    A_init = initDecomposition(Size, Rank)

    # X, F, sketching_rates, lamb, eps, eta, Hinit, max_time ,sample_interval=.5

    _, _, _, error, rates = CPDMWUTime(X,
                                       Rank,
                                       fiberPropotion,
                                       lamb,
                                       eps,
                                       nu,
                                       A_init,
                                       max_time,
                                       sample_interval=0.5)
    return sum([error[x] for x in error.keys() if x > 5]) / len(
        [error[x] for x in error.keys() if x > 5])
示例#3
0
def runTest(conf):
    print("running")
    fiberPropotion, Size, trial, Rank, max_time, dir, c_eps, c_eta = conf
    random.seed

    eps = 1 / (c_eps * len(fiberPropotion))
    eta = sqrt(2 * log(len(fiberPropotion)) / c_eta)
    lamb = 0.001

    if eps > 1:
        print("eps")
        return

    # Create tensor
    X = createTensor(Size, Rank)

    # init starting
    A_init = initDecomposition(Size, Rank)

    b0 = 0.25
    # X, F, sketching_rates, lamb, eps, eta, Hinit, max_time ,sample_interval=.5

    print(
        "Running trial with the following:\n\tProporion of Fibers = {}\n\tSize = {}\n\tRank = {}\n\tTrialNumber = {}\n\tMax Time = {}"
        .format(fiberPropotion, Size, Rank, trial, maxtime))
    print("\tc_eps = {}\n\teps={}\n\tc_eta={}\n\teta={}".format(
        c_eps, eps, c_eta, eta))
    _, _, _, error, rates = CPDMWUTime(X,
                                       Rank,
                                       fiberPropotion,
                                       lamb,
                                       eps,
                                       eta,
                                       A_init,
                                       max_time,
                                       sample_interval=0.5)
    saveCPDTimeTrial(
        X,
        fiberPropotion,
        lamb,
        eps,
        eta,
        Size,
        trial,
        Rank,
        max_time,
        error,
        rates,
        c_eps,
        c_eta,
        dir,
    )
示例#4
0
def runTest(conf):
    fiberPropotion, Size, trial, Rank, max_time,dir = conf
    print("Running trial with the following:\n\tProporion of Fibers = {}\n\tSize = {}\n\tRank = {}\n\tTrialNumber = {}\n\tMax Time = {}".format(fiberPropotion, Size, Rank, trial, maxtime))

    #Create tensor
    X = videoToTensor('600Test.mp4')

    #init starting
    A_init = initDecomposition(Size,Rank)

    #X, F, sketching_rates, lamb, eps, nu, Hinit, max_time ,sample_interval=.5
    eps = 1/(1.2len(fiberPropotion))
    nu = sqrt(2 * log(len(fiberPropotion))/50)
    lamb = .001

    A,B,C,error,rates = CPDMWUTime(X, Rank, fiberPropotion, lamb, eps, nu, A_init, max_time,sample_interval=.5)
    saveCPDTimeTrial(X,A,B,C, fiberPropotion, lamb, eps, nu, Size, trial, Rank, max_time, error,rates,dir)
eta_ada = 1

iterations_total = 100

lamb = 0.01

proprtions = np.linspace(0.01, 1, num=10)

eps = 1 / (len(proprtions))
eta_cpd = sqrt(2 * log(len(proprtions)))


X = createTensor(Size, Rank)

# init starting
A_init = initDecomposition(Size, Rank)

A, B, C = A_init[0], A_init[1], A_init[2]

numberOfFibers = Size ** 2
FibersSampled = (numberOfFibers * proprtions).astype(int)

n_mb = 100  # 200*200//5#FibersSampled[5]
norm_x = linalg.norm(X)

errors = {0: ("init", error(X, [A, B, C], norm_x))}
start_time = time.time()

configurationada = collections.namedtuple(
    "Configuration", "X b0 fibers A B C eta Gt norm_x iterations start_time errors"
)