示例#1
0
A_sexage = preprocessing_dataset.str_to_float(A3)
labels, _, _ = read_tadpole.load_csv_no_header(labels_path)

labels = preprocessing_dataset.str_to_float(labels)

M_float = preprocessing_dataset.preprocessing_nan_normalization(M_str)

imp = Imputer(missing_values='NaN', strategy='mean', axis=0)
imp = imp.fit(M_float)

# Impute our data, then train
M_float_imp = imp.transform(M_float)

M = M_float_imp

A_age = preprocessing_dataset.normalize_adj(A_age)
A_sex = preprocessing_dataset.normalize_adj(A_sex)
A_sexage = preprocessing_dataset.normalize_adj(A_sexage)

mask_age = preprocessing_dataset.str_to_float(mask_age)
mask_sex = preprocessing_dataset.str_to_float(mask_sex)
mask_agesex = preprocessing_dataset.str_to_float(mask_agesex)
mask_nosignificance = preprocessing_dataset.str_to_float(mask_nosignificance)

#computation of the normalized laplacians
Lrow_age = csgraph.laplacian(A_age, normed=True)
Lrow_sex = csgraph.laplacian(A_sex, normed=True)
Lrow_agesex = csgraph.laplacian(A_sexage, normed=True)


class Train_test_matrix_completion:
示例#2
0
Wrow, _, _ = read_tadpole.load_csv_no_header(path_dataset_affinity_matrix)
labels, _, _ = read_tadpole.load_csv_no_header(labels_path)

#parameters/preprocessing step that do not change during the running
Wrow = preprocessing_dataset.str_to_float(Wrow)
labels = preprocessing_dataset.str_to_float(labels)
M_float = preprocessing_dataset.preprocessing_nan_normalization(M_str)

imp = Imputer(missing_values='NaN', strategy='mean', axis=0)
imp = imp.fit(M_float)
# Impute our data
M_float_imp = imp.transform(M_float)

M = M_float_imp

Wrow = preprocessing_dataset.normalize_adj(Wrow)
#computation of the normalized laplacians
Lrow = csgraph.laplacian(Wrow, normed=True)

ord_row = 3  # row for the Chebyshev polynomials


class Train_test_matrix_completion:
    """
    The neural network model.
    """
    def frobenius_norm_square(self, tensor):
        """
        Function that returns the squared Frobenius norm of tensor
        Input: tensor: the tensor that we would like to know the norm of
        Output: Frobenius norm of the tensor