d32d9990318cbb0982110662f09596c6256d3ceb,deepchem/models/__init__.py,Model,fit,#Model#Any#,121

Before Change


    
    // TODO(rbharath/enf): This GPU_RAM is black magic. Needs to be removed/made
    // more general.
    MAX_GPU_RAM = float(691007488/50)
    for epoch in range(self.model_params["nb_epoch"]):
      print("Starting epoch %s" % str(epoch+1))
      for i, (X, y, w, _) in enumerate(dataset.itershards()):
        print("Training on batch-%s/epoch-%s" % (str(i+1), str(epoch+1)))
        if sys.getsizeof(X) > MAX_GPU_RAM:
          nb_block = float(sys.getsizeof(X))/MAX_GPU_RAM
          nb_sample = np.shape(X)[0]
          interval_points = np.linspace(nb_sample,nb_block+1).astype(int)
          for j in range(len(interval_points)-1):
            indices = range(interval_points[j],interval_points[j+1])
            X_batch = X[indices,:]
            y_batch = y[indices]
            w_batch = w[indices]
            self.fit_on_batch(X_batch, y_batch, w_batch)
        else:
          self.fit_on_batch(X, y, w)

  // TODO(rbharath): What does this function do when y is not provided. Suspect
  // it breaks. Need to fix.

  // TODO(rbharath): The structure of the produced df might be
  // complicated. Better way to model?
  def predict(self, dataset):
    
    Uses self to make predictions on provided Dataset object.
    

After Change


      for i, (X, y, w, _) in enumerate(dataset.itershards()):
        print("Training on batch-%s/epoch-%s" % (str(i+1), str(epoch+1)))
        nb_sample = np.shape(X)[0]
        interval_points = np.linspace(0,nb_sample, np.ceil(float(nb_sample)/batch_size)+1).astype(int)
        for j in range(len(interval_points)-1):
          indices = range(interval_points[j],interval_points[j+1])
          X_batch = X[indices,:]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: deepchem/deepchem
Commit Name: d32d9990318cbb0982110662f09596c6256d3ceb
Time: 2016-01-12
Author: evan.n.feinberg@gmail.com
File Name: deepchem/models/__init__.py
Class Name: Model
Method Name: fit


Project Name: WheatonCS/Lexos
Commit Name: acadd6b044bc07cbfed6db0eb7c4af603a8ee460
Time: 2017-08-09
Author: darias0826@gmail.com
File Name: lexos/processors/prepare/cutter.py
Class Name:
Method Name: cut_list_with_overlap


Project Name: deepchem/deepchem
Commit Name: 5273d873b9154ad706bfdfcf4fc8e2354fd425c0
Time: 2016-01-16
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/__init__.py
Class Name: Model
Method Name: predict