示例#1
0
    #window_length=200
    #overlap_points=185
    #kt=2
    #kf=2
    #perf=69.04%
    tol = np.power(10, -6, dtype=float)
    maximum_iterations = 10

    C_values = np.power(10, np.linspace(-2, 9, 6), dtype=float)
    #C_values=np.linspace(0.001,10000,20)
    G_values = np.power(10, np.linspace(-4, -1, 4), dtype=float)

    Hyper_values = np.array([np.power(10, -8, dtype=float)])  #10^(-2)

    C_svm, G_svm, hyperparam, matrixscore = Methods.Cross_valHALs(
        Tensor_train, y_train, C_values, G_values, Hyper_values, nbclasses, kf,
        kt, maximum_iterations, tol)

    #We perform the decomposition of the training tensor
    #The decomposition yields:
    #The error related to each updating error_list;
    #The temporal and spectral dictionary components A_f and A_t;
    #The number of iterations and the activation coefficients G;
    #We dimension purpose, we can reduce the size of the tensor to be decomposed.This can be done in the following way:
    #Tensor_train=dtensor(Preprocessing.rescaling(Tensor_train,If,It)) where If and It correspond to the desired sizes.
    G, A_f, A_t, error_list = Methods.PenalizedTuckerHals(
        Tensor_train, y_train, nbclasses, kf, kt, hyperparam,
        maximum_iterations, tol)
    #
    #We define the training features. They are obtained by vectorizing the matrices G[k,:,:]
    #Training_features=Methods.Training_features_extraction(G)