示例#1
0
    def train(self,
              dataset_type: str,
              metric: str,
              save_dir: str,
              model_type: str = 'chemprop',
              flags: List[str] = None):
        # Set up command line arguments
        raw_args = self.create_raw_train_args(
            dataset_type=dataset_type,
            metric=metric,
            save_dir=save_dir,
            model_type=model_type,
            flags=flags
        )

        # Train
        with patch('sys.argv', raw_args):
            command_line = ' '.join(raw_args[1:])

            if model_type == 'chemprop':
                print(f'python train.py {command_line}')
                chemprop_train()
            else:
                print(f'python sklearn_train.py {command_line}')
                sklearn_train()
示例#2
0
    def train(self, dataset_type: str, metric: str, save_dir: str):
        # Set up command line arguments for training
        raw_train_args = self.create_raw_train_args(
            dataset_type=dataset_type,
            metric=metric,
            save_dir=save_dir
        )

        # Train
        with patch('sys.argv', raw_train_args):
            chemprop_train()
示例#3
0
"""Trains a chemprop model on a dataset."""

from chemprop.train import chemprop_train

if __name__ == "__main__":
    chemprop_train()