from subprocess import call
from shlex import split
import sys
import pandas as pd
import numpy as np
from polara.recommender.models import SVDModel


#default settings
if sys.platform == 'win32':
    program = 'item_recommendation.exe'
else:
    program = 'item_recommendation'

num_factors = 10
learn_rate = 0.1
train_data_path = 'train_data.csv'
user_mapping = 'user_mapping'
item_mapping = 'item_mapping'
positive_only = True #saves up space as MML anyway works with positive feedback only
#wrmf_weight = 1

command_template = (
    '{program}'
    ' --training-file={train_path}'
    ' --save-model={saved_model_path}'
    ' --recommender={algo}'
    ' --recommender-options={options}')

def join_path(*paths):
    return '/'.join([p.rstrip('/') for p in paths])