f1415632872a5f7966d98d714ae84683c5e33723,deepchem/models/tensorgraph/models/text_cnn.py,TextCNNModel,default_generator,#TextCNNModel#Any#Any#Any#Any#Any#,215

Before Change


     Transfer smiles strings to fixed length integer vectors
    
    for epoch in range(epochs):
      if not predict:
        print("Starting epoch %i" % epoch)
      for (X_b, y_b, w_b, ids_b) in dataset.iterbatches(
          batch_size=self.batch_size,
          deterministic=deterministic,
          pad_batches=pad_batches):

        feed_dict = dict()
        if y_b is not None and not predict:
          for index, label in enumerate(self.labels_fd):
            if self.mode == "classification":
              feed_dict[label] = to_one_hot(y_b[:, index])
            if self.mode == "regression":
              feed_dict[label] = y_b[:, index:index + 1]
        if w_b is not None:
          feed_dict[self.weights] = w_b
        // Transform SMILES string to integer vectors
        smiles_seqs = [self.smiles_to_seq(smiles) for smiles in ids_b]
        feed_dict[self.smiles_seqs] = np.stack(smiles_seqs, axis=0)

After Change


    weighted_loss = WeightedError(in_layers=[loss, weights])
    self.set_loss(weighted_loss)

  def default_generator(self,
                        dataset,
                        epochs=1,
                        predict=False,
                        deterministic=True,
                        pad_batches=True):
     Transfer smiles strings to fixed length integer vectors
    
    for epoch in range(epochs):
      for (X_b, y_b, w_b, ids_b) in dataset.iterbatches(
          batch_size=self.batch_size,
          deterministic=deterministic,
          pad_batches=pad_batches):

        feed_dict = dict()
        if y_b is not None and not predict:
          if self.mode == "classification":
            feed_dict[self.labels[0]] = to_one_hot(y_b.flatten(), 2).reshape(
                -1, self.n_tasks, 2)
          else:
            feed_dict[self.labels[0]] = y_b
        if w_b is not None and not predict:
          feed_dict[self.task_weights[0]] = w_b

        // Transform SMILES sequence to integers
        smiles_seqs = [self.smiles_to_seq(smiles) for smiles in ids_b]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 34

Instances


Project Name: deepchem/deepchem
Commit Name: f1415632872a5f7966d98d714ae84683c5e33723
Time: 2018-12-25
Author: vsomnath@student.ethz.ch
File Name: deepchem/models/tensorgraph/models/text_cnn.py
Class Name: TextCNNModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: 8375adccdb984204a235e426d28ed3d7aebd6360
Time: 2018-04-17
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: GraphConvModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: f1415632872a5f7966d98d714ae84683c5e33723
Time: 2018-12-25
Author: vsomnath@student.ethz.ch
File Name: deepchem/models/tensorgraph/models/text_cnn.py
Class Name: TextCNNModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: a453eb76dddb37e087c12d4173033372bc56f9c3
Time: 2018-04-19
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: DAGModel
Method Name: default_generator