<commit_before>from load_data import LoadDataStreams, BatchSize
from network_utils import BuildNeuralNetwork 
import time

import theano
import theano.tensor as T

import lasagne
from lasagne.layers import *
from lasagne.nonlinearities import *

from functools import partial

NETWORK_SPEC = [
  { 'type': Conv2DLayer,
    'args': {
      'num_filters': 32,
      'filter_size': (5, 5),
      'nonlinearity': rectify,
      'W': lasagne.init.GlorotUniform()
    }
  },
  { 'type': MaxPool2DLayer,
    'args': {
      'pool_size': (2, 2)
    }
  },
  { 'type': Conv2DLayer,
    'args': {
      'num_filters': 32,
      'filter_size': (5, 5),
      'nonlinearity': rectify,
      'W': lasagne.init.GlorotUniform()
    }
  },
  { 'type': MaxPool2DLayer,
    'args': {
      'pool_size': (2, 2)
    }
  },
  { 'type': dropout,
    'args': { 'p': 0.5 }
  },
  { 'type': DenseLayer,
    'args': {
      'num_units': 200,
      'nonlinearity': rectify
    }
  },
  { 'type': DenseLayer,
    'args': {
      'num_units': 10,
      'nonlinearity': softmax
    }
  }
]

LEARNING_RATE=0.001
MOMENTUM=0.95

input_values = T.tensor4('inputs')
input_targets = T.ivector('targets')

INPUT_SPEC = {
  'shape': (BatchSize(), 3, 32, 32),
  'input_var': input_values
}

def TrainNeuralNetwork(input_var, targets_var, data, network, iterations=2,
        verify_fns=[], verify_data_col=[]):
    prediction = lasagne.layers.get_output(network)
    loss = lasagne.objectives.categorical_crossentropy(prediction, targets_var)
    loss = loss.mean()

    net_params = lasagne.layers.get_all_params(network, trainable=True)
    updates = lasagne.updates.nesterov_momentum(loss, net_params,
                                                learning_rate=LEARNING_RATE, <commit_msg>Decreased number of hidden neurons in dense layer. Fixed LEARNING RATE and MOMENTUM parameters<commit_after>from load_data import LoadDataStreams, BatchSize
from network_utils import BuildNeuralNetwork 
import time

import theano
import theano.tensor as T

import lasagne
from lasagne.layers import *
from lasagne.nonlinearities import *

from functools import partial

NETWORK_SPEC = [
  { 'type': Conv2DLayer,
    'args': {
      'num_filters': 32,
      'filter_size': (5, 5),
      'nonlinearity': rectify,
      'W': lasagne.init.GlorotUniform()
    }
  },
  { 'type': MaxPool2DLayer,
    'args': {
      'pool_size': (2, 2)
    }
  },
  { 'type': Conv2DLayer,
    'args': {
      'num_filters': 32,
      'filter_size': (5, 5),
      'nonlinearity': rectify,
      'W': lasagne.init.GlorotUniform()
    }
  },
  { 'type': MaxPool2DLayer,
    'args': {
      'pool_size': (2, 2)
    }
  },
  { 'type': dropout,
    'args': { 'p': 0.5 }
  },
  { 'type': DenseLayer,
    'args': {
      'num_units': 100,
      'nonlinearity': rectify
    }
  },
  { 'type': DenseLayer,
    'args': {
      'num_units': 10,
      'nonlinearity': softmax
    }
  }
]

LEARNING_RATE=0.01
MOMENTUM=0.9

input_values = T.tensor4('inputs')
input_targets = T.ivector('targets')

INPUT_SPEC = {
  'shape': (BatchSize(), 3, 32, 32),
  'input_var': input_values
}

def TrainNeuralNetwork(input_var, targets_var, data, network, iterations=2,
        verify_fns=[], verify_data_col=[]):
    prediction = lasagne.layers.get_output(network)
    loss = lasagne.objectives.categorical_crossentropy(prediction, targets_var)
    loss = loss.mean()

    net_params = lasagne.layers.get_all_params(network, trainable=True)
    updates = lasagne.updates.nesterov_momentum(loss, net_params,
                                                learning_rate=LEARNING_RATE, 
{'fraction_non_alphanumeric': 0.13855589629216616, 'fraction_numerical': 0.020072483969891274, 'mean_word_length': 3.0179171332586785, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '291384', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1285, 'n_words': 255}