Skip to content

Commit

Permalink
update 2022-07-05
Browse files Browse the repository at this point in the history
  • Loading branch information
YGZWQZD committed Jul 5, 2022
1 parent 55ebb7e commit 62aa1e2
Show file tree
Hide file tree
Showing 134 changed files with 1,086 additions and 107 deletions.
6 changes: 6 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/Assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
class Assemble(InductiveEstimator,ClassifierMixin):
def __init__(self, base_estimater=config.base_estimater,T=config.T,alpha=config.alpha,
beta=config.beta,evaluation=config.evaluation,verbose=config.verbose,file=config.file):
# >> Parameter:
# >> - base_model: A base learner for ensemble learning.
# >> - T: the number of base learners. It is also the number of iterations.
# >> - alpha: the weight of each sample when the sampling distribution is updated.
# >> - Beta: used to initialize the sampling distribution of labeled data and unlabeled data.

self.base_estimater=base_estimater
self.T=T
self.alpha=alpha
Expand Down
8 changes: 8 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/Co_Training.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class Co_Training(InductiveEstimator,ClassifierMixin):
def __init__(self, base_estimator=config.base_estimator, base_estimator_2=config.base_estimator_2,
p=config.p, n=config.n, k=config.k, s=config.s, evaluation=config.evaluation,
verbose=config.verbose, file=config.file):
# >> Parameter:
# >> - base_estimator: the first learner for co-training.
# >> - base_estimator_2: the second learner for co-training.
# >> - p: In each round, each base learner selects at most p positive samples to assign pseudo-labels.
# >> - n: In each round, each base learner selects at most n negative samples to assign pseudo-labels.
# >> - k: iteration rounds.
# >> - s: the size of the buffer pool in each iteration.

self.base_estimator = base_estimator
self.base_estimator_2=base_estimator_2
self.p=p
Expand Down
11 changes: 11 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/FixMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):

# >> Parameter:
# >> - threshold: The confidence threshold for choosing samples.
# >> - lambda_u: The weight of unsupervised loss.
# >> - T: Sharpening temperature.
# >> - num_classes: The number of classes for the classification task.
# >> - thresh_warmup: Whether to use threshold warm-up mechanism.
# >> - use_hard_labels: Whether to use hard labels in the consistency regularization.
# >> - use_DA: Whether to perform distribution alignment for soft labels.
# >> - p_target: p(y) based on the labeled examples seen during training

DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
labeled_dataset=labeled_dataset,
Expand Down
9 changes: 9 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/FlexMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - threshold: The confidence threshold for choosing samples.
# >> - lambda_u: The weight of unsupervised loss.
# >> - T: Sharpening temperature.
# >> - num_classes: The number of classes for the classification task.
# >> - thresh_warmup: Whether to use threshold warm-up mechanism.
# >> - use_hard_labels: Whether to use hard labels in the consistency regularization.
# >> - use_DA: Whether to perform distribution alignment for soft labels.
# >> - p_target: p(y) based on the labeled examples seen during training
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
4 changes: 4 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/GCN.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - num_features: Node feature dimension.
# >> - num_classes: Number of classes.
# >> - normalize: Whether to use symmetric normalization.
DeepModelMixin.__init__(self,
epoch=epoch,
weight_decay=weight_decay,
Expand Down
4 changes: 4 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/ICT.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def __init__(self,
evaluation=config.evaluation,
file=config.file,
verbose=config.verbose):
# >> Parameter:
# >> - warmup: Warm up ratio for unsupervised loss.
# >> - lambda_u: The weight of unsupervised loss.
# >> - alpha: the parameter of Beta distribution in Mixup.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
11 changes: 11 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/ImprovedGAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ def __init__(self,
parallel=config.parallel,
file=config.file,
verbose=config.verbose):
# >> Parameter:
# >> - dim_in: The dimension of a single instance.
# >> - num_classes: The number of classes.
# >> - dim_z: The dimension of the latent variables used to generate the data.
# >> - hidden_G: The hidden layer dimension of the neural network as the generator. If there are multiple hidden layers, it is represented by a list.
# >> - hidden_D: The hidden layer dimension of the neural network as the discriminator. If there are multiple hidden layers, it is represented by a list.。
# >> - noise_level: The noise level of each layer of the discriminator.
# >> - activations_G: The activation function of each layer of the generator.
# >> - activations_D: The activation function of each layer of the discriminator.
# >> - lambda_u: The weight of unsupervised loss.
# >> - num_labeled: The number of labeled samples.
DeepModelMixin.__init__(self, train_dataset=train_dataset,
labeled_dataset=labeled_dataset,
unlabeled_dataset=unlabeled_dataset,
Expand Down
8 changes: 7 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/LabelPropagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ def __init__(
n_jobs=config.n_jobs,evaluation=config.evaluation,
verbose=config.verbose,file=config.file
):

# >> Parameter:
# >> - kernel: The kernel function which can be inputted as a string 'rbf' or 'knn' or as a callable function.
# >> - gamma: The gamma value when the kernel function is rbf kernel.
# >> - n_neighbors: The n value when the kernel function is n_neighbors kernel.
# >> - max_iter: The maximum number of iterations.
# >> - tol: Convergence tolerance.
# >> - n_jobs: The number of parallel jobs.
self.max_iter = max_iter
self.tol = tol

Expand Down
9 changes: 8 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/LabelSpreading.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ def __init__(
n_jobs=config.n_jobs,evaluation=config.evaluation,
verbose=config.verbose,file=config.file
):

# >> Parameter:
# >> - kernel: 'rbf'、'knn' or callable. Specifies the kernel type to be used in the algorithm.
# >> - gamma: The gamma value when the kernel function is rbf kernel.
# >> - n_neighbors: The n value when the kernel function is n_neighbors kernel.
# >> - alpha: The proportion of labels updates in each iteration.
# >> - max_iter: The maximum number of iterations.
# >> - tol: Convergence tolerance.
# >> - n_jobs: The number of parallel jobs.
self.max_iter = max_iter
self.tol = tol

Expand Down
8 changes: 7 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/LadderNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ def __init__(self,
file=config.file,
verbose=config.verbose,
):

# >> Parameter:
# >> - dim_in: The dimension of a single instance.
# >> - num_classes: The number of classes.
# >> - noise_std: The noise level of each layer of the discriminator.
# >> - lambda_u: The proportion of consistency loss of each layer in LadderNetwork.
# >> - encoder_sizes: The dimension of each layer of the encoder.
# >> - encoder_activations: The activation function of each layer of the encoder.
DeepModelMixin.__init__(self, train_dataset=train_dataset,
labeled_dataset=labeled_dataset,
unlabeled_dataset=unlabeled_dataset,
Expand Down
9 changes: 9 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/LapSVM.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def __init__(self,
gamma_A= config.gamma_A,
gamma_I= config.gamma_I,evaluation=config.evaluation,
verbose=config.verbose,file=config.file):
# >> Parameter:
# >> - distance_function: The distance function for building the graph. This Pamater is valid when neighbor_mode is None.
# >> - gamma_d: Kernel parameters related to distance_function.
# >> - neighbor_mode: The edge weight after constructing the graph model by k-nearest neighbors. There are two options 'connectivity' and 'distance', 'connectivity' returns a 0-1 matrix, and 'distance' returns a distance matrix.
# >> - n_neighbor: k value of k-nearest neighbors.
# >> - kernel_function: The kernel function corresponding to SVM.
# >> - gamma_k: The gamma parameter corresponding to kernel_function.
# >> - gamma_A: Penalty weight for function complexity.
# >> - gamma_I: Penalty weight for smoothness of data distribution.
self.distance_function=distance_function
self.neighbor_mode=neighbor_mode
self.n_neighbor=n_neighbor
Expand Down
4 changes: 4 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/MeanTeacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - ema_decay: Update weights for the exponential moving average.
# >> - warmup: The end position of warmup. For example, num_it_total is 100 and warmup is 0.4, then warmup is performed in the first 40 iterations.
# >> - lambda_u: The weight of unsupervised loss.
DeepModelMixin.__init__(self, train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
5 changes: 5 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/MixMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - lambda_u: The weight of unsupervised loss.
# >> - T: Sharpening temperature for soft labels.
# >> - num_classes: The number of classes.
# >> - alpha: The parameter of the beta distribution in Mixup.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
4 changes: 4 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/PiModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def __init__(self,lambda_u=config.lambda_u,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - lambda_u: The weight of unsupervised loss.
# >> - warmup: The end position of warmup. For example, num_it_total is 100 and warmup is 0.4,
# then warmup is performed in the first 40 iterations.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
3 changes: 3 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/PseudoLabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - lambda_u: The weight of unsupervised loss.
# >> - threshold: Confidence threshold for selecting samples.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
9 changes: 9 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/ReMixMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - lambda_u: The weight of unsupervised loss.
# >> - T: Sharpening temperature for soft labels.
# >> - num_classes: The number of classes.
# >> - alpha: The parameter of the beta distribution in Mixup.
# >> - p_target: The target distribution of labeled data.
# >> - lambda_s: The weight for unsupervised loss computed based on pre-mixup data.
# >> - lambda_rot: The weight of rotation angle classification loss.
# >> - rotate_v_list: A list of rotation angles.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
7 changes: 7 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/S4L.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):
# >> Parameter:
# >> - lambda_u: The weight of unsupervised loss.
# >> - num_classes: The number of classes.
# >> - p_target: The target distribution of labeled data.
# >> - rotate_v_list: A list of rotation angles.
# >> - labeled_usp: Whether to use labeled data when computing the unsupervised loss.
# >> - all_rot: Whether to rotate samples by all angles in rotate_v_list.
DeepModelMixin.__init__(self,train_dataset=train_dataset,
valid_dataset=valid_dataset,
test_dataset=test_dataset,
Expand Down
10 changes: 9 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/SDNE.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ def __init__(self,
file=config.file,
verbose=config.verbose
):

# >> Parameter:
# >> - xeqs: Whether to use the adjacency matrix as the feature matrix of the node.
# >> - input_dim: The dimension of node features. It is valid when xeqs is False.
# >> - num_nodes: The number of nodes.
# >> - hidden_layers: Encoder hidden layer dimension.
# >> - alpha: The weight of Laplacian regularization.
# >> - gamma: The weight of L2 regularation.
# >> - beta: The weight of the edges in the graph that are not 0 in the loss of consistency between the input and output of the autoencoder.
# >> - base_estimator: A supervised learner that classifies using the node features obtained by the encoder.
DeepModelMixin.__init__(self,
epoch=epoch,
weight_decay=weight_decay,
Expand Down
4 changes: 4 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/SSGMM.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
class SSGMM(InductiveEstimator,ClassifierMixin):
def __init__(self,tolerance=config.tolerance, max_iterations=config.max_iterations, num_classes=config.num_classes,
evaluation=config.evaluation,verbose=config.verbose,file=config.file):
# >> Parameter
# >> - num_classes: The number of classes.
# >> - tolerance: Tolerance for iterative convergence.
# >> - max_iterations: The maximum number of iterations.
self.num_classes=num_classes
self.tolerance=tolerance
self.max_iterations=max_iterations
Expand Down
13 changes: 12 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/SSVAE.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ def __init__(self,
parallel=config.parallel,
file=config.file,
verbose=config.verbose):

# >> Parameter
# >> - alpha: The weight of classification loss.
# >> - dim_in: The dimension of the input sample.
# >> - num_classes: The number of classes.
# >> - dim_z: The dimension of the hidden variable z.
# >> - dim_hidden_de: The hidden layer dimension of the decoder.
# >> - dim_hidden_en_y: The hidden layer dimension of the encoder for y.
# >> - dim_hidden_en_z: The hidden layer dimension of the encoder for z.
# >> - activations_de: The activation functions of the decoder.
# >> - activations_en_y: The activation functions of the encoder for y.
# >> - activations_en_z: The activation functions of the encoder for z.
# >> - num_labeled: The number of labeled samples.
DeepModelMixin.__init__(self, train_dataset=train_dataset,
labeled_dataset=labeled_dataset,
unlabeled_dataset=unlabeled_dataset,
Expand Down
7 changes: 7 additions & 0 deletions LAMDA_SSL/Algorithm/Classifier/Self_Training.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def __init__(self,base_estimator=config.base_estimator,
k_best=config.k_best,
max_iter=config.max_iter,
evaluation=config.evaluation,verbose=config.verbose,file=config.verbose):
# >> Parameter:
# >> - base_estimator: The base supervised learner used in the Self_training algorithm.
# >> - criterion: There are two forms: 'threshold' and 'k_best', the former selects samples according to the threshold, and the latter selects samples according to the ranking.
# >> - threshold: When criterion is 'threshold', the threshold used for selecting samples during training.
# >> - k_best: When criterion is 'k_best', select the top k samples of confidence from training.
# >> - max_iter: The maximum number of iterations.
# >> - verbose: Whether to allow redundant output.
self.base_estimator=base_estimator
self.threshold=threshold
self.criterion=criterion
Expand Down
10 changes: 9 additions & 1 deletion LAMDA_SSL/Algorithm/Classifier/SemiBoost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ def __init__(self, base_estimator = config.base_estimator,
sigma_percentile = config.sigma_percentile,
similarity_kernel = config.similarity_kernel,gamma=config.gamma,
evaluation=config.evaluation,verbose=config.verbose,file=config.file):

# >> Parameter:
# >> - base_estimator: The base supervised learner used in the algorithm.
# >> - similarity_kernel: 'rbf'、'knn' or callable. Specifies the kernel type to be used in the algorithm.
# >> - n_neighbors: It is valid when the kernel function is 'knn', indicating the value of k in the k nearest neighbors.
# >> - n_jobs: It is valid when the kernel function is 'knn', indicating the number of parallel jobs.
# >> - gamma: It is valid when the kernel function is 'rbf', indicating the gamma value of the rbf kernel.
# >> - max_models: The most number of models in the ensemble.
# >> - sample_percent: The number of samples sampled at each iteration as a proportion of the remaining unlabeled samples.
# >> - sigma_percentile: Scale parameter used in the 'rbf' kernel.
self.BaseModel = base_estimator
self.n_neighbors=n_neighbors
self.n_jobs=n_jobs
Expand Down
Loading

0 comments on commit 62aa1e2

Please sign in to comment.