def testHW2():  # Success
    test, train = utils.load_and_normalize_housing_set()
    df_train = pd.DataFrame(train)
    df_test = pd.DataFrame(test)
    print df_train.head(10)
    #raw_input()
    print hw2.linear_gd(df_train, df_test, 'MEDV')
def testHW2_subset(): # Success
    test, train = utils.load_and_normalize_housing_set()
    df_full = pd.DataFrame(train)
    df_test = utils.train_subset(df_full, ['CRIM', 'TAX', 'B', 'MEDV'], n=10)
    df_train = utils.train_subset(df_full, ['CRIM', 'TAX', 'B', 'MEDV'], n=10)
    dfX_test = pd.DataFrame([df_test['CRIM'], df_test['TAX'], df_test['MEDV']]).transpose()
    dfX_train = pd.DataFrame([df_train['CRIM'], df_train['TAX'], df_train['MEDV']]).transpose()
    print hw2.linear_gd(dfX_train, dfX_test, 'MEDV')
def testHW2_allcols():  # Fail
    test, train = utils.load_and_normalize_housing_set()
    df_full = pd.DataFrame(train)
    cols = [col for col in df_full.columns if col != 'MEDV']
    df_test = utils.train_subset(df_full, cols, n=10)
    df_train = utils.train_subset(df_full, cols, n=10)
    #dfX_test = pd.DataFrame([df_test['CRIM'], df_test['TAX'], df_test['MEDV']]).transpose()
    #dfX_train = pd.DataFrame([df_train['CRIM'], df_train['TAX'], df_train['MEDV']]).transpose()
    print hw2.linear_gd(df_train, df_test, 'MEDV')