<commit_before>from numpy import tanh, fabs, mean, ones,loadtxt,fromfile
import sys
import math
from PIL import Image
from matplotlib.pyplot import hist, title, subplot
import matplotlib.pyplot as plot
def sigmoid(xx):
    return .5 * (1 + tanh(xx / 2.))



def from_file(path):
    return loadtxt(path,delimiter=',')
    
def hist_matrix(values,show = True,chart_title = ''):
    hist(from_file(values))
    magnitude = ' mm %g ' % mean(fabs(values))
    chart_title += ' ' + magnitude
    title(chart_title)
    


def render_hbias(path):
    hMean = from_file(path)
    image = Image.fromarray(hMean * 256).show()


def plot_multiple_matrices(paths):
    count = 231
    graph_count = 1
    print paths
    for i  in xrange(len(paths) - 1):
        if i % 2 == 0:
            path = paths[i]
            title = paths[i + 1]
            print 'Loading matrix ' + path + '\n'
            matrix = from_file(path)
            subplot(2,3,graph_count)
            plot.tight_layout()
            hist_matrix(matrix,False,chart_title=title)
            graph_count+= 1<commit_msg>updated plot.py<commit_after>from numpy import tanh, fabs, mean, ones,loadtxt,fromfile,zeros,product
import sys
import math
from PIL import Image
from matplotlib.pyplot import hist, title, subplot
import matplotlib.pyplot as plot
def sigmoid(xx):
    return .5 * (1 + tanh(xx / 2.))



def from_file(path):
    return loadtxt(path,delimiter=',')
    
def hist_matrix(values,show = True,chart_title = ''):
    if product(values.shape) < 2:
      values = zeros((3,3))
      chart_title += '-fake'

    hist(values)
    magnitude = ' mm %g ' % mean(fabs(values))
    chart_title += ' ' + magnitude
    title(chart_title)
    


def render_hbias(path):
    hMean = from_file(path)
    image = Image.fromarray(hMean * 256).show()


def plot_multiple_matrices(paths):
    count = 231
    graph_count = 1
    print paths
    for i  in xrange(len(paths) - 1):
        if i % 2 == 0:
            path = paths[i]
            title = paths[i + 1]
            print 'Loading matrix ' + path + '\n'
            matrix = from_file(path)
            subplot(2,3,graph_count)
            plot.tight_layout()
            hist_matrix(matrix,False,chart_title=title)
            graph_count+= 1
{'fraction_non_alphanumeric': 0.11662971175166297, 'fraction_numerical': 0.016407982261640797, 'mean_word_length': 2.6153846153846154, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4643373', 'n_tokens_mistral': 783, 'n_tokens_neox': 741, 'n_words': 183}