hfawaz / inceptiontime Goto Github PK
View Code? Open in Web Editor NEWInceptionTime: Finding AlexNet for Time Series Classification
License: GNU General Public License v3.0
InceptionTime: Finding AlexNet for Time Series Classification
License: GNU General Public License v3.0
Hi,
thanks for the repository! I tried to install the dependencies from requirements.txt
with the following error:
marc@marc-swift:~/projects$ conda create -n inceptiontime pip
marc@marc-swift:~/projects$ conda activate inceptiontime
(inceptiontime) marc@marc-swift:~/projects/InceptionTime$ pip install -r requirements.txt
Collecting absl-py==0.6.1 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/0c/63/f505d2d4c21db849cf80bad517f0065a30be6b006b0a5637f1b95584a305/absl-py-0.6.1.tar.gz (94kB)
|████████████████████████████████| 102kB 1.3MB/s
Collecting alabaster==0.7.7 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/25/e6/86e30d0d818955e92ee37c64f92a7a3b2cb4bbdd07a7e74a6a7c028c1f3a/alabaster-0.7.7-py2.py3-none-any.whl
Collecting AnyQt==0.0.8 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/7c/32/f6ae3ad3be05722d344ff8d202d4f0382f7fc75e1ad2fd49cc36ccd2e8a7/AnyQt-0.0.8-py2.py3-none-any.whl
Collecting apturl==0.5.2 (from -r requirements.txt (line 4))
ERROR: Could not find a version that satisfies the requirement apturl==0.5.2 (from -r requirements.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for apturl==0.5.2 (from -r requirements.txt (line 4))
some system info:
marc@marc-swift:~/projects$ uname -a
Linux marc-swift 4.15.0-62-generic #69-Ubuntu SMP Wed Sep 4 20:55:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(inceptiontime) marc@marc-swift:~/projects/InceptionTime$ python --version
Python 3.7.4
I could import all dependencies from main.py
with the following requirements.txt
:
numpy
pandas
matplotlib
scikit-learn
Hi
I have learnt your paper and other related work (such as Rocket, TS-CHIEF, Hive-COTE) about TSC in UCR archives these day. From the results in the Rocket, your work is one of the most accurate model.
The one of the motivations in your paper is reducing the computational complexity of the model which is also in the Rocket. As you can see, the performance difference between Rocket and Inceptiontime is small. It seems that reducing computational complexity while maintaining accuracy is a research direction in the recent published paper for UCR. I have a confusion whether the accuracy could be improved in statistically. Constructing a more complex network may be a good choice. Could you please give me some suggestions? Thanks a lot.
Hi, I wonder if you do the experiments on the 30 resamples of UCR or just on the default train/test split?( I'm not sure after reading 《InceptionTime》), thanks!
While running:
python3 main.py InceptionTime:
Error:
Traceback (most recent call last):
File "main.py", line 138, in
fit_classifier()
File "main.py", line 49, in fit_classifier
classifier.fit(x_train, y_train, x_test, y_test, y_true)
File "/cluster/work/igp_psr/tomm/Experiments/InceptionTime/classifiers/nne.py", line 75, in fit
return_df_metrics=False)
File "/cluster/work/igp_psr/tomm/Experiments/InceptionTime/classifiers/inception.py", line 154, in predict
model = keras.models.load_model(model_path)
File "/cluster/apps/python/3.7.1/x86_64/lib64/python3.7/site-packages/keras/engine/saving.py", line 417, in load_model
f = h5dict(filepath, 'r')
File "/cluster/apps/python/3.7.1/x86_64/lib64/python3.7/site-packages/keras/utils/io_utils.py", line 186, in init
self.data = h5py.File(path, mode=mode)
File "/cluster/apps/python/3.7.1/x86_64/lib64/python3.7/site-packages/h5py/_hl/files.py", line 394, in init
swmr=swmr)
File "/cluster/apps/python/3.7.1/x86_64/lib64/python3.7/site-packages/h5py/_hl/files.py", line 170, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 85, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = '*InceptionTime/results/inception/TSC/Coffee/best_model.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
I am still quite new to deep neural nets so forgive me if the answers to my questions are obvious.
Why do you install tensorflow-gpu (as found in the requirements.txt) but then only import tensorflow without -gpu in your code?
My understanding is that the latest version tensorflow (tensorflow2) includes both the CPU and GPU support. Is there a specific reason why you use an older version of tensorflow-gpu (tensorflow-gpu==1.12.0)?
Hi,
I would be very interested in testing this architecture on another dataset but I found the current API very focused on the task of testing on the collection you are using and difficult to generalize to others (at least for me).
Wouldn't it be possible (and very nice) if there was a class with an API compatible with sklearn with a fit(X_3dnumpyarray, y_1dnumpyarray) method that returns the fitted estimator itself and a predict method that returns the 1d predicted numpy array?
Thank you
Hi
I have a question about batch size selection. In your code, I found the batch size is 64 or int(min(x_train.shape[0], 16)). I want to reproduce your results,But I do not know how to select batch size for different datasets. Could you please give me some help? Thanks a lot.
Dear authors,
Thank you very much for contributing to transparent and open research by sharing the implementation of your InceptionTime Network!
I am currently looking into reproducing your results in the context of a work in Time Series Classification. However, after porting the code to tensorflow 2.6 and running it successfully for some datasets, I ran into a "Model saving" issue. This turned out to be due to missing values in the time series, e.g. DodgersLoopDay
, and as a result all the values within the model including the outputs becoming NaN.
This is to be expected, however, I did not find any note in your paper or the code that gives a hint on how you have dealt with missing values in your initial work.
It would be awesome if you could provide some details on how you handled missing values in your work.
Best Regards
Vincent
I have this error when I am running the python3 main.py InceptionTime
:
iter 0
dataset_name: Coffee
Already_done /media/Disk1/projects/Time_series/data/results/inception/TSC/ Coffee
dataset_name: Meat
Already_done /media/cttc/Disk1/projects/Time_series/data/results/inception/TSC/ Meat
iter 1
dataset_name: Coffee
Already_done /media/Disk1/projects/Time_series/data/results/inception/TSC_itr_1/ Coffee
dataset_name: Meat
Already_done /media/cttc/Disk1/projects/Time_series/data/results/inception/TSC_itr_1/ Meat
iter 2
dataset_name: Coffee
Already_done /media/Disk1/projects/Time_series/data/results/inception/TSC_itr_2/ Coffee
dataset_name: Meat
Already_done /media/cttc/Disk1/projects/Time_series/data/results/inception/TSC_itr_2/ Meat
iter 3
dataset_name: Coffee
Already_done /media/Disk1/projects/Time_series/data/results/inception/TSC_itr_3/ Coffee
dataset_name: Meat
Already_done /media/cttc/Disk1/projects/Time_series/data/results/inception/TSC_itr_3/ Meat
iter 4
dataset_name: Coffee
Using TensorFlow backend.
2020-02-18 11:55:41.451561: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2020-02-18 11:55:41.553535: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-02-18 11:55:41.553936: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce RTX 2080 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.545
pciBusID: 0000:0a:00.0
totalMemory: 10.76GiB freeMemory: 10.32GiB
2020-02-18 11:55:41.553949: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-02-18 11:55:41.742036: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-18 11:55:41.742067: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-02-18 11:55:41.742072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-02-18 11:55:41.742141: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9960 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:0a:00.0, compute capability: 7.5)
Segmentation fault (core dumped)
I have 10.32GiB free memory on the GPU and I suppose this error didn't raise due to the lack of memory space since it would occupy 9960 MB in memory.
In any case I also tried to reduce the data size based on this line but it was not very clear about how can we manage it if the data is too big.
I have also tried to run it just with 'Coffee' by editing this line to UNIVARIATE_DATASET_NAMES = ['Coffee']
, but the memory is still 9960 MB and I have the same error.
I have also tried to run python3 main.py InceptionTime_xp
, but the same error happened.
I would appreciate it if you could provide any clue that why this error happens and how can I solve it.
Hi there ! I've read your paper, amazing work ! Thank you and your team for this !
I've two questions regarding the adaptation of InceptionTime to specific datasets.
All time series data were z-normalized (including the synthetic series) to have a mean equal to zero and a standard deviation equal to one.
So did you normalize your time series using this method : normalization method ? And did you normalize every time series slices (For a given, N: size of the training set,F: number of features, T: Time length per set , input_shape is (N,T,F), did you normalize (T,F) independently of the others ?)
Consider the input to be an MTS with M dimensions. The first major component of the Inception module is called the “bottleneck” layer. This layer performs an operation of sliding m filters of length 1 with a stride equal to 1. This will transform the time series from an MTS with M dimensions to an MTS with m << M dimensions, thus reducing significantly the dimensionality of the time series as well as the model’s complexity and mitigating overfitting problems for small datasets.
In your code the number of filters for the bottleneck is set by default to 32. But what if I have number of classes (M) < 32 ? What if I have 3 classes ? Should I reduce the number of filters ?
Thanks in advance for your help
Hello. I have a problem to run python3 main.py InceptionTime
My configuration:
Ubuntu 18.04
tensorflow 1.14.0
tensorflow-gpu 2.2.0
numpy 1.19.5
Keras 2.4.3
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.2
I follow the instruction to the basic running, however I found the following Error:
iter 0
dataset_name: Coffee
Already_done {myFolder}/InceptionTime/results/inception/TSC/ Coffee
dataset_name: Meat
Already_done {myFolder}/InceptionTime/results/inception/TSC/ Meat
iter 1
dataset_name: Coffee
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_1/ Coffee
dataset_name: Meat
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_1/ Meat
iter 2
dataset_name: Coffee
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_2/ Coffee
dataset_name: Meat
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_2/ Meat
iter 3
dataset_name: Coffee
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_3/ Coffee
dataset_name: Meat
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_3/ Meat
iter 4
dataset_name: Coffee
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_4/ Coffee
dataset_name: Meat
Already_done {myFolder}/InceptionTime/results/inception/TSC_itr_4/ Meat
dataset_name: Coffee
Traceback (most recent call last):
File "main.py", line 138, in
fit_classifier()
File "main.py", line 49, in fit_classifier
classifier.fit(x_train, y_train, x_test, y_test, y_true)
File "{myFolder}/InceptionTime/classifiers/nne.py", line 75, in fit
return_df_metrics=False)
File "{myFolder}/InceptionTime/classifiers/inception.py", line 154, in predict
model = keras.models.load_model(model_path)
File "{myFolder}/InceptionTime/venv/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 189, in load_model
loader_impl.parse_saved_model(filepath)
File "{myFolder}/InceptionTime/venv/lib/python3.6/site-packages/tensorflow/python/saved_model/loader_impl.py", line 113, in parse_saved_model
constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: {myFolder}/InceptionTime/results/inception/TSC/Coffee/best_model.hdf5/{saved_model.pbtxt|saved_model.pb}
Looks like it's not saving the model to load later.
Hi hfawaz,
Thanks for opensource the code of your paper. It helped me a lot.
I am writting a paper about time series classification. I am curious about what tools you use to draw the model architecture in your paper. It looks nice.
Thanks!
Dear Fawaz,
I have asked for your advice about the use of test datasets before. Resently I have careflly read you article and code for a second time. Some new questions confuse me. Last time you told me the test datasets is 'unseen' in the training process, however, in your article the effectiveness of bottleneck, residual block is validated on the test data. Is it my misunderstanding or your omission? Expect your reply!
Dear Hassan,
I have red your article and code carefully. It's wonderful work! But one question confuses me. The results in your article are best test accuracies (validated every epoch and choose the best result) or obtained through models with minimal training loss? If the latter, how do you deal with the overfitting problem of deep learning on UCR archive? Which of the two test methods should we choose? As I personally use the test sets of UCR as validation sets.
Hi
I noticed that you compare InceptionTime to the traditional SOTA classifiers In your paper. Did you run all the classifier in your machine to get the accuracy table like this? Dose that cost too much time? I only have one machine with two GPU.
Hi Hassan,
First of all, thank you for sharing your work!
I ran your project for the Coffee archive and ended up with the following values in df_metrics.csv file:
precision,accuracy,recall,duration
1.0,1.0,1.0,959.9678399562836
Do you know what could cause this?
Cheers!
Dear Fawaz,
I can't find the classification result of InceptionTime(5 ensembled), may I have one, please?(better in .xls format)
Wish for your reply!
############################################### main
root_dir = '/b/home/uha/hfawaz-datas/temp-dl-tsc/'
xps = ['use_bottleneck', 'use_residual', 'nb_filters', 'depth',
'kernel_size', 'batch_size']
Dear author,
I am reading your paper "InceptionTime: Finding AlexNet for time series classification". It's really a great achievement in Time Series Classification. Thank you for your contribution.
My question is you said that "By observing Fig. 11 we notice how there is no significant improvement when x≥5", but in this figure, I donnot find the Inception(5). Then I think it may be appear at the lower right corner(Inception(5)) according to your paper. I guess that you think this x=5 is a default setting, so you have left out it.
I don't know whether my understanding is right, and I would appreciate it if you can tell me about this thing.
Thank you!
A quick heads up that the requirements.txt you pushed includes beautifulsoup, bable, termcolor etc. Looks like you pushed your base env, which may cause problems for people installing this
Could you please give me a hand?
I found that cannot reproduce the result for PLAID dataset.
To prevent the problem from the dataset, I re-download the PLAID dataset at here.
But the acc result is about 0.16387337032754107.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pandas/core/indexes/base.py", line 2566, in get_value
return libts.get_value_box(s, key)
File "pandas/_libs/tslib.pyx", line 1017, in pandas._libs.tslib.get_value_box
File "pandas/_libs/tslib.pyx", line 1025, in pandas._libs.tslib.get_value_box
TypeError: 'str' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 117, in
fit_classifier()
File "main.py", line 49, in fit_classifier
classifier.fit(x_train, y_train, x_test, y_test, y_true)
File "/home/pf/pfstaff/projects/LakeIce_2/Experiments/GeoLocalize/InceptionTime/classifiers/inception.py", line 145, in fit
plot_test_acc=plot_test_acc)
File "/home/pf/pfstaff/projects/LakeIce_2/Experiments/GeoLocalize/InceptionTime/utils/utils.py", line 211, in save_logs
df_best_model['best_model_train_acc'] = row_best_model['acc']
File "/usr/lib/python3/dist-packages/pandas/core/series.py", line 623, in getitem
result = self.index.get_value(self, key)
File "/usr/lib/python3/dist-packages/pandas/core/indexes/base.py", line 2574, in get_value
raise e1
File "/usr/lib/python3/dist-packages/pandas/core/indexes/base.py", line 2560, in get_value
tz=getattr(series.dtype, 'tz', None))
File "pandas/_libs/index.pyx", line 83, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 91, in pandas._libs.index.IndexEngine.get_value
File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'acc'
I believe the plots in the README are mislabelled in the markdown text.
Hi Hassan,
I'm trying to apply InceptionTime to a multi-variate and multi-class TSC problem. Looking at your code and paper, it is not clear to me how the input&output data is structured.
For a given, N: size of the training set,F: number of features, T: Time length per set , I think the input_shape is (N,T,F) based on Line 37 in main.py. However, the architecture makes sense for (N,F,T) input type. My understanding is that you're formulating a many-to-many-classification problem where each sample in the time series has a corresponding class label. I'd appreciate if you can clarify the input to build_model and how you structure the training data (x_train,y_train). You seem to import multi-variate data as .npy files, which is not available.
PS. As an improvement, it would be great if you add comments on the dimensions of the input and output of the methods.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.