eval.py
def predictCV(model, x, y, k=3):
  """
  Makes predictions over the training set using a cross-validation loop
  such that the predictions for each instance are from the model trained 
  when that instance was held out.
  
  Params:
    model - The model used. Model state will be changed by training.
    x - training features
    y - training labels
    k - # of CV folds
    
  Returns: a 2-tuple
    pred - a numpy array of 0-1 predictions, similar to what gets submitted.
    dvs - a numpy array of the decision values of the SVC
  """
  folds = KFold(y.shape[0], k)
  pred = 0*y
  dvs = 0*y
  for train, val in folds:
    model.fit(x[train], y[train])
    dvs[val] = model.decision_function(x[val])
    pred[val] = model.predict(x[val])
  return (pred, dvs)

  Makes predictions over the training set using a cross-validation loop
  such that the predictions for each instance are from the model trained 
  when that instance was held out.
  
  Params:
    model - The model used. Model state will be changed by training.
    x - training features
    y - training labels
    k - # of CV folds
    
  Returns: a 2-tuple
    pred - a numpy array of 0-1 predictions, similar to what gets submitted.
    dvs - a numpy array of the decision values of the SVC
  
Makes predictions over the training set using a cross-validation loop
such that the predictions for each instance are from the model trained
when that instance was held out.

The model used. Model state will be changed by training.
x - training features
y - training labels
k - # of CV folds

a 2-tuple
pred - a numpy array of 0-1 predictions, similar to what gets submitted.
dvs - a numpy array of the decision values of the SVC
Makes predictions over the training set using a cross - validation loop such that the predictions for each instance are from the model trained when that instance was held out . The model used . Model state will be changed by training . x - training features y - training labels k - # of CV folds a 2 - tuple pred - a numpy array of 0 - 1 predictions similar to what gets submitted . dvs - a numpy array of the decision values of the SVC
def predictCV(model, x, y, k=3):
  folds = KFold(y.shape[0], k)
  pred = 0*y
  dvs = 0*y
  for train, val in folds:
    model.fit(x[train], y[train])
    dvs[val] = model.decision_function(x[val])
    pred[val] = model.predict(x[val])
  return (pred, dvs)
def predictCV ( model , x , y , k = 3 ) : folds = KFold ( y . shape [ 0 ] , k ) pred = 0 * y dvs = 0 * y for train , val in folds : model . fit ( x [ train ] , y [ train ] ) dvs [ val ] = model . decision_function ( x [ val ] ) pred [ val ] = model . predict ( x [ val ] ) return ( pred , dvs )
Makes predictions over the training set using a cross-validation loop
such that the predictions for each instance are from the model trained
when that instance was held out.
Makes predictions over the training set using a cross - validation loop such that the predictions for each instance are from the model trained when that instance was held out .
"""
  Makes predictions over the training set using a cross-validation loop
  such that the predictions for each instance are from the model trained 
  when that instance was held out.
  
  Params:
    model - The model used. Model state will be changed by training.
    x - training features
    y - training labels
    k - # of CV folds
    
  Returns: a 2-tuple
    pred - a numpy array of 0-1 predictions, similar to what gets submitted.
    dvs - a numpy array of the decision values of the SVC
  """
model
x
y
k