<commit_before>'''
A simple class which can be used to generate test sets of examples. 
'''

#import numpy 
import numpy.random 

class ExamplesGenerator():
    def __init__(self):
        pass
    
    def generateBinaryExamples(self, numExamples=100, numFeatures=10, noise=0.4):
        """
        Generate a certain number of examples with a uniform distribution between 0 and 1. Create
        binary -/+ 1 labels. Must have more than 1 example and feature. 
        """
        if numExamples == 0 or numFeatures == 0: 
            raise ValueError("Cannot generate empty dataset")

        X = numpy.random.rand(numExamples, numFeatures)
        c = numpy.random.rand(numFeatures)
        y = numpy.sign((X.dot(c)) - numpy.mean(X.dot(c)) + numpy.random.randn(numExamples)*noise)

        return X, y

    def generateRandomBinaryExamples(self, numExamples=100, numFeatures=10):
        """
        Generate a certain number of examples with a uniform distribution between 0 and 1. Create 
        binary -/+ 1 labels<commit_msg> Make sure labels are ints. <commit_after>'''
A simple class which can be used to generate test sets of examples. 
'''

#import numpy 
import numpy.random 

class ExamplesGenerator():
    def __init__(self):
        pass
    
    def generateBinaryExamples(self, numExamples=100, numFeatures=10, noise=0.4):
        """
        Generate a certain number of examples with a uniform distribution between 0 and 1. Create
        binary -/+ 1 labels. Must have more than 1 example and feature. 
        """
        if numExamples == 0 or numFeatures == 0: 
            raise ValueError("Cannot generate empty dataset")

        X = numpy.random.rand(numExamples, numFeatures)
        c = numpy.random.rand(numFeatures)
        y = numpy.sign((X.dot(c)) - numpy.mean(X.dot(c)) + numpy.random.randn(numExamples)*noise)
        y = numpy.array(y, numpy.int)

        return X, y

    def generateRandomBinaryExamples(self, numExamples=100, numFeatures=10):
        """
        Generate a certain number of examples with a uniform distribution between 0 and 1. Create 
        binary -/+ 1 labels
{'fraction_non_alphanumeric': 0.09467734338200659, 'fraction_numerical': 0.019783325482807347, 'mean_word_length': 2.6875, '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': '4202694', 'n_tokens_mistral': 619, 'n_tokens_neox': 556, 'n_words': 206}