def benchmark_throughputs(configuration, duration_secs=0.1):
 (X_train, y_train, X_test, y_test) = generate_dataset(configuration['n_train'], configuration['n_test'], configuration['n_features'])
 throughputs = dict()
 for estimator_config in configuration['estimators']:
  estimator_config['instance'].fit(X_train, y_train)
  start_time = time.time()
  n_predictions = 0
  while ((time.time() - start_time) < duration_secs):
   estimator_config['instance'].predict(X_test[[0]])
   n_predictions += 1
  throughputs[estimator_config['name']] = (n_predictions / duration_secs)
 return throughputs

def benchmark_throughputs ( configuration , duration_secs = 0.1 ) : ( X_train , y_train , X_test , y_test ) = generate_dataset ( configuration [ 'n_train' ] , configuration [ 'n_test' ] , configuration [ 'n_features' ] ) throughputs = dict ( ) for estimator_config in configuration [ 'estimators' ] : estimator_config [ 'instance' ] . fit ( X_train , y_train ) start_time = time . time ( ) n_predictions = 0 while ( ( time . time ( ) - start_time ) < duration_secs ) : estimator_config [ 'instance' ] . predict ( X_test [ [ 0 ] ] ) n_predictions += 1 throughputs [ estimator_config [ 'name' ] ] = ( n_predictions / duration_secs ) return throughputs
benchmark throughput for different estimators .