Esempio n. 1
0
    def __init__(self,
                 input_file=None,
                 data_file=None,
                 save_tensors_dir=None,
                 keep_tensors=False,
                 out_dir=None,
                 normalize=False):
        self.model = None
        self.input_file = input_file
        self.data_file = data_file
        self.save_tensors_dir = save_tensors_dir
        self.keep_tensors = keep_tensors
        self.out_dir = out_dir
        self.normalize = normalize
        self.datasets = None
        self.add_extra_atom_attribute = None
        self.add_extra_bond_attribute = None
        self.differentiate_atom_type = None
        self.differentiate_bond_type = None
        self.padding = None
        self.padding_final_size = None
        self.prediction_task = None
        self.y_mean = None
        self.y_std = None

        if self.input_file is not None:
            read_input_file(self.input_file, self)

        self.get_data_from_file = False
        if self.data_file is not None:
            if self.data_file.endswith('.csv'):
                self.get_data_from_file = True
            else:
                self.specify_datasets(self.data_file)
Esempio n. 2
0
    def load_input(self, input_file):
        """
        This method is intended to provide a way to build model from an input file
        """
        if input_file:
            self.input_file = input_file

        read_input_file(self.input_file, self)
Esempio n. 3
0
    def test_read_input_file(self):

        predictor_test = Predictor()

        path = os.path.join(os.path.dirname(dde.__file__), 'test_data',
                            'minimal_predictor', 'predictor_input.py')
        read_input_file(path, predictor_test)

        predictor_model = predictor_test.model
        self.assertEqual(len(predictor_model.layers), 4)
        self.assertTrue(isinstance(predictor_model.layers[1], MoleculeConv))
        self.assertTrue(isinstance(predictor_model.layers[2], Dense))

        self.assertEqual(predictor_model.layers[1].inner_dim, 38)
        self.assertEqual(predictor_model.layers[1].units, 512)