holgerteichgraeber / TimeSeriesClustering.jl

Julia implementation of unsupervised learning methods for time series datasets. It provides functionality for clustering and aggregating, detecting motifs, and quantifying similarity between time series datasets.
MIT License
82 stars 23 forks source link

Import Your Own Data #130

Open dsambor10 opened 4 years ago

dsambor10 commented 4 years ago

Hi, I tried importing my data via your instructions and when I run these lines:

my_path=joinpath(homedir(),"Documents","tutorial","TimeClustInput.csv")
your_data_1=load_timeseries_data(my_path; region="none", T=24)

I get this error: LoadError: MethodError: objects of type Bool are not callable

Sorry for the basic question! Dan

YoungFaithful commented 4 years ago

Hi @dsambor10, I suppose your TimeClustInput.csv contains true and false, is that correct?

dsambor10 commented 4 years ago

That's the confusing aspect, it does not. Is there a proper timestamp format that is required? Here's a snapshot of my data: image

YoungFaithful commented 4 years ago

Your timestamp column looks all right. However you need to add a column called Year. (That is due to the fact, that the timestamp is not really interpretated) https://holgerteichgraeber.github.io/TimeSeriesClustering.jl/stable/load_data/#Load-your-own-data-1

dsambor10 commented 4 years ago

Thanks for clarifying. I discovered the issue was that I had not specified in loading time series that "years=[2019]" because the doc said that's optional to designate and I thought it would read the year, but it's required to have I guess. It all works now. PS Is there any means of exporting the .clust_data (e.g. to a csv) once it's been clustered?

holgerteichgraeber commented 4 years ago

I don't think we have a function for that. Should be pretty simple to implement though:

using DataFrames

for (k,v) in X.clust_data.data  
  name = "$k"
  CSV.write(name*".csv", DataFrame(v))
end

clust_data is of type ClustData, and .data is a dictionary, see https://github.com/holgerteichgraeber/TimeSeriesClustering.jl/blob/master/src/utils/datastructs.jl

You may need to play with the settings of DataFrame and CSV.write, but this should give a general idea.

This will write one csv for each data type.

dsambor10 commented 3 years ago

I'm getting the same error that I and others have gotten in the past "objects of type Bool are not callable" (as per screenshot below) when I try to load my time series data (screenshot) below. It was working before but now appears to be an issue again. I've designated a year column and all my paths are correct. I'm loading my data with:

ts_input_data = load_timeseries_data("/home/dsambor/DanDocs/KLRS/Clust"; T=24,years=[2021])

image

image