<commit_before>from nolearn.dbn import DBN
from readfacedatabases import *
from sklearn import cross_validation
from sklearn.metrics import zero_one_score
from sklearn.metrics import classification_report

import argparse
import numpy as np

from common import *

parser = argparse.ArgumentParser(description='nolearn test')
parser.add_argument('--equalize',dest='equalize',action='store_true', default=False,
                    help="if true, the input images are equalized before being fed into the net")
parser.add_argument('--maxEpochs', type=int, default=1000,
                    help='the maximum number of supervised epochs')

args = parser.parse_args()


def KanadeClassifier():

  clf = DBN(
      [1200, 1500, 1500, 1500, 7],
      learn_rates=0.1,
      learn_rates_pretrain=0.05,
      learn_rate_decays=0.9,
      use_re_lu=True,
      nesterov=True,
      momentum=0.95,
      real_valued_vis=True,
      minibatch_size=20,
      epochs=args.maxEpochs,
      verbose=False
      )

  data, labels = readKanade(False, None, equalize=args.equalize)

  data = scale(data)

  data, labels = shuffle(data, labels)

  labels = np.argmax(labels, axis=1)

  # Split data for training and testing
  kf = cross_validation.KFold(n=len(data), n_folds=5)
  for train, test in kf:
    break

  trainData = data[train]
  trainLabels = labels[train]


  testData = data[test]
  testLabels = labels[test]

<commit_msg>passing the dropout params to no learn as well<commit_after>from nolearn.dbn import DBN
from readfacedatabases import *
from sklearn import cross_validation
from sklearn.metrics import zero_one_score
from sklearn.metrics import classification_report

import argparse
import numpy as np

from common import *

parser = argparse.ArgumentParser(description='nolearn test')
parser.add_argument('--equalize',dest='equalize',action='store_true', default=False,
                    help="if true, the input images are equalized before being fed into the net")
parser.add_argument('--maxEpochs', type=int, default=1000,
                    help='the maximum number of supervised epochs')

args = parser.parse_args()


def KanadeClassifier():

  clf = DBN(
      [1200, 1500, 1500, 1500, 7],
      learn_rates=0.1,
      learn_rates_pretrain=0.05,
      learn_rate_decays=0.9,
      use_re_lu=True,
      nesterov=True,
      momentum=0.95,
      dropouts=[0.8, 0.5, 0.5, 0.5, 1],
      real_valued_vis=True,
      minibatch_size=20,
      epochs=args.maxEpochs,
      verbose=False
      )

  data, labels = readKanade(False, None, equalize=args.equalize)

  data = scale(data)

  data, labels = shuffle(data, labels)

  labels = np.argmax(labels, axis=1)

  # Split data for training and testing
  kf = cross_validation.KFold(n=len(data), n_folds=5)
  for train, test in kf:
    break

  trainData = data[train]
  trainLabels = labels[train]


  testData = data[test]
  testLabels = labels[test]


{'fraction_non_alphanumeric': 0.09975920192638459, 'fraction_numerical': 0.02717578259373925, 'mean_word_length': 3.6012658227848102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7516561', 'n_tokens_mistral': 1024, 'n_tokens_neox': 934, 'n_words': 239}