""" import pandas as pd import numpy as np import os from sklearn.naive_bayes import GaussianNB from helper_package import helper_functions as hf from helper_package import feature_set as fs from helper_package import confusion_matrix_calcs as cm from helper_package import assign_labels as al # raises numpy errors/warnings so they can be caught by try/except np.seterr(all='raise') # allow df console output to display more columns hf.show_more_df() # get DataFrame of stock ticker info from csv file df = hf.fix_column_names(hf.get_ticker_df()) df = al.assign_color_labels(df) # assign color labels df = fs.get_feature_set(df) # add mean and std return columns for DF def nb_predict(df1, df2): """ Gaussian Naive Bayesian classification of labels (colors) :param df1: Training set (DataFrame) :param df2: Prediction set (DataFrame) :return: df2 with predicted label (binary) and color columns """
5. What is the avg number of days for long position and short position transactions in year 2? 6. Are these results very different from those in year 1 for this value of W? """ import pandas as pd import numpy as np import os import copy import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from helper_package import helper_functions as hf import Assignment4.window_strategy as ws hf.show_more_df() # allow df output to display more rows/columns df = hf.fix_column_names(hf.get_ticker_df()) # get DataFrame of ticket file def create_w_list(w_min, w_max, step=1): """ Create list of w values (used as 'windows' for estimation) :param w_min: Minimum w value :param w_max: maximum w value :param step: step for w values in list :return output_list: list of w values """ output_list = [] # list of w values for i in range(w_min, w_max + 1): output_list.append(i) i += step