Comments (3)
Thanks for the reply! I'm running Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
The full error is below......
C:\Users\timmy\OneDrive\Documents\Python For Everybody\Seq2Pat>seqPatMineTest.py
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="__mp_main__")
File "C:\Program Files\Python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Program Files\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\timmy\OneDrive\Documents\Python For Everybody\Seq2Pat\seqPatMineTest.py", line 37, in <module>
results = seq2pat.get_patterns(min_frequency=2)
File "C:\Users\timmy\AppData\Roaming\Python\Python37\site-packages\sequential\seq2pat.py", line 526, in get_patterns
thread.start()
File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Program Files\Python37\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
_check_not_importing_main()
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.''')
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
After posting this yesterday, I tried placing code that references the library inside the IF statement referenced in the error (if __name__ == '__main__':
). It then ran, so the code looks like this now....
# Import Seq2Pat Library
from sequential.seq2pat import Seq2Pat, Attribute
# A Seq2Pat instance can be initialized with two arguments: sequences and max_span.
#
# Seq2Pat Attributes
# ------------------
# sequences : list[list]
# A list of sequences each with a list of events. The event values can be all strings or all integers.
# max_span : Optional[int]
# The value for applying a built-in maximum span constraint to the length of items in mining,
# max_span=10 by default. This is going to avoid regular users to run into a scaling
# issue when data contains long sequences but no constraints are used to run the mining efficiently
# and practically. Power users can choose to drop this constraint by setting it to be None
# or increase the maximum span as the system has resources to support.
# Seq2Pat over 3 sequences
seq2pat = Seq2Pat(sequences=[["A", "A", "B", "A", "D"],
["C", "B", "A"],
["C", "A", "C", "D"]])
# Create price attributes
price = Attribute(values=[[5, 5, 3, 8, 2],
[1, 3, 3],
[4, 5, 2, 1]])
# Create a time attribute
timestamp = Attribute(values=[[1, 1, 2, 3, 3],
[3, 8, 9],
[2, 5, 5, 7]])
if __name__ == '__main__':
# Constraint to specify the average price of patterns
avg_constraint = seq2pat.add_constraint(3 <= price.average() <= 4)
# Find patterns that occur at least twice within average price range
results = seq2pat.get_patterns(min_frequency=2)
print(results)
# Without avg_constraint, there are three patterns: [['B', 'A', 2], ['C', 'A', 2], ['A', 'D', 2]]
# With avg_constraint, there is only one pattern: ['A', 'D', 2]
# A-D satisfies the constraint becasue
# - Sequence 0: A-D occurs three times with avg(A:5,D:2)=3.5, avg(A:5,D:2)=3.5, avg(A:8,D:2)=5
# - Sequence 2: A-D occur once with avg(A:5,D:1) = 3
print("works")
from seq2pat.
Thanks @timmyers15 for your interests to the library. I am not able to reproduce the error from my side though. Is this the entire error message? Does it show which line gets the error? Can you share more about the running environment?
from seq2pat.
Thanks @timmyers15! Great to see that you figured out a solution.
The RuntimeError seems to be caused when starting a child process. We do have all unit tests passed on windows though. We might consider to add a note there when users run the notebook.
(Please consider giving Seq2Pat ⭐ if the library is helpful :)
from seq2pat.
Related Issues (20)
- Memory Leak in C++ HOT 3
- QUESTION HOT 7
- FEATURE REQUEST HOT 1
- 【QUESTION】Any way to limit the minimum length of each pattern? HOT 6
- [Question] - Sequence of transaction basket HOT 5
- does it suitable for classification framework? HOT 7
- data still available to download? HOT 6
- Installation error HOT 2
- Integer sequences containing zero (0) as an event HOT 3
- Windows pip installs on 32bit but is missing modules HOT 1
- Patterns with a single event HOT 3
- Feature Request: get attributes associated with mined pattern HOT 10
- Changes to not allow arcs to skip layers HOT 1
- Request for metadata on the event_time column HOT 1
- Performance warning when using pat2feat.get_features HOT 2
- Labels not included in encodings output HOT 3
- Inquiry on performance-improvement in context of small number of long sequences HOT 1
- Failed to use Attributes to add Constraints HOT 2
- Span constraint is imposed by default HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seq2pat.