<commit_before>import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer import computational_graph
from chainer import optimizers
from chainer import serializers

import six
import numpy as np
import math
import time
from Convert2Complex import *
#plt.ion()



# Network definition
class StructuredMLP(chainer.Chain):

    def __init__(self, n_in, n_units1, n_units2):
        
        super(StructuredMLP, self).__init__(
            l1a=L.Linear(n_in, n_units1[0]),  # first layer
            l1b=L.Linear(n_in, n_units1[0]),  # first layer
            l2a=L.Linear(n_units1[0],n_units1[1]),  # first layer
            l2b=L.Linear(n_units1[0],n_units1[1]),  # first layer
            l3=L.Linear(n_units1[1]*2, n_units2[0]),  # second layer
            l4=L.Linear(n_units2[0], n_units2[1]),  # output layer
            l5=L.Linear(n_units2[1], 2),  # output layer
        )
        self.name = 'smlp'

    def __call__(self, x, t):
        x = x[0]
        # print x[:,0:2].shape
        # print x[:,2:4].shape
        # assert False
        h1a = F.relu(self.l1a(x[:,0:2]))
        h1b = F.relu(self.l1b(x[:,2:4]))
        h2a = F.relu(self.l2a(h1a))
        h2b = F.relu(self.l2b(h1b))
        h_conc = F.concat((h2a,h2b))
        h3 = F.relu(self.l3(h_conc))
        h4 = F.relu(self.l4(h3))
        y = self.l5(h4)
        self.loss = F.mean_squared_error(y, t)
        #self.accuracy = F.accuracy(y, t)
        self.y = y
        return self.loss


        # h1a = F.relu(self.l1a(x[0]))
        # h1b = F.relu(self.l1b(x[1]))
        # h2a = F.relu(self.l2a(h1a))
        # h2b = F.relu(self.l2b(h1b))
        # h_conc = F.concat((h2a,h2b))
        # h3 = F.relu(self.l3(h_conc))
        # h4 = F.relu(self.l4(h3))
        # y = self.l5(h4)
        # self.loss = F.mean_squared_error(y, t)
        # #self.accuracy = F.accuracy(y, t)
        # self.y = y
        # return self.loss


# Network definition
class BaseMLP(chainer.ChainList):

    def __init__(self, n_in, n_units, n_out):
        
        super(BaseMLP, self).__init__()
        self.add_link(L.Linear(n_in, n_units[0]))
        for i in range(len(n_units)-1):
            # layers_l.append(L.Linear(n_units[i], n_units[i+1]))
            self.add_link(L.Linear(n_units[i], n_units[i+1]))
        self.add_link(L.Linear(n_units[-1], n_out))
        self.num_layers = len(n_units) + 2
        self.name = 'bmlp'

    def __call__(self, x, t):
        h_i = x
        for i in range(self.num_layers-2):
            h_i = F.relu(self[i](h_i))

        y = self[-1](h_i)

        self.loss = F.mean_squared_error(y, t)
        self.y = y
<commit_msg>errors with tabs.... :(<commit_after>import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer import computational_graph
from chainer import optimizers
from chainer import serializers

import six
import numpy as np
import math
import time
from Convert2Complex import *
#plt.ion()

def fun():

	pass

# Network definition
class StructuredMLP(chainer.Chain):

    def __init__(self, n_in, n_lower, n_upper, n_out, col_idxs):
        super(StructuredMLP, self).__init__(
            l1a=L.Linear(n_in, n_units1[0]),  # first layer
            l1b=L.Linear(n_in, n_units1[0]),  # first layer
            l2a=L.Linear(n_units1[0],n_units1[1]),  # first layer
            l2b=L.Linear(n_units1[0],n_units1[1]),  # first layer
            l3=L.Linear(n_units1[1]*2, n_units2[0]),  # second layer
            l4=L.Linear(n_units2[0], n_units2[1]),  # output layer
            l5=L.Linear(n_units2[1], 2),  # output layer
        )
        self.name = 'smlp'

    def __call__(self, x, t):
        x = x[0]
        h1a = F.relu(self.l1a(x[:,0:2]))
        h1b = F.relu(self.l1b(x[:,2:4]))
        h2a = F.relu(self.l2a(h1a))
        h2b = F.relu(self.l2b(h1b))
        h_conc = F.concat((h2a,h2b))
        h3 = F.relu(self.l3(h_conc))
        h4 = F.relu(self.l4(h3))
        y = self.l5(h4)
        self.loss = F.mean_squared_error(y, t)
        self.y = y
        return self.loss


# Network definition
class BaseMLP(chainer.ChainList):

    def __init__(self, n_in, n_units, n_out):

        super(BaseMLP, self).__init__()
        self.add_link(L.Linear(n_in, n_units[0]))
        for i in range(len(n_units)-1):
            self.add_link(L.Linear(n_units[i], n_units[i+1]))
        self.add_link(L.Linear(n_units[-1], n_out))
        self.num_layers = len(n_units) + 2
        self.name = 'bmlp'

    def __call__(self, x, t):
        h_i = x
        for i in range(self.num_layers-2):
            h_i = F.relu(self[i](h_i))

        y = self[-1](h_i)

        self.loss = F.mean_squared_error(y, t)
        self.y = y

{'fraction_non_alphanumeric': 0.14511373209772535, 'fraction_numerical': 0.03243470935130581, 'mean_word_length': 2.3071030640668524, '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': '3788799', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1899, 'n_words': 351}