<jupyter_start><jupyter_text>imports<jupyter_code>import os
import sys
sys.path.append('../')
from glob import glob
import torch
import numpy as np
import pandas as pd<jupyter_output><empty_output><jupyter_text>get and split data<jupyter_code>from spug.dataset import DatasetGenerator

data_root = '../data'

sotck_path = os.path.join(
        data_root, 'raw', 'stock', 'raw.csv'
)

sec_path = os.path.join(
        data_root, 'raw', 'sec'
)

output_path = os.path.join(
        data_root, 'processed'
)

data_list = sorted(glob(
    os.path.join(
        data_root, 'raw', 'stock/price', '*q*.npy'
    )
))
dg = DatasetGenerator(
    data_list = data_list,
    stock_path=sotck_path,
    sec_path=sec_path,
    freq='quarter'
)<jupyter_output><empty_output><jupyter_text>model definition<jupyter_code>from spug.model import GCN<jupyter_output><empty_output><jupyter_text>model training<jupyter_code>import argparse
from torch_geometric_temporal.signal import temporal_signal_split
from spug.utils import Trainer

dataset = dg.process()
train_dataset, test_dataset = temporal_signal_split(dataset, train_ratio=0.8)


INPUT_SHAPE = next(iter(train_dataset)).x.shape[1]
model = GCN(input_size = INPUT_SHAPE, hidden_dims=64)
args = argparse.Namespace(
    num_epochs = 500,
    learning_rate = 1e-3,
    device = "cpu",
    val_size = .1,
    verbose = False
)
trainer = Trainer(model, train_dataset, args, test_dataset)
model = trainer.train()<jupyter_output>100%|███████████████████████████████████████████████████████████████████████████| 500/500 [00:08<00:00, 58.54it/s]
{'fraction_non_alphanumeric': 0.16475826972010177, 'fraction_numerical': 0.020356234096692113, 'mean_word_length': 5.317269076305221, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 16, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '31594', 'license': 'Apache-2.0', 'n_tokens_mistral': 662, 'n_tokens_neox': 595, 'n_words': 105, 'path': 'notebooks/3.3 gcn_stock_price_corr_quarterly_prediction.ipynb', 'repo_name': 'syeehyn/spug', 'size': '1572'}