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: 8

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: 10XGenomics/cellranger
Commit Name: c1c5544326a7e2eb080101cf2ca29707b5e41736
Time: 2019-02-20
Author: patrick@10xgenomics.com
File Name: lib/python/cellranger/rna/feature_ref.py
Class Name:
Method Name: parse_feature_def_file


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: nilearn/nilearn
Commit Name: 9b90a754e169998b89633697c45f173711933632
Time: 2017-04-21
Author: salmabougacha@hotmail.com
File Name: nilearn/connectome/connectivity_matrices.py
Class Name: ConnectivityMeasure
Method Name: inverse_transform