dcd82a95dee25d14cdf112b5be18e6dc0a19c7eb,cli.py,,main,#,33

Before Change


            
    
    // Feature extraction
    if args.mode == "features":
        df, has_index_col = parse_data()
        print(df)
    

if __name__ == "__main__":
    sys.exit(main(sys.argv))

After Change


    
    // === FEATURE EXTRACTION ===
    // We expect an image filepath or folder of images
    if args.mode == "extract":
        assert os.path.exists(args.data),\
            "Extract mode (data arg): File or directory not found: "{}""\
            .format(args.data)
            
        // Calculate and write to args.out
        features = extract_features(args.data, model=args.model, write_to=args.out)
            
        
    // === DIMENSION REDUCTION ===
    // We expect a .csv file of features
    elif args.mode in ["tsne", "umap"]:
        
        // Make sure we know what columns are intended to be used numerically as a list of strings, or "all"
        numeric_cols = args.numeric_cols
        if numeric_cols is None:
            raise Exception("Feature reduction mode: No data column indices provided. Example usage: "--numeric-cols B,C,F", "--numeric-cols all"")
        elif numeric_cols != "all":
            numeric_cols = [s.strip() for s in numeric_cols.split(",") if s.strip() != ""]
        
        // Parse the data into a squashed pd.DataFrame with first column being unique keys
        df = parse_data(args.data, numeric_cols, args.unique_col)
        
        if args.mode == "tsne":
            tsne(df, dims=int(args.reduce), write_to=args.out)
            
        elif args.mode == "umap":
            raise NotImplementedError("UMAP is not finished")
    

if __name__ == "__main__":
    sys.exit(main(sys.argv))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: zegami/image-similarity-clustering
Commit Name: dcd82a95dee25d14cdf112b5be18e6dc0a19c7eb
Time: 2020-03-18
Author: douglawrence0010@gmail.com
File Name: cli.py
Class Name:
Method Name: main


Project Name: Logan1x/Python-Scripts
Commit Name: 2ef5c047b4296a807eea8366f67d7f271f0d47de
Time: 2020-06-28
Author: 59202862+Monsieurvishal@users.noreply.github.com
File Name: bin/password-strength-checker.py
Class Name:
Method Name: pass1


Project Name: ultralytics/yolov3
Commit Name: 0bc1db58d82c2482bfac1e32a3a43cfd5a533da2
Time: 2021-01-10
Author: glenn.jocher@ultralytics.com
File Name: utils/google_utils.py
Class Name:
Method Name: attempt_download