Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify file load function #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions TICC_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ def __init__(self, window_size=10, number_of_clusters=5, lambda_parameter=11e-2,
np.set_printoptions(formatter={'float': lambda x: "{0:0.4f}".format(x)})
np.random.seed(102)

def fit(self, input_file):
def fit(self, input_file, delimiter=","):
"""
Main method for TICC solver.
Parameters:
- input_file: location of the data file
- delimiter: delimiter of the data in the input file
"""
assert self.maxIters > 0 # must have at least one iteration
self.log_parameters()

# Get data into proper format
times_series_arr, time_series_rows_size, time_series_col_size = self.load_data(input_file)
times_series_arr, time_series_rows_size, time_series_col_size = self.load_data(input_file, delimiter)

############
# The basic folder to be created
Expand Down Expand Up @@ -358,8 +359,8 @@ def prepare_out_directory(self):

return str_NULL

def load_data(self, input_file):
Data = np.loadtxt(input_file, delimiter=",")
def load_data(self, input_file, delimiter):
Data = np.loadtxt(input_file, delimiter=delimiter)
(m, n) = Data.shape # m: num of observations, n: size of observation vector
print("completed getting the data")
return Data, m, n
Expand Down