MCPcopy Create free account

hub / github.com/BladeDancer957/CPFD / functions

Functions60 in github.com/BladeDancer957/CPFD

↓ 6 callersFunctionget_label_distribution
(y_lists,label_list, count=False)
src/dataloader.py:397
↓ 6 callersMethodsave_model
save the best model
src/trainer.py:374
↓ 5 callersFunctionread_ner
(datapath, phase, label_list)
src/dataloader.py:233
↓ 4 callersMethodforward_classifier
(self, features)
src/model.py:52
↓ 4 callersFunctionget_default_label_list
(entity_list, schema='BIO')
src/dataloader.py:215
↓ 4 callersMethodset_unseen_labels_to_O
(self, y_train, seen_label_list)
src/dataloader.py:501
↓ 3 callersMethodevaluate
(self, dataloader, each_class=False, entity_order=[], is_plot_hist=False, is_plot_cm=False)
src/trainer.py:275
↓ 3 callersFunctionget_params
()
src/config.py:6
↓ 2 callersMethod__init__
(self, output_dim, params)
src/model.py:18
↓ 2 callersMethodbatch_forward
(self, inputs)
src/trainer.py:43
↓ 2 callersFunctionentropy
Computes the entropy per token. :param probabilities: Tensor of shape (bsz,seq_len,refer_dims). :return: One entropy per token, shape (bsz,se
src/utils.py:26
↓ 2 callersMethodforward_encoder
features features[0]: hidden_states; features[1]: all_hidden_states(embedding layer + 12 layer output hidden, 13*(bsz, seq_l
src/model.py:41
↓ 2 callersMethodget_dataloader
(self, first_N_classes=-1, select_entity_list=[], phase=['train','dev','test'], is_filter_O=None, filter_entit
src/dataloader.py:510
↓ 2 callersMethodload_model
load the checkpoint
src/trainer.py:390
↓ 2 callersFunctionplot_embedding
Plot the feature X Params: - X: a feature matrix has dims (num_samples, hidden_dims) - Y: a label list has d
src/utils.py:292
↓ 1 callersMethodbatch_backward
(self)
src/trainer.py:267
↓ 1 callersMethodbatch_loss
Cross-Entropy Loss
src/trainer.py:51
↓ 1 callersMethodbatch_loss_cpfd
(self, labels)
src/trainer.py:116
↓ 1 callersMethodbefore
(self, train_loader)
src/trainer.py:101
↓ 1 callersMethodcalculate_sample_weight
(self, labels)
src/trainer.py:104
↓ 1 callersFunctioncompute_class_feature_center
Get features and targets Params: - dataloader: torch.utils.data.DataLoader - feature_model: a model returns
src/utils.py:79
↓ 1 callersFunctioncompute_feature_by_dataloader
Compute the feature of dataloader{(X, Y)}, X has dims (num_sentences, num_words) Params: - dataloader: torch.utils.data.
src/utils.py:118
↓ 1 callersFunctioncreate_logger
Create logger for the experiment Params: - filepath: the path which the log file is saved
src/utils.py:571
↓ 1 callersFunctionentity_sampler
(inputs_train, y_train, label_list, unbalanced=False, n_samples=10)
src/dataloader.py:324
↓ 1 callersMethodfind_median
(self, train_loader)
src/trainer.py:64
↓ 1 callersFunctionget_flatten_for_nested_list
Return a flatten version of the nested_list contains only select_labels, and a position matrix. Params:
src/utils.py:258
↓ 1 callersFunctionget_saved_path
Create a directory to store the experiment Params: - params: a dict contains all hyper-parameters and experimental setti
src/utils.py:609
↓ 1 callersFunctioninit_experiment
Initialize the experiment, save parameters and create a logger Params: - params: a dict contains all hyper-parameters an
src/utils.py:530
↓ 1 callersFunctionmain_cl
(params)
main_CL.py:17
↓ 1 callersFunctionpdist
Compute the L2 distance of all features Params: - e: a feature matrix has dims (num_samples, hidden_dims) -
src/utils.py:193
↓ 1 callersFunctionplot_centers
Plot the feature centers X Params: - X: a feature matrix has dims (num_classes, hidden_dims) - label_list: a
src/utils.py:306
↓ 1 callersFunctionplot_confusion_matrix
Plot confusion matrix for model predictions Params: - pred_list: a tensor has dims (num_samples,) - y_list:
src/utils.py:397
↓ 1 callersFunctionplot_prob_hist_each_class
Plot probability histogram for each class Params: - y_list: a tensor has dims (num_samples,) - logits_list:
src/utils.py:429
↓ 1 callersMethodreset_parameters
(self)
src/model.py:70
↓ 1 callersFunctionspilt_dataset
(datapath, phase, entity_list, nb_class_fg, nb_class_pg, schema)
src/dataloader.py:106
Method__getitem__
(self, index)
src/dataloader.py:302
Method__init__
(self)
src/utils.py:555
Method__init__
(self, inputs, ys)
src/dataloader.py:298
Method__init__
(self, data_path, domain_name, batch_size, entity_list=[], n_samples=-1, is_filter_O=False, schema='BIO', is_l
src/dataloader.py:420
Method__init__
(self, params, model, label_list)
src/trainer.py:31
Method__init__
(self, hidden_dim, output_dim, sigma=True)
src/model.py:59
Method__init__
(self, hidden_dim, old_output_dim, new_output_dim, sigma=True)
src/model.py:102
Method__len__
(self)
src/dataloader.py:305
Functionassert_no_old_samples
Check the labels contains no samples from old classes Params: - labels: a 2-dimentional tensor - ref_dims: t
src/utils.py:514
Functioncollate_fn
(data)
src/dataloader.py:308
Functioncompute_feature_by_input
Compute the feature of X Params: - X: input sentences have dims (num_sentences, num_words) - feature_model:
src/utils.py:168
Functionconvert_BIOES_to_BIO
(in_datapath, out_datapath)
src/dataloader.py:179
Functiondecode_sentence
Decode the sentences batch from ids to words (string) Params: - sentence: a list of ids (encoded by the tokenizer)
src/utils.py:468
Functiondecode_word_from_sentence
Decode the i-th word from sentence Params: - sentence: a list of ids (encoded by the tokenizer) - pos_idx: t
src/utils.py:491
Methodformat
(self, record)
src/utils.py:558
Methodforward
(self, X, return_feat=False)
src/model.py:34
Methodforward
(self, input, num_head=1)
src/model.py:76
Methodforward
(self, x, num_head=1)
src/model.py:115
Functionget_center
Compute the class center of X, Note that this function is suitable for all classes computation, A better implementation will
src/utils.py:36
Functionget_entity_list
(datapth)
src/dataloader.py:196
Functionget_match_id
Compute the nearest samples id for each sample, Params: - flatten_feat_train: a matrix has dims (num_samples, hidden_dim
src/utils.py:215
Functionplot_distribution
Visualize the feature X in the 2-D space Params: - X: a feature matrix has dims (num_samples, hidden_dims) -
src/utils.py:323
Functionprint_split_data_statistic
(datapath, phase, entity_list, nb_class_fg, nb_class_pg, schema)
src/dataloader.py:41
Functionreset_time
()
src/utils.py:602
Functionspilt_dataset_random
(datapath, phase, entity_list, nb_class_fg, nb_class_pg, schema)
src/dataloader.py:56