In [5]:
# Imports
import csv
import importlib
from scripts import proj1_helpers, implementation, helpers, feature_processing
import numpy as np

Configuration


In [6]:
train_path = '../data/train.csv'
test_path  = '../data/test.csv'
output_path = '../data/baseline_submission.csv'

Loading data


In [7]:
def get_tx_y_standardized(path):
    y, X, ids = proj1_helpers.load_csv_data(path)
    X_s, _, _ = feature_processing.standardize(X)
    tx = feature_processing.add_polynomial(X_s, [])
    return tx, y, ids

In [8]:
# loading data
tx_train, y_train, ids_train = get_tx_y_standardized(train_path)
tx_test, y_test, ids_test = get_tx_y_standardized(test_path)

Training the model


In [10]:
w, l = implementation.least_squares(y_train, tx_train)

Making predictions and saving to file


In [11]:
y_pred = proj1_helpers.predict_labels(w, tx_test)
proj1_helpers.create_csv_submission(ids_test, y_pred, output_path)

In [ ]: