<commit_before>#!/usr/bin/env python

"""
This is am implementation of:
    Romera-Paredes, Bernardino, and <NAME>.
    "An embarrassingly simple approach to zero-shot learning."
    Proceedings of The 32nd International Conference on Machine Learning. 2015.
"""

from sklearn import datasets, decomposition, preprocessing, manifold
from sklearn.metrics import make_scorer, accuracy_score
import pandas as pd
import numpy as np
import collections
import random
import code

__author__ = "<NAME>"
__license__ = "MIT"
__copyright__ = "Copyright 2016, Maana Inc."
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "alpha"

def main():

    runs = 3
    lamb_rng = np.arange(pow(10,-1.1),pow(10,1.1))
    gamma_rng = np.arange(pow(10,-1.1),pow(10,1.1))

    #The rows in this matrix will represent the lambda parameter;
    #The columns will represent the gamma parameter
    #The lambda and gamma values will increase with the index. That is,
    #The (0,0) entry in the matrix will have the smallest values for
    #lambda and gamma, while the (n,n) (bottom right) entry will have the
    #largest values for lambda/gamma.
    results_mean = np.zeros([np.size(lamb_rng),np.size(gamma_rng)])
    results_std = np.zeros([np.size(lamb_rng),np.size(gamma_rng)])

    for j in range(np.size(lamb_rng)):
        print str(j)
        for k in range(np.size(gamma_rng)):
            runs_correct_percent = []
            for a in range(runs):
                #Process the data
                processed = load_data()

                #Calculate the matrices on the training data
                S = get_signature(processed.training_data, processed.training_labels) # S is a x z
                V = get_V(processed.training_data, processed.training_labels, S, 1, .5)  #V is d x a
                W = np.dot(V,S) #W is d x z
                S_prime = get_signature(processed.testing_data, processed.testing_labels)

                #Inference stage
                correct = 0<commit_msg>Fixed error<commit_after>#!/usr/bin/env python

"""
This is am implementation of:
    Romera-Paredes, Bernardino, and <NAME>.
    "An embarrassingly simple approach to zero-shot learning."
    Proceedings of The 32nd International Conference on Machine Learning. 2015.
"""

from sklearn import datasets, decomposition, preprocessing, manifold
from sklearn.metrics import make_scorer, accuracy_score
import pandas as pd
import numpy as np
import collections
import random
import code
import sys

__author__ = "<NAME>"
__license__ = "MIT"
__copyright__ = "Copyright 2016, Maana Inc."
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "alpha"

def main():

    runs = 3
    lamb_rng = np.arange(pow(10,-1.1),pow(10,1.1))
    gamma_rng = np.arange(pow(10,-1.1),pow(10,1.1))

    digits_to_try = [4,7,8,3,9,1]

    #The rows in this matrix will represent the lambda parameter;
    #The columns will represent the gamma parameter
    #The lambda and gamma values will increase with the index. That is,
    #The (0,0) entry in the matrix will have the smallest values for
    #lambda and gamma, while the (n,n) (bottom right) entry will have the
    #largest values for lambda/gamma.
    results_mean = np.zeros([np.size(lamb_rng),np.size(gamma_rng)])
    results_std = np.zeros([np.size(lamb_rng),np.size(gamma_rng)])

    for j in lamb_rng:
        for k in gamma_rng:
            runs_correct_percent = []
            for a in range(runs):
                #Process the data
                processed = load_data(digits_to_try)

                #Calculate the matrices on the training data
                S = get_signature(processed.training_data, processed.training_labels) # S is a x z
                try:
                    V = get_V(processed.training_data, processed.training_labels, S, j, k)  #V is d x a
                except np.linalg.linalg.LinAlgError:
                    print "Lambda " + str(j)
                    print "Gamma " + str(k)
                    sys.exit(1)
                W = np.dot(V,S) #W is d x z
                S_prime = get_signature(processed.testing_data, processed.testing_labels)

                #Inference stage
                correct = 0
{'fraction_non_alphanumeric': 0.09554597701149425, 'fraction_numerical': 0.016522988505747127, 'mean_word_length': 2.6801762114537446, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6237911', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1254, 'n_words': 408}