How to use the matminer.featurizers.structure.CGCNNFeaturizer function in matminer

To help you get started, we’ve selected a few matminer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / automatminer / automatminer_dev / graphnet / cgcnn.py View on Github external
df = pd.DataFrame(pickle.load(f))[["structure", prop_col]].dropna()
    idx_list = list(range(len(df)))

    kf = KFold(n_splits=5, random_state=18012019, shuffle=True)
    for kf_idx, (remain_index, test_index) in enumerate(kf.split(idx_list)):
        if kf_idx in kf_indices:
            kf_tmp_output_path = os.path.join(
                tmp_output_path, "kfold_{}".format(kf_idx)
            )
            if not os.path.exists(kf_tmp_output_path):
                os.makedirs(kf_tmp_output_path, exist_ok=True)
            train_index, val_index = train_test_split(
                remain_index, test_size=0.25, random_state=18012019, shuffle=True
            )

            cgcnnfz = CGCNNFeaturizer(
                task=args.task,
                distributed=distributed,
                n_works=args.n_works,
                disable_cuda=disable_cuda,
                save_idx=kf_tmp_output_path,
                output_path=kf_tmp_output_path,
                atom_init_fea=atom_features,
                use_batch=False,
                test=args.test,
                dropout_percent=0.5,
                batch_size=args.batch_size,
                warm_start_file=args.warm_start,
                warm_start_latest=True,
                use_pretrained=False,
                save_model_to_dir=os.path.join(kf_tmp_output_path, "model"),
                save_checkpoint_to_dir=os.path.join(kf_tmp_output_path, "checkpoint"),
github hackingmaterials / automatminer / automatminer / featurization / sets.py View on Github external
def _add_external(self, fset):
        # Prevent import errors
        require_external = []
        if torch and cgcnn:
            require_external.append(sf.CGCNNFeaturizer())
        if dscribe:
            require_external.append(sf.SOAP())
        return fset + require_external