c753a3bf6c768eb45c0b4bad556161b7389fde65,finetune/util/imbalance.py,,class_weight_tensor,#Any#Any#Any#,45

Before Change


    
    class_weight_arr = np.ones(target_dim, dtype=np.float32)
    for class_name, class_weight in class_weights.items():
        idx = LabelEncoder.transform(label_encoder, [class_name])[0]
        class_weight_arr[idx] = class_weight
    class_weight_tensor = tf.convert_to_tensor(class_weight_arr)
    return class_weight_tensor

After Change


    Convert from dictionary of class weights to tf tensor
    
    class_weight_arr = np.ones(target_dim, dtype=np.float32)
    for i, cls in enumerate(label_encoder.target_labels):
        class_weight_arr[i] = class_weights.get(cls, 1.0)

    class_weight_tensor = tf.convert_to_tensor(class_weight_arr)
    return class_weight_tensor
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: IndicoDataSolutions/finetune
Commit Name: c753a3bf6c768eb45c0b4bad556161b7389fde65
Time: 2020-01-10
Author: benlt@hotmail.co.uk
File Name: finetune/util/imbalance.py
Class Name:
Method Name: class_weight_tensor


Project Name: dirty-cat/dirty_cat
Commit Name: ff8dccc29edca64877b3cef1b53c7958ce321f76
Time: 2018-03-14
Author: patricio.cerda@inria.fr
File Name: dirty_cat/test/test_similarity_encoder.py
Class Name:
Method Name: test_similarity_encoder


Project Name: rtavenar/tslearn
Commit Name: 85aabb5014e22659ac722280607a1f4b44e1fb32
Time: 2020-05-03
Author: romain.tavenard@univ-rennes2.fr
File Name: tslearn/shapelets.py
Class Name: ShapeletModel
Method Name: fit