petecheng / time2graph Goto Github PK
View Code? Open in Web Editor NEWSource codes for Time2Graph model.
Source codes for Time2Graph model.
师兄好!我在运行这个代码时,出现了这个错误,发现是索引值错误,
由于输入数据是50*64,于是将embed_size改为64,但还是不对。发现是由于representation_size赋值给embed_size,但不知在哪修改
具体错误如下:
Traceback (most recent call last):
File "E:\Users\Time2Graph-master\scripts\std_test.py", line 75, in
m.fit(X=x_train, Y=y_train, n_splits=args.n_splits, tuning=False, opt_args=xgb_options)
File "E:\Users\Time2Graph-master\time2graph\core\model.py", line 158, in fit
self.t2g.fit_embedding_model(x=X, y=Y, cache_dir=cache_dir)
File "E:\Users\Time2Graph-master\time2graph\core\model_embeds.py", line 117, in fit_embedding_model
shapelets=self.shapelets, warp=self.warp, init=init)
File "E:\Users\Time2Graph-master\time2graph\core\shapelet_embedding.py", line 157, in fit
cache_dir=self.cache_dir, **self.deepwalk_args)
File "E:\Users\Time2Graph-master\time2graph\core\shapelet_utils.py", line 361, in graph_embedding
ret.append(__embedding2mat(fpath=embedding_path, num_vertices=num_shapelet, embed_size=embed_size))
File "E:\Users\Time2Graph-master\time2graph\core\shapelet_utils.py", line 319, in __embedding2mat
mat[idx, k] = float(line[k + 1])
IndexError: list index out of range
Thanks for sharing! This is my first time coping code from Github so might meet a lot of stupid problems...
As title, I am trying to figure out the issue that it can't find 'module_path' in 'fit' function that was defined in class 'Time2Graph' in model.py. Problem might be appreared the same in run.py.
请问这个是什么原因?谢谢!
python3 scripts/std_test.py
[info]running with {'dataset': 'ucr-Earthquakes', 'n_splits': 5, 'model_cache': False, 'shapelet_cache': False, 'gpu_enable': False}
./dataset/UCRArchive_2018/Earthquakes/Earthquakes_TEST.tsv
[info]training: 0.18 positive ratio with 322
[info]test: 0.25 positive ratio with 139
init model
[info]initialize t2g model with {'kernel': 'xgb', 'kwargs': {'num_segment': 21, 'candidate_method': 'greedy'}, 'K': 50, 'C': 800, 'seg_length': 24, 'warp': 2, 'tflag': True, 'opt_metric': 'accuracy', 'mode': 'embedding', 'batch_size': 100, 'gpu_enable': False, 'percentile': 5, 'shapelets': None, 'sembeds': None, 'clf': None, 'lr': 0.01, 'p': 2, 'alpha': 0.1, 'beta': 0.05, 'multi_graph': False, 'debug': True, 'measurement': 'gdtw', 'verbose': False, 'global_flag': True}
[info]training ucr-Earthquakes_tim2graph_model ...
train model
[info]training embedding model...
[info]initialize ShapeletEmbedding model with ops: {'seg_length': 24, 'tflag': True, 'multi_graph': False, 'cache_dir': '/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/scripts/cache/', 'tanh': False, 'debug': True, 'percentile': 5, 'dist_threshold': -1, 'measurement': 'gdtw', 'mode': 'embedding', 'global_flag': True, 'deepwalk_args': {'num_segment': 21, 'candidate_method': 'greedy'}, 'embed_size': 256, 'embeddings': None}
[info]fit shape: (264, 504, 1)
[info]threshold(5) 0.012702378537505865, mean 0.2733875811100006
[info]15359 edges involved in shapelets graph
[info]embed_size: 256
[info]transition matrix size (1, 50, 50)
[info]run deepwalk with: deepwalk --input /home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/scripts/cache//0.edgelist --format weighted_edgelist --output /home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/scripts/cache//0.embeddings --representation-size 256
[info]embedding threshold 0.012702378537505865
[info]sdist size (322, 21, 50)
Traceback (most recent call last):
File "scripts/std_test.py", line 77, in
m.fit(X=x_train, Y=y_train, n_splits=args.n_splits, tuning=False, opt_args=xgb_options)
File "/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/time2graph/core/model.py", line 163, in fit
x = self.extract_features(X=X, init=self.init)
File "/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/time2graph/core/model.py", line 114, in extract_features
embed = self.t2g.embed(x=X, init=init)
File "/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/time2graph/core/model_embeds.py", line 101, in embed
return self.sembeds.time_series_embedding(time_series_set=x, shapelets=self.shapelets, warp=self.warp, init=init)
File "/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/time2graph/core/shapelet_embedding.py", line 183, in time_series_embedding
multi_graph=self.multi_graph, debug=self.debug, mode=self.mode),
File "/home/wangdong/tool/notebook/jupyter/time2graph/Time2Graph-master/time2graph/core/shapelet_embedding.py", line 80, in time_series_embeds_factory__
raise NotImplementedError('unsupported mode {}'.format(mode))
NotImplementedError: unsupported mode embedding
Thank you for sharing the code, but I have a problem running it, When I run the code with the following command:
"python scripts/run.py --dataset ucr-Earthquakes --K 50 --C 500 --num_segment 21 --seg_length 24 --data_size 1 --embed concate --percentile 5 --gpu_enable"
I get an error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/internship/code/Time2Graph/scripts/cache/ucr-Earthquakes//0.embeddings'
I found this problem in shapelet_utils.py, and I don't see any way to generate this file.
I will be appreciated if you will to help me!
File "D:\Time2Graph\time2graph\utils\mp_utils.py", line 79, in run_slices
monitor.start()
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'parallel_monitor..monitor'
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Users\Vanellope\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input
Thank you for sharing you code. I found that when I used larger graph data, the MemoryError occured. Could you please help me?
Number of nodes: 183209
Number of walks: 1832090
Data size (walks*length): 73283600
Walking...
Traceback (most recent call last):
File "/search/odin/xxx/anaconda3/envs/push_py27/bin/deepwalk", line 11, in
load_entry_point('deepwalk==1.0.3', 'console_scripts', 'deepwalk')()
File "/search/odin/xxx/anaconda3/envs/push_py27/lib/python2.7/site-packages/deepwalk-1.0.3-py2.7.egg/deepwalk/main.py", line 151, in main
process(args)
File "/search/odin/xxx/anaconda3/envs/push_py27/lib/python2.7/site-packages/deepwalk-1.0.3-py2.7.egg/deepwalk/main.py", line 80, in process
walks = weighted_random_walk.random_walk(G, num_paths=args.number_walks,path_length=args.walk_length, alpha=0)
File "/search/odin/xxx/anaconda3/envs/push_py27/lib/python2.7/site-packages/deepwalk-1.0.3-py2.7.egg/deepwalk/weighted_random_walk.py", line 42, in random_walk
transitionMatrix = getTransitionMatrix(G, nodes)
File "/search/odin/xxx/anaconda3/envs/push_py27/lib/python2.7/site-packages/deepwalk-1.0.3-py2.7.egg/deepwalk/weighted_random_walk.py", line 6, in getTransitionMatrix
matrix = np.zeros([len(nodes), len(nodes)])
MemoryError
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.