<commit_before># -*- coding: utf-8 -*-
"""
Created on Sat Feb 27 18:43:21 2016

@author: <NAME>
"""

import tensorflow as tf
import numpy as np

#Return the classification accuracy
#given a vector of target labels and
#predicted labels
#y: The target labels
#yHat: The predicted labels
#return: The percentage correct
def _Accuracy(y, yHat):
    n = len(y)
    return np.sum(y == yHat) / n

#Create the MLP variables for TF graph
#_X: The input matrix
#_W: The weight matrices
#_B: The bias vectors
#_AF: The activation function
def _CreateMLP(_X, _W, _B, _AF):
    n = len(_W)
    for i in range(n - 1):
        _X = _AF(tf.matmul(_X, _W[i]) + _B[i]) 
    return tf.matmul(_X, _W[n - 1]) + _B[n - 1]<commit_msg>Added more documentation to TFMLP.py<commit_after>#TFMLP.py
#This file contains a class implementing a multi-layer perceptron (MLP)
#using numpy and tensorflow. Both a MLP for regression (MLPR) and a MLP
#for classification (MLPC) are provided.
import tensorflow as tf
import numpy as np

#Return the classification accuracy
#given a vector of target labels and
#predicted labels
#y: The target labels
#yHat: The predicted labels
#return: The percentage correct
def _Accuracy(y, yHat):
    n = len(y)
    return np.sum(y == yHat) / n

#Create the MLP variables for TF graph
#_X: The input matrix
#_W: The weight matrices
#_B: The bias vectors
#_AF: The activation function
def _CreateMLP(_X, _W, _B, _AF):
    n = len(_W)
    for i in range(n - 1):
        _X = _AF(tf.matmul(_X, _W[i]) + _B[i]) 
    return tf.matmul(_X, _W[n - 1]) + _B[n - 1]
{'fraction_non_alphanumeric': 0.11311053984575835, 'fraction_numerical': 0.012210796915167094, 'mean_word_length': 3.7181818181818183, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '577901', 'n_tokens_mistral': 581, 'n_tokens_neox': 556, 'n_words': 218}