| |
- calculate_l21_norm(X)
- This function calculates the l21 norm of a matrix X, i.e., \sum ||X[i,:]||_2
Input:
-----
X: {numpy array}, shape (n_samples, n_features)
Output:
------
l21_norm: {float}
- construct_label_matrix(label)
- This function converts a 1d numpy array to a 2d array, for each instance, the class label is 1 or 0
Input:
-----
label: {numpy array}, shape(n_samples,)
Output:
------
label_matrix: {numpy array}, shape(n_samples, n_classes)
- construct_label_matrix_pan(label)
- This function converts a 1d numpy array to a 2d array, for each instance, the class label is 1 or -1
Input:
-----
label: {numpy array}, shape(n_samples,)
Output:
------
label_matrix: {numpy array}, shape(n_samples, n_classes)
- euclidean_projection(V, n_features, n_classes, z, gamma)
- L2 Norm regularized euclidean projection min_W 1/2 ||W- V||_2^2 + z * ||W||_2
- feature_ranking(W)
- This function ranks features according to the feature weights matrix W
Input:
-----
W: {numpy array}, shape (n_features, n_classes)
feature weights matrix
Output:
------
idx: {numpy array}, shape {n_features,}
feature index ranked in descending order by feature importance
- generate_diagonal_matrix(U)
- This function generates a diagonal matrix D from an input matrix U as D_ii = 0.5 / ||U[i,:]||
Input:
-----
U: {numpy array}, shape (n_samples, n_features)
Output:
------
D: {numpy array}, shape (n_samples, n_samples)
- tree_lasso_projection(v, n_features, idx, n_nodes)
- This functions solves the following optimization problem min_w 1/2 ||w-v||_2^2 + \sum z_i||w_{G_{i}}||
where w and v are of dimensions of n_features; z_i >=0, and G_{i} follows the tree structure
- tree_norm(w, n_features, idx, n_nodes)
- This function computes \sum z_i||w_{G_{i}}||
|