"""
This file contains default packages, settings and model parameters for all experiments.
"""

# imports that are required in multiple files are here
import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rcParams
from sklearn.preprocessing import MaxAbsScaler
from dataclasses import dataclass
from tensorflow.data import Dataset

# standard 10 year dataset will be used as default
START = datetime.datetime(2010, 1, 1)
END = datetime.datetime(2019, 12, 31)

# enable / disable stock re-fetching
FORCE_FETCH_STOCK = False

# default model params
# --------------------
# should the model be retrained? if not and model exists on disk, the model will be loaded
RETRAIN = False
# 60 days will be used to predict one day
BATCH_SIZE = 60
# 50 epochs will be used for training
TRAIN_EPOCHS = 50
# 200 steps per epoch with 50 validation steps
STEPS_PER_EPOCH = 200
VALIDATION_STEPS = 50
# 200 days will be predicted
PREDICT_DAYS = 200
# 80% of the dataset will be used for training
TRAIN_VALIDATION_SPLIT = 0.8
# 30 days will be used as window size in multivariate model
WINDOW_SIZE = 30
# show training progress from TensorFlow
VERBOSE = 1

# false positive ...
pd.options.mode.chained_assignment = None
# nicer pandas print
pd.set_option('display.max_rows', 501)
pd.set_option('display.max_columns', 501)
pd.set_option('display.width', 1000)

# define default graph styles
rcParams['axes.titlepad'] = 20
rcParams['axes.spines.top'] = False
rcParams['axes.spines.right'] = False
height = 6
aspect = 12 / height
col_wrap = 2
title_font_size = 16
font_size = 14
bbox_to_anchor = (1, 0.92)


# model parameters
@dataclass
class ModelParameters:
    train_dataset: Dataset
    validation_dataset: Dataset
    retrain: bool = RETRAIN
    model_name: str = 'prediction-model'
    model_path: str = 'models/'
    config: list = None
    store_history: bool = False
    epochs: int = TRAIN_EPOCHS
    alpha: float = None
    early_stop: int = False
    apply_clipping_fix: bool = False
    learning_rate_testing: bool = False
    plot_model: bool = False
