def __init__(self):
     dataset = data.german_credit_numeric()
     del dataset['test_features']
     del dataset['test_labels']
     super(GermanCreditNumericLogisticRegression, self).__init__(
         name='german_credit_numeric_logistic_regression',
         pretty_name='German Credit Numeric Logistic Regression',
         **dataset)
Exemple #2
0
 def load_dataset_in_xla():
     dataset = data.german_credit_numeric()
     # The actual dataset loading will happen in Eager mode, courtesy of the
     # init_scope.
     return (
         tf.convert_to_tensor(dataset['train_features']),
         tf.convert_to_tensor(dataset['train_labels']),
     )
Exemple #3
0
def german_credit_numeric_logistic_regression():
    """German credit (numeric) logistic regression.

  Returns:
    target: StanModel.
  """
    dataset = data.german_credit_numeric()
    del dataset['test_features']
    del dataset['test_labels']
    return logistic_regression.logistic_regression(**dataset)
Exemple #4
0
def german_credit_numeric_sparse_logistic_regression():
    """German credit (numeric) logistic regression with a sparsity-inducing prior.

  Returns:
    target: StanModel.
  """
    dataset = data.german_credit_numeric()
    del dataset['test_features']
    del dataset['test_labels']
    return sparse_logistic_regression.sparse_logistic_regression(**dataset)
Exemple #5
0
 def testGermanCreditNumeric(self):
   dataset = data.german_credit_numeric(train_fraction=0.75)
   self.assertEqual((750, 24), dataset['train_features'].shape)
   self.assertEqual((750,), dataset['train_labels'].shape)
   self.assertEqual((250, 24), dataset['test_features'].shape)
   self.assertEqual((250,), dataset['test_labels'].shape)
   self.assertAllClose(
       np.zeros([24]), dataset['train_features'].mean(0), atol=1e-5)
   self.assertAllClose(
       np.ones([24]), dataset['train_features'].std(0), atol=1e-5)
   self.assertAllClose(
       np.zeros([24]), dataset['test_features'].mean(0), atol=0.3)
   self.assertAllClose(
       np.ones([24]), dataset['test_features'].std(0), atol=0.3)