<jupyter_start><jupyter_text>Generating Training Data for Toy Problem 3In Toy Problem 1, for all inputs $f = \begin{bmatrix}f_{1} & f_{2}\end{bmatrix}$ and output categories $0$ and $1$, if $f_{1} * f_{2} > 0$ then the output category selected is $0$ else it is $1$.We can easily generate some training data with these properties.<jupyter_code>import random

file = open("data/toy_problem_3_train.txt", "w")

for i in range(1000):
    y = random.randint(-100,100)
    x = random.randint(-100,100)
    if x == y:
        y += 1
    label = 0 if y * x > 0 else 1
    file.write(str(label)+"\t"+str(x)+" "+str(y)+"\n")

file.flush()
file.close()<jupyter_output><empty_output><jupyter_text>We just created 1000 data points and wrote them to a TSV file.The first column (before the tab) contains the labels, and the second column contains the features. Generating Test Data for Toy Problem 3This is just as easy.<jupyter_code>file = open("data/toy_problem_3_test.txt", "w")

for i in range(1000):
    y = random.randint(-100,100)
    x = random.randint(-100,100)
    if x == y:
        y += 1
    label = 0 if y * x > 0 else 1
    file.write(str(label)+"\t"+str(x)+" "+str(y)+"\n")

file.flush()
file.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.145985401459854, 'fraction_numerical': 0.047039740470397405, 'mean_word_length': 3.936, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '192840', 'license': 'MIT', 'n_tokens_mistral': 477, 'n_tokens_neox': 434, 'n_words': 140, 'path': 'exercise_610.ipynb', 'repo_name': 'aiaioo/DeepLearningBasicsTutorial', 'size': '1233'}