after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def read_and_validate_csv(path, delimiter=","):
"""Generator for reading a CSV file.
Args:
path: Path to the CSV file
delimiter: character used as a field separator, default: ','
"""
# Columns that must be present in the CSV file.
mandatory_fields = ["message", "datetime", "timestam... | def read_and_validate_csv(path, delimiter=","):
"""Generator for reading a CSV file.
Args:
path: Path to the CSV file
delimiter: character used as a field separator, default: ','
"""
# Columns that must be present in the CSV file
mandatory_fields = ["message", "datetime", "timestamp... | https://github.com/google/timesketch/issues/1017 | Traceback (most recent call last):
File "...lib/python2.7/site-packages/timesketch/lib/tasks.py", line 467, in run_csv_jsonl
for event in read_and_validate(source_file_path):
File ".../lib/python2.7/site-packages/timesketch/lib/utils.py", line 81, in read_and_validate_csv
for row in reader:
File "/usr/lib/python2.7/csv... | UnicodeEncodeError |
def run(self):
"""Entry point for the analyzer.
Returns:
String with summary of the analyzer result
"""
query = (
'{"query": { "bool": { "should": [ '
'{ "exists" : { "field" : "url" }}, '
'{ "exists" : { "field" : "domain" }} ] } } }'
)
return_fields = ["domain... | def run(self):
"""Entry point for the analyzer.
Returns:
String with summary of the analyzer result
"""
query = (
'{"query": { "bool": { "should": [ '
'{ "exists" : { "field" : "url" }}, '
'{ "exists" : { "field" : "domain" }} ] } } }'
)
return_fields = ["domain... | https://github.com/google/timesketch/issues/892 | [2019-05-15 15:57:25,067: ERROR/ForkPoolWorker-1] Task timesketch.lib.tasks.run_sketch_analyzer[87c2fee5-d10c-4a92-8d28-a6acc970a7fe] raised unexpected: IndexError('cannot do a non-empty take from an empty axes.',)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/celery/app/trace.py", lin... | IndexError |
def get_hypothesis_conversions(self, location: str) -> Optional[Callable]:
definitions = [
item
for item in self.definition.resolved.get("parameters", [])
if item["in"] == location
]
if definitions:
return self.schema.get_hypothesis_conversion(definitions)
return None
| def get_hypothesis_conversions(self, location: str) -> Optional[Callable]:
definitions = [
item
for item in self.definition.raw.get("parameters", [])
if item["in"] == location
]
if definitions:
return self.schema.get_hypothesis_conversion(definitions)
return None
| https://github.com/schemathesis/schemathesis/issues/612 | An internal error happened during a test run
Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/__init__.py", line 245, in execute_from_schema
yield from runner.execute()
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/impl/core.py", line 100, in ... | KeyError |
def get_all_endpoints(self) -> Generator[Endpoint, None, None]:
try:
paths = self.raw_schema["paths"] # pylint: disable=unsubscriptable-object
context = HookContext()
for path, methods in paths.items():
full_path = self.get_full_path(path)
if should_skip_endpoint(ful... | def get_all_endpoints(self) -> Generator[Endpoint, None, None]:
try:
paths = self.raw_schema["paths"] # pylint: disable=unsubscriptable-object
context = HookContext()
for path, methods in paths.items():
full_path = self.get_full_path(path)
if should_skip_endpoint(ful... | https://github.com/schemathesis/schemathesis/issues/612 | An internal error happened during a test run
Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/__init__.py", line 245, in execute_from_schema
yield from runner.execute()
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/impl/core.py", line 100, in ... | KeyError |
def _group_endpoints_by_operation_id(
self,
) -> Generator[Tuple[str, Endpoint], None, None]:
for path, methods in self.raw_schema["paths"].items():
full_path = self.get_full_path(path)
scope, raw_methods = self._resolve_methods(methods)
methods = self.resolver.resolve_all(methods)
... | def _group_endpoints_by_operation_id(
self,
) -> Generator[Tuple[str, Endpoint], None, None]:
for path, methods in self.raw_schema["paths"].items():
full_path = self.get_full_path(path)
scope, raw_methods = self._resolve_methods(methods)
methods = self.resolver.resolve_all(methods)
... | https://github.com/schemathesis/schemathesis/issues/612 | An internal error happened during a test run
Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/__init__.py", line 245, in execute_from_schema
yield from runner.execute()
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/impl/core.py", line 100, in ... | KeyError |
def get_endpoint_by_reference(self, reference: str) -> Endpoint:
"""Get local or external `Endpoint` instance by reference.
Reference example: #/paths/~1users~1{user_id}/patch
"""
scope, data = self.resolver.resolve(reference)
path, method = scope.rsplit("/", maxsplit=2)[-2:]
path = path.replac... | def get_endpoint_by_reference(self, reference: str) -> Endpoint:
"""Get local or external `Endpoint` instance by reference.
Reference example: #/paths/~1users~1{user_id}/patch
"""
scope, data = self.resolver.resolve(reference)
path, method = scope.rsplit("/", maxsplit=2)[-2:]
path = path.replac... | https://github.com/schemathesis/schemathesis/issues/612 | An internal error happened during a test run
Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/__init__.py", line 245, in execute_from_schema
yield from runner.execute()
File "/usr/local/lib/python3.8/site-packages/schemathesis/runner/impl/core.py", line 100, in ... | KeyError |
def as_requests_kwargs(self, base_url: Optional[str] = None) -> Dict[str, Any]:
"""Convert the case into a dictionary acceptable by requests."""
base_url = self._get_base_url(base_url)
formatted_path = self.formatted_path.lstrip("/") # pragma: no mutate
url = urljoin(base_url + "/", formatted_path)
... | def as_requests_kwargs(self, base_url: Optional[str] = None) -> Dict[str, Any]:
"""Convert the case into a dictionary acceptable by requests."""
base_url = self._get_base_url(base_url)
formatted_path = self.formatted_path.lstrip("/") # pragma: no mutate
url = urljoin(base_url + "/", formatted_path)
... | https://github.com/schemathesis/schemathesis/issues/473 | _____________________________ POST: /api/workspace/meshtransform ____________________________
Traceback (most recent call last):
File "/home/nobody/.local/share/virtualenvs/backend-TE7gHulD/lib/python3.7/site-packages/schemathesis/runner/impl/core.py", line 85, in run_test
test(checks, result, **kwargs)
File "/home/nob... | TypeError |
def as_werkzeug_kwargs(self) -> Dict[str, Any]:
"""Convert the case into a dictionary acceptable by werkzeug.Client."""
headers = self.headers
extra: Dict[str, Optional[Union[Dict, bytes]]]
if self.form_data:
extra = {"data": self.form_data}
headers = headers or {}
headers.setdef... | def as_werkzeug_kwargs(self) -> Dict[str, Any]:
"""Convert the case into a dictionary acceptable by werkzeug.Client."""
headers = self.headers
extra: Dict[str, Optional[Union[Dict, bytes]]]
if self.form_data:
extra = {"data": self.form_data}
headers = headers or {}
headers.setdef... | https://github.com/schemathesis/schemathesis/issues/473 | _____________________________ POST: /api/workspace/meshtransform ____________________________
Traceback (most recent call last):
File "/home/nobody/.local/share/virtualenvs/backend-TE7gHulD/lib/python3.7/site-packages/schemathesis/runner/impl/core.py", line 85, in run_test
test(checks, result, **kwargs)
File "/home/nob... | TypeError |
def get_all_endpoints(self) -> Generator[Endpoint, None, None]:
try:
paths = self.raw_schema["paths"] # pylint: disable=unsubscriptable-object
for path, methods in paths.items():
full_path = self.get_full_path(path)
if should_skip_endpoint(full_path, self.endpoint):
... | def get_all_endpoints(self) -> Generator[Endpoint, None, None]:
try:
paths = self.raw_schema["paths"] # pylint: disable=unsubscriptable-object
for path, methods in paths.items():
full_path = self.get_full_path(path)
if should_skip_endpoint(full_path, self.endpoint):
... | https://github.com/schemathesis/schemathesis/issues/448 | Traceback (most recent call last):
File "/var/lang/lib/python3.7/site-packages/schemathesis/schemas.py", line 210, in get_all_endpoints
or should_skip_by_tag(definition.get("tags"), self.tag)
AttributeError: 'str' object has no attribute 'get' | AttributeError |
def display_errors(results: TestResultSet) -> None:
"""Display all errors in the test run."""
if not results.has_errors:
return
display_section_name("ERRORS")
for result in results:
if not result.has_errors:
continue
display_single_error(result)
| def display_errors(results: TestResultSet) -> None:
"""Display all errors in the test run."""
if not results.has_errors:
return
display_section_name("ERRORS")
for result in results.results:
if not result.has_errors:
continue
display_single_error(result)
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def display_single_error(result: TestResult) -> None:
display_subsection(result)
for error, example in result.errors:
message = "".join(traceback.format_exception_only(type(error), error))
click.secho(message, fg="red")
if example is not None:
display_example(example)
| def display_single_error(result: TestResult) -> None:
display_subsection(result)
for error in result.errors:
message = "".join(traceback.format_exception_only(type(error), error))
click.secho(message, fg="red")
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def display_failures(results: TestResultSet) -> None:
"""Display all failures in the test run."""
if not results.has_failures:
return
relevant_results = [result for result in results if not result.is_errored]
if not relevant_results:
return
display_section_name("FAILURES")
for re... | def display_failures(results: TestResultSet) -> None:
"""Display all failures in the test run."""
if not results.has_failures:
return
display_section_name("FAILURES")
for result in results.results:
if not result.has_failures:
continue
display_single_failure(result)
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def display_single_failure(result: TestResult) -> None:
"""Display a failure for a single method / endpoint."""
display_subsection(result)
for check in reversed(result.checks):
if check.example is not None:
display_example(check.example, check.name)
# Display only the latest ... | def display_single_failure(result: TestResult) -> None:
"""Display a failure for a single method / endpoint."""
display_subsection(result)
for check in reversed(result.checks):
if check.example is not None:
output = {
make_verbose_name(attribute): getattr(check.example, a... | https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def add_success(self, name: str, example: Case) -> None:
self.checks.append(Check(name, Status.success, example))
| def add_success(self, name: str) -> None:
self.checks.append(Check(name, Status.success))
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def add_error(self, exception: Exception, example: Optional[Case] = None) -> None:
self.errors.append((exception, example))
| def add_error(self, exception: Exception) -> None:
self.errors.append(exception)
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def execute_from_schema(
schema: BaseSchema,
base_url: str,
checks: Iterable[Callable],
*,
hypothesis_options: Optional[Dict[str, Any]] = None,
auth: Optional[Auth] = None,
headers: Optional[Dict[str, Any]] = None,
) -> Generator[events.ExecutionEvent, None, None]:
"""Execute tests for t... | def execute_from_schema(
schema: BaseSchema,
base_url: str,
checks: Iterable[Callable],
*,
hypothesis_options: Optional[Dict[str, Any]] = None,
auth: Optional[Auth] = None,
headers: Optional[Dict[str, Any]] = None,
) -> Generator[events.ExecutionEvent, None, None]:
"""Execute tests for t... | https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def capture_hypothesis_output() -> Generator[List[str], None, None]:
"""Capture all output of Hypothesis into a list of strings.
It allows us to have more granular control over Schemathesis output.
Usage::
@given(i=st.integers())
def test(i):
assert 0
with capture_hyp... | def capture_hypothesis_output() -> Generator[List[str], None, None]:
"""Capture all output of Hypothesis into a list of strings.
It allows us to have more granular control over Schemathesis output.
Usage::
@given(i=st.integers())
def test(i):
assert 0
with capture_hyp... | https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def get_output(value: str) -> None:
# Drop messages that could be confusing in the Schemathesis context
if value.startswith(
(
"Falsifying example: ",
"You can add @seed",
"Failed to reproduce exception. Expected:",
)
):
return
output.append(va... | def get_output(value: str) -> None:
# Drop messages that could be confusing in the Schemathesis context
if value.startswith(("Falsifying example: ", "You can add @seed")):
return
output.append(value)
| https://github.com/schemathesis/schemathesis/issues/215 | Failed to reproduce exception. Expected:
Traceback (most recent call last):
File "/home/stranger6667/programming/PycharmProjects/schemathesis/src/schemathesis/runner/__init__.py", line 148, in single_test
raise AssertionError
AssertionError | AssertionError |
def save(self, fname, protocol=utils.PICKLE_PROTOCOL):
"""Save AnnoyIndexer instance to disk.
Parameters
----------
fname : str
Path to output. Save will produce 2 files:
`fname`: Annoy index itself.
`fname.dict`: Index metadata.
protocol : int, optional
Protocol for... | def save(self, fname, protocol=2):
"""Save AnnoyIndexer instance to disk.
Parameters
----------
fname : str
Path to output. Save will produce 2 files:
`fname`: Annoy index itself.
`fname.dict`: Index metadata.
protocol : int, optional
Protocol for pickle.
Notes
... | https://github.com/RaRe-Technologies/gensim/issues/1851 | [INFO] 2018-01-21T20:44:59.613Z f2689816-feeb-11e7-b397-b7ff2947dcec testing keys in event dict
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading model from s3://data-d2v/trained_models/model_law
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading... | FileNotFoundError |
def save(self, fname, protocol=utils.PICKLE_PROTOCOL):
"""Save this NmslibIndexer instance to a file.
Parameters
----------
fname : str
Path to the output file,
will produce 2 files: `fname` - parameters and `fname`.d - :class:`~nmslib.NmslibIndex`.
protocol : int, optional
... | def save(self, fname, protocol=2):
"""Save this NmslibIndexer instance to a file.
Parameters
----------
fname : str
Path to the output file,
will produce 2 files: `fname` - parameters and `fname`.d - :class:`~nmslib.NmslibIndex`.
protocol : int, optional
Protocol for pickle.... | https://github.com/RaRe-Technologies/gensim/issues/1851 | [INFO] 2018-01-21T20:44:59.613Z f2689816-feeb-11e7-b397-b7ff2947dcec testing keys in event dict
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading model from s3://data-d2v/trained_models/model_law
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading... | FileNotFoundError |
def _smart_save(
self,
fname,
separately=None,
sep_limit=10 * 1024**2,
ignore=frozenset(),
pickle_protocol=PICKLE_PROTOCOL,
):
"""Save the object to a file. Used internally by :meth:`gensim.utils.SaveLoad.save()`.
Parameters
----------
fname : str
Path to file.
separ... | def _smart_save(
self,
fname,
separately=None,
sep_limit=10 * 1024**2,
ignore=frozenset(),
pickle_protocol=2,
):
"""Save the object to a file. Used internally by :meth:`gensim.utils.SaveLoad.save()`.
Parameters
----------
fname : str
Path to file.
separately : list, ... | https://github.com/RaRe-Technologies/gensim/issues/1851 | [INFO] 2018-01-21T20:44:59.613Z f2689816-feeb-11e7-b397-b7ff2947dcec testing keys in event dict
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading model from s3://data-d2v/trained_models/model_law
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading... | FileNotFoundError |
def save(
self,
fname_or_handle,
separately=None,
sep_limit=10 * 1024**2,
ignore=frozenset(),
pickle_protocol=PICKLE_PROTOCOL,
):
"""Save the object to a file.
Parameters
----------
fname_or_handle : str or file-like
Path to output file or already opened file-like object... | def save(
self,
fname_or_handle,
separately=None,
sep_limit=10 * 1024**2,
ignore=frozenset(),
pickle_protocol=2,
):
"""Save the object to a file.
Parameters
----------
fname_or_handle : str or file-like
Path to output file or already opened file-like object. If the objec... | https://github.com/RaRe-Technologies/gensim/issues/1851 | [INFO] 2018-01-21T20:44:59.613Z f2689816-feeb-11e7-b397-b7ff2947dcec testing keys in event dict
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading model from s3://data-d2v/trained_models/model_law
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading... | FileNotFoundError |
def pickle(obj, fname, protocol=PICKLE_PROTOCOL):
"""Pickle object `obj` to file `fname`, using smart_open so that `fname` can be on S3, HDFS, compressed etc.
Parameters
----------
obj : object
Any python object.
fname : str
Path to pickle file.
protocol : int, optional
... | def pickle(obj, fname, protocol=2):
"""Pickle object `obj` to file `fname`, using smart_open so that `fname` can be on S3, HDFS, compressed etc.
Parameters
----------
obj : object
Any python object.
fname : str
Path to pickle file.
protocol : int, optional
Pickle protoco... | https://github.com/RaRe-Technologies/gensim/issues/1851 | [INFO] 2018-01-21T20:44:59.613Z f2689816-feeb-11e7-b397-b7ff2947dcec testing keys in event dict
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading model from s3://data-d2v/trained_models/model_law
[INFO] 2018-01-21T20:44:59.614Z f2689816-feeb-11e7-b397-b7ff2947dcec loading... | FileNotFoundError |
def load(cls, *args, **kwargs):
"""Load a previously saved :class:`~gensim.models.phrases.Phrases` /
:class:`~gensim.models.phrases.FrozenPhrases` model.
Handles backwards compatibility from older versions which did not support pluggable scoring functions.
Parameters
----------
args : object
... | def load(cls, *args, **kwargs):
"""Load a previously saved :class:`~gensim.models.phrases.Phrases` /
:class:`~gensim.models.phrases.FrozenPhrases` model.
Handles backwards compatibility from older versions which did not support pluggable scoring functions.
Parameters
----------
args : object
... | https://github.com/RaRe-Technologies/gensim/issues/3031 | RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for... | RuntimeError |
def __init__(
self,
sentences=None,
min_count=5,
threshold=10.0,
max_vocab_size=40000000,
delimiter="_",
progress_per=10000,
scoring="default",
connector_words=frozenset(),
):
"""
Parameters
----------
sentences : iterable of list of str, optional
The `senten... | def __init__(
self,
sentences=None,
min_count=5,
threshold=10.0,
max_vocab_size=40000000,
delimiter="_",
progress_per=10000,
scoring="default",
connector_words=frozenset(),
):
"""
Parameters
----------
sentences : iterable of list of str, optional
The `senten... | https://github.com/RaRe-Technologies/gensim/issues/3031 | RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for... | RuntimeError |
def _learn_vocab(sentences, max_vocab_size, delimiter, connector_words, progress_per):
"""Collect unigram and bigram counts from the `sentences` iterable."""
sentence_no, total_words, min_reduce = -1, 0, 1
vocab = {}
logger.info("collecting all words and their counts")
for sentence_no, sentence in e... | def _learn_vocab(sentences, max_vocab_size, delimiter, connector_words, progress_per):
"""Collect unigram and bigram counts from the `sentences` iterable."""
sentence_no, total_words, min_reduce = -1, 0, 1
vocab = defaultdict(int)
logger.info("collecting all words and their counts")
for sentence_no,... | https://github.com/RaRe-Technologies/gensim/issues/3031 | RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for... | RuntimeError |
def add_vocab(self, sentences):
"""Update model parameters with new `sentences`.
Parameters
----------
sentences : iterable of list of str
Text corpus to update this model's parameters from.
Example
-------
.. sourcecode:: pycon
>>> from gensim.test.utils import datapath
... | def add_vocab(self, sentences):
"""Update model parameters with new `sentences`.
Parameters
----------
sentences : iterable of list of str
Text corpus to update this model's parameters from.
Example
-------
.. sourcecode:: pycon
>>> from gensim.test.utils import datapath
... | https://github.com/RaRe-Technologies/gensim/issues/3031 | RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for... | RuntimeError |
def score_candidate(self, word_a, word_b, in_between):
# Micro optimization: check for quick early-out conditions, before the actual scoring.
word_a_cnt = self.vocab.get(word_a, 0)
if word_a_cnt <= 0:
return None, None
word_b_cnt = self.vocab.get(word_b, 0)
if word_b_cnt <= 0:
retur... | def score_candidate(self, word_a, word_b, in_between):
# Micro optimization: check for quick early-out conditions, before the actual scoring.
word_a_cnt = self.vocab[word_a]
if word_a_cnt <= 0:
return None, None
word_b_cnt = self.vocab[word_b]
if word_b_cnt <= 0:
return None, None
... | https://github.com/RaRe-Technologies/gensim/issues/3031 | RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for... | RuntimeError |
def fit(self, X, y=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {iterable of :class:`~gensim.models.doc2vec.TaggedDocument`, iterable of list of str}
A collection of tagged documents used for training the model.
Returns
-------
:class:`~ge... | def fit(self, X, y=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {iterable of :class:`~gensim.models.doc2vec.TaggedDocument`, iterable of list of str}
A collection of tagged documents used for training the model.
Returns
-------
:class:`~ge... | https://github.com/RaRe-Technologies/gensim/issues/2556 | Traceback (most recent call last):
File "main.py", line 9, in <module>
transformer.fit(series)
File "venv/lib/python3.7/site-packages/gensim/sklearn_api/d2vmodel.py", line 162, in fit
if isinstance(X[0], doc2vec.TaggedDocument):
File "venv/lib/python3.7/site-packages/pandas/core/series.py", line 868, in __getitem__
re... | KeyError |
def _load_vocab(fin, new_format, encoding="utf-8"):
"""Load a vocabulary from a FB binary.
Before the vocab is ready for use, call the prepare_vocab function and pass
in the relevant parameters from the model.
Parameters
----------
fin : file
An open file pointer to the binary.
new... | def _load_vocab(fin, new_format, encoding="utf-8"):
"""Load a vocabulary from a FB binary.
Before the vocab is ready for use, call the prepare_vocab function and pass
in the relevant parameters from the model.
Parameters
----------
fin : file
An open file pointer to the binary.
new... | https://github.com/RaRe-Technologies/gensim/issues/2378 | ---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-29-a054256d6f88> in <module>
1 #load model
2 from gensim.models.fasttext import FastText
----> 3 mod = FastText.load_fasttext_format('wiki-news-300d-1M-s... | AssertionError |
def _load_matrix(fin, new_format=True):
"""Load a matrix from fastText native format.
Interprets the matrix dimensions and type from the file stream.
Parameters
----------
fin : file
A file handle opened for reading.
new_format : bool, optional
True if the quant_input variable ... | def _load_matrix(fin, new_format=True):
"""Load a matrix from fastText native format.
Interprets the matrix dimensions and type from the file stream.
Parameters
----------
fin : file
A file handle opened for reading.
new_format : bool, optional
True if the quant_input variable ... | https://github.com/RaRe-Technologies/gensim/issues/2473 | ValueError Traceback (most recent call last)
<ipython-input-7-615bb517a8f5> in <module>
----> 1 model_fast = gensim.models.fasttext.load_facebook_model('cc.en.300.bin.gz')
c:\users\david\desktop\bennet~1\bennet~1\bert_t~1\env\lib\site-packages\gensim\models\fasttext.py in load_facebook_m... | ValueError |
def load(cls, *args, **kwargs):
"""Load a previously saved `FastText` model.
Parameters
----------
fname : str
Path to the saved file.
Returns
-------
:class:`~gensim.models.fasttext.FastText`
Loaded model.
See Also
--------
:meth:`~gensim.models.fasttext.FastT... | def load(cls, *args, **kwargs):
"""Load a previously saved `FastText` model.
Parameters
----------
fname : str
Path to the saved file.
Returns
-------
:class:`~gensim.models.fasttext.FastText`
Loaded model.
See Also
--------
:meth:`~gensim.models.fasttext.FastT... | https://github.com/RaRe-Technologies/gensim/issues/2453 | ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-14-5fac1e42e24a> in <module>()
----> 1 ft2.wv.word_vec('слово123')
~/anaconda3/lib/python3.6/site-packages/gensim/models/keyedvectors.py in word_vec(sel... | IndexError |
def load(cls, fname_or_handle, **kwargs):
model = super(WordEmbeddingsKeyedVectors, cls).load(fname_or_handle, **kwargs)
_try_upgrade(model)
return model
| def load(cls, fname_or_handle, **kwargs):
model = super(WordEmbeddingsKeyedVectors, cls).load(fname_or_handle, **kwargs)
if not hasattr(model, "compatible_hash"):
model.compatible_hash = False
if hasattr(model, "hash2index"):
_rollback_optimization(model)
return model
| https://github.com/RaRe-Technologies/gensim/issues/2453 | ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-14-5fac1e42e24a> in <module>()
----> 1 ft2.wv.word_vec('слово123')
~/anaconda3/lib/python3.6/site-packages/gensim/models/keyedvectors.py in word_vec(sel... | IndexError |
def _load_fasttext_format(model_file, encoding="utf-8", full_model=True):
"""Load the input-hidden weight matrix from Facebook's native fasttext `.bin` and `.vec` output files.
Parameters
----------
model_file : str
Path to the FastText output files.
FastText outputs two model files - `... | def _load_fasttext_format(model_file, encoding="utf-8", full_model=True):
"""Load the input-hidden weight matrix from Facebook's native fasttext `.bin` and `.vec` output files.
Parameters
----------
model_file : str
Path to the FastText output files.
FastText outputs two model files - `... | https://github.com/RaRe-Technologies/gensim/issues/2350 | AssertionError: unexpected number of vectors
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<command-3269280551404242> in <module>()
1 #gensim FastText (having some different features)
----> 2 ge_model = ge_ft.load... | AssertionError |
def load_old_doc2vec(*args, **kwargs):
old_model = Doc2Vec.load(*args, **kwargs)
params = {
"dm_mean": old_model.__dict__.get("dm_mean", None),
"dm": old_model.dm,
"dbow_words": old_model.dbow_words,
"dm_concat": old_model.dm_concat,
"dm_tag_count": old_model.dm_tag_count... | def load_old_doc2vec(*args, **kwargs):
old_model = Doc2Vec.load(*args, **kwargs)
params = {
"dm_mean": old_model.__dict__.get("dm_mean", None),
"dm": old_model.dm,
"dbow_words": old_model.dbow_words,
"dm_concat": old_model.dm_concat,
"dm_tag_count": old_model.dm_tag_count... | https://github.com/RaRe-Technologies/gensim/issues/2000 | Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/gensim/models/word2vec.py", line 975, in load
return super(Word2Vec, cls).load(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/gensim/models/base_any2vec.py", line 629, in load
model = super(BaseWordEmbeddingsModel, cls).load(... | AttributeError |
def load_old_word2vec(*args, **kwargs):
old_model = Word2Vec.load(*args, **kwargs)
vector_size = getattr(old_model, "vector_size", old_model.layer1_size)
params = {
"size": vector_size,
"alpha": old_model.alpha,
"window": old_model.window,
"min_count": old_model.min_count,
... | def load_old_word2vec(*args, **kwargs):
old_model = Word2Vec.load(*args, **kwargs)
params = {
"size": old_model.vector_size,
"alpha": old_model.alpha,
"window": old_model.window,
"min_count": old_model.min_count,
"max_vocab_size": old_model.__dict__.get("max_vocab_size", ... | https://github.com/RaRe-Technologies/gensim/issues/2000 | Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/gensim/models/word2vec.py", line 975, in load
return super(Word2Vec, cls).load(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/gensim/models/base_any2vec.py", line 629, in load
model = super(BaseWordEmbeddingsModel, cls).load(... | AttributeError |
def inference(
self, chunk, author2doc, doc2author, rhot, collect_sstats=False, chunk_doc_idx=None
):
"""Give a `chunk` of sparse document vectors, update gamma for each author corresponding to the `chuck`.
Warnings
--------
The whole input chunk of document is assumed to fit in RAM, chunking of a ... | def inference(
self, chunk, author2doc, doc2author, rhot, collect_sstats=False, chunk_doc_idx=None
):
"""Give a `chunk` of sparse document vectors, update gamma for each author corresponding to the `chuck`.
Warnings
--------
The whole input chunk of document is assumed to fit in RAM, chunking of a ... | https://github.com/RaRe-Technologies/gensim/issues/1589 | Traceback (most recent call last):
File "C:\Users\Sara\Desktop\E-COM\Final Project\Working on data\at_clustering.py", line 161, in <module>
test_corpus = test_corpus, test_d2a = test_doc2author, test_a2d = test_author2doc, limit = 25)
File "C:\Users\Sara\Desktop\E-COM\Final Project\Working on data\at_clustering.py", li... | IndexError |
def bound(
self,
chunk,
chunk_doc_idx=None,
subsample_ratio=1.0,
author2doc=None,
doc2author=None,
):
"""Estimate the variational bound of documents from `corpus`.
:math:`\mathbb{E_{q}}[\log p(corpus)] - \mathbb{E_{q}}[\log q(corpus)]`
Notes
-----
There are basically two us... | def bound(
self,
chunk,
chunk_doc_idx=None,
subsample_ratio=1.0,
author2doc=None,
doc2author=None,
):
"""Estimate the variational bound of documents from `corpus`.
:math:`\mathbb{E_{q}}[\log p(corpus)] - \mathbb{E_{q}}[\log q(corpus)]`
Notes
-----
There are basically two us... | https://github.com/RaRe-Technologies/gensim/issues/1589 | Traceback (most recent call last):
File "C:\Users\Sara\Desktop\E-COM\Final Project\Working on data\at_clustering.py", line 161, in <module>
test_corpus = test_corpus, test_d2a = test_doc2author, test_a2d = test_author2doc, limit = 25)
File "C:\Users\Sara\Desktop\E-COM\Final Project\Working on data\at_clustering.py", li... | IndexError |
def _load_relations(self):
"""Load relations from the train data and build vocab."""
vocab = {}
index2word = []
all_relations = [] # List of all relation pairs
node_relations = defaultdict(
set
) # Mapping from node index to its related node indices
logger.info("Loading relations ... | def _load_relations(self):
"""Load relations from the train data and build vocab."""
vocab = {}
index2word = []
all_relations = [] # List of all relation pairs
node_relations = defaultdict(
set
) # Mapping from node index to its related node indices
logger.info("Loading relations ... | https://github.com/RaRe-Technologies/gensim/issues/1917 | 2018-02-05 10:49:58,008 - training model of size 50 with 1 workers on 128138847 relations for 1 epochs and 10 burn-in epochs, using lr=0.01000 burn-in lr=0.01000 negative=10
2018-02-05 10:49:58,010 - Starting burn-in (10 epochs)----------------------------------------
2018-02-05 10:56:51,400 - Training on epoch 1, exam... | IndexError |
def _get_candidate_negatives(self):
"""Returns candidate negatives of size `self.negative` from the negative examples buffer.
Returns
-------
numpy.array
Array of shape (`self.negative`,) containing indices of negative nodes.
"""
if self._negatives_buffer.num_items() < self.negative:
... | def _get_candidate_negatives(self):
"""Returns candidate negatives of size `self.negative` from the negative examples buffer.
Returns
-------
numpy.array
Array of shape (`self.negative`,) containing indices of negative nodes.
"""
if self._negatives_buffer.num_items() < self.negative:
... | https://github.com/RaRe-Technologies/gensim/issues/1917 | 2018-02-05 10:49:58,008 - training model of size 50 with 1 workers on 128138847 relations for 1 epochs and 10 burn-in epochs, using lr=0.01000 burn-in lr=0.01000 negative=10
2018-02-05 10:49:58,010 - Starting burn-in (10 epochs)----------------------------------------
2018-02-05 10:56:51,400 - Training on epoch 1, exam... | IndexError |
def save(self, *args, **kwargs):
"""Save complete model to disk, inherited from :class:`gensim.utils.SaveLoad`."""
self._loss_grad = None # Can't pickle autograd fn to disk
attrs_to_ignore = ["_node_probabilities", "_node_counts_cumsum"]
kwargs["ignore"] = set(list(kwargs.get("ignore", [])) + attrs_to_... | def save(self, *args, **kwargs):
"""Save complete model to disk, inherited from :class:`gensim.utils.SaveLoad`."""
self._loss_grad = None # Can't pickle autograd fn to disk
super(PoincareModel, self).save(*args, **kwargs)
| https://github.com/RaRe-Technologies/gensim/issues/1917 | 2018-02-05 10:49:58,008 - training model of size 50 with 1 workers on 128138847 relations for 1 epochs and 10 burn-in epochs, using lr=0.01000 burn-in lr=0.01000 negative=10
2018-02-05 10:49:58,010 - Starting burn-in (10 epochs)----------------------------------------
2018-02-05 10:56:51,400 - Training on epoch 1, exam... | IndexError |
def load(cls, *args, **kwargs):
"""Load model from disk, inherited from :class:`~gensim.utils.SaveLoad`."""
model = super(PoincareModel, cls).load(*args, **kwargs)
model._init_node_probabilities()
return model
| def load(cls, *args, **kwargs):
"""Load model from disk, inherited from :class:`~gensim.utils.SaveLoad`."""
model = super(PoincareModel, cls).load(*args, **kwargs)
return model
| https://github.com/RaRe-Technologies/gensim/issues/1917 | 2018-02-05 10:49:58,008 - training model of size 50 with 1 workers on 128138847 relations for 1 epochs and 10 burn-in epochs, using lr=0.01000 burn-in lr=0.01000 negative=10
2018-02-05 10:49:58,010 - Starting burn-in (10 epochs)----------------------------------------
2018-02-05 10:56:51,400 - Training on epoch 1, exam... | IndexError |
def fit(self, X, y=None):
"""
Fit the model according to the given training data.
Calls gensim.models.Doc2Vec
"""
if isinstance(X[0], doc2vec.TaggedDocument):
d2v_sentences = X
else:
d2v_sentences = [
doc2vec.TaggedDocument(words, [i]) for i, words in enumerate(X)
... | def fit(self, X, y=None):
"""
Fit the model according to the given training data.
Calls gensim.models.Doc2Vec
"""
if isinstance(X[0], doc2vec.TaggedDocument):
d2v_sentences = X
else:
d2v_sentences = [
doc2vec.TaggedDocument(words, [i]) for i, words in enumerate(X)
... | https://github.com/RaRe-Technologies/gensim/issues/1937 | /lib/python3.6/site-packages/gensim/models/doc2vec.py:355: UserWarning: The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.
warnings.warn("The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.")
/lib/python3.6/site-packages/gensim/models/doc2vec.py:359: User... | TypeError |
def load_old_doc2vec(*args, **kwargs):
old_model = Doc2Vec.load(*args, **kwargs)
params = {
"dm_mean": old_model.__dict__.get("dm_mean", None),
"dm": old_model.dm,
"dbow_words": old_model.dbow_words,
"dm_concat": old_model.dm_concat,
"dm_tag_count": old_model.dm_tag_count... | def load_old_doc2vec(*args, **kwargs):
old_model = Doc2Vec.load(*args, **kwargs)
params = {
"dm_mean": old_model.__dict__.get("dm_mean", None),
"dm": old_model.dm,
"dbow_words": old_model.dbow_words,
"dm_concat": old_model.dm_concat,
"dm_tag_count": old_model.dm_tag_count... | https://github.com/RaRe-Technologies/gensim/issues/1952 | from gensim.models import Doc2Vec
model = Doc2Vec.load('some-3.2-model/model')
model.infer_vector(['foo'])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-851ff3602fcf> in <module>()
----> 1 model... | AttributeError |
def index_to_doctag(self, i_index):
"""Return string key for given i_index, if available. Otherwise return raw int doctag (same int)."""
candidate_offset = i_index - self.max_rawint - 1
if 0 <= candidate_offset < len(self.offset2doctag):
return self.offset2doctag[candidate_offset]
else:
... | def index_to_doctag(self, i_index):
"""Return string key for given i_index, if available. Otherwise return raw int doctag (same int)."""
candidate_offset = i_index - self.max_rawint - 1
if 0 <= candidate_offset < len(self.offset2doctag):
return self.ffset2doctag[candidate_offset]
else:
r... | https://github.com/RaRe-Technologies/gensim/issues/1952 | from gensim.models import Doc2Vec
model = Doc2Vec.load('some-3.2-model/model')
model.infer_vector(['foo'])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-851ff3602fcf> in <module>()
----> 1 model... | AttributeError |
def get_similarities(self, query):
"""Get similarity between `query` and current index instance.
Warnings
--------
Do not use this function directly; use the self[query] syntax instead.
Parameters
----------
query : {list of (int, number), iterable of list of (int, number)
Document... | def get_similarities(self, query):
"""Get similarity between `query` and current index instance.
Warnings
--------
Do not use this function directly; use the self[query] syntax instead.
Parameters
----------
query : {list of (int, number), iterable of list of (int, number), :class:`scipy.s... | https://github.com/RaRe-Technologies/gensim/issues/1955 | In [249]: softcos_index[tfidf[corpus]]
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-249-2d8c4d759cc9> in <module>()
----> 1 softcos_index[tfidf[corpus]]
/Users/natalied/Projects/canonical_answers/.... | RuntimeError |
def get_similarities(self, query):
"""Get similarity between `query` and current index instance.
Warnings
--------
Do not use this function directly; use the self[query] syntax instead.
Parameters
----------
query : {list of (int, number), iterable of list of (int, number)
Document... | def get_similarities(self, query):
"""Get similarity between `query` and current index instance.
Warnings
--------
Do not use this function directly; use the self[query] syntax instead.
Parameters
----------
query : {list of (int, number), iterable of list of (int, number), :class:`scipy.s... | https://github.com/RaRe-Technologies/gensim/issues/1955 | In [249]: softcos_index[tfidf[corpus]]
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-249-2d8c4d759cc9> in <module>()
----> 1 softcos_index[tfidf[corpus]]
/Users/natalied/Projects/canonical_answers/.... | RuntimeError |
def summarize_corpus(corpus, ratio=0.2):
"""
Returns a list of the most important documents of a corpus using a
variation of the TextRank algorithm.
The input must have at least INPUT_MIN_LENGTH (%d) documents for the
summary to make sense.
The length of the output can be specified using the ra... | def summarize_corpus(corpus, ratio=0.2):
"""
Returns a list of the most important documents of a corpus using a
variation of the TextRank algorithm.
The input must have at least INPUT_MIN_LENGTH (%d) documents for the
summary to make sense.
The length of the output can be specified using the ra... | https://github.com/RaRe-Technologies/gensim/issues/1531 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-15020c19bb47> in <module>()
1 from gensim.summarization import summarize
2 text = "To whom it may concern, Only after weeks of using my new Wal-Mart ma... | TypeError |
def summarize(text, ratio=0.2, word_count=None, split=False):
"""
Returns a summarized version of the given text using a variation of
the TextRank algorithm.
The input must be longer than INPUT_MIN_LENGTH sentences for the
summary to make sense and must be given as a string.
The output summary ... | def summarize(text, ratio=0.2, word_count=None, split=False):
"""
Returns a summarized version of the given text using a variation of
the TextRank algorithm.
The input must be longer than INPUT_MIN_LENGTH sentences for the
summary to make sense and must be given as a string.
The output summary ... | https://github.com/RaRe-Technologies/gensim/issues/1531 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-15020c19bb47> in <module>()
1 from gensim.summarization import summarize
2 text = "To whom it may concern, Only after weeks of using my new Wal-Mart ma... | TypeError |
def __init__(self, *args):
super(WordOccurrenceAccumulator, self).__init__(*args)
self._occurrences = np.zeros(self._vocab_size, dtype="uint32")
self._co_occurrences = sps.lil_matrix(
(self._vocab_size, self._vocab_size), dtype="uint32"
)
self._uniq_words = np.zeros(
(self._vocab_si... | def __init__(self, *args):
super(WordOccurrenceAccumulator, self).__init__(*args)
self._occurrences = np.zeros(self._vocab_size, dtype="uint32")
self._co_occurrences = sps.lil_matrix(
(self._vocab_size, self._vocab_size), dtype="uint32"
)
self._uniq_words = np.zeros(
(self._vocab_si... | https://github.com/RaRe-Technologies/gensim/issues/1441 | ----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python35-x64\lib\site-packages\gensim\test\test_text_analysis.py", line 57, in test_occurrence_counting
self.assertEqual(3, accumulator.get_occurrences("this"))
AssertionError: 3 != 0
-------------------- ... | AssertionError |
def analyze_text(self, window, doc_num=None):
self._slide_window(window, doc_num)
mask = self._uniq_words[:-1] # to exclude none token
if mask.any():
self._occurrences[mask] += 1
self._counter.update(itertools.combinations(np.nonzero(mask)[0], 2))
| def analyze_text(self, window, doc_num=None):
self._slide_window(window, doc_num)
if self._mask.any():
self._occurrences[self._mask] += 1
self._counter.update(itertools.combinations(np.nonzero(self._mask)[0], 2))
| https://github.com/RaRe-Technologies/gensim/issues/1441 | ----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python35-x64\lib\site-packages\gensim\test\test_text_analysis.py", line 57, in test_occurrence_counting
self.assertEqual(3, accumulator.get_occurrences("this"))
AssertionError: 3 != 0
-------------------- ... | AssertionError |
def _symmetrize(self):
"""Word pairs may have been encountered in (i, j) and (j, i) order.
Rather than enforcing a particular ordering during the update process,
we choose to symmetrize the co-occurrence matrix after accumulation has completed.
"""
co_occ = self._co_occurrences
co_occ.setdiag(se... | def _symmetrize(self):
"""Word pairs may have been encountered in (i, j) and (j, i) order.
Rather than enforcing a particular ordering during the update process,
we choose to symmetrize the co-occurrence matrix after accumulation has completed.
"""
co_occ = self._co_occurrences
co_occ.setdiag(se... | https://github.com/RaRe-Technologies/gensim/issues/1441 | ----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python35-x64\lib\site-packages\gensim\test\test_text_analysis.py", line 57, in test_occurrence_counting
self.assertEqual(3, accumulator.get_occurrences("this"))
AssertionError: 3 != 0
-------------------- ... | AssertionError |
def __init__(
self,
model=None,
topics=None,
texts=None,
corpus=None,
dictionary=None,
window_size=None,
coherence="c_v",
topn=10,
processes=-1,
):
"""
Args:
model : Pre-trained topic model. Should be provided if topics is not provided.
Currently suppo... | def __init__(
self,
model=None,
topics=None,
texts=None,
corpus=None,
dictionary=None,
window_size=None,
coherence="c_v",
topn=10,
processes=-1,
):
"""
Args:
----
model : Pre-trained topic model. Should be provided if topics is not provided.
Currently ... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def evaluate_word_pairs(
self,
pairs,
delimiter="\t",
restrict_vocab=300000,
case_insensitive=True,
dummy4unknown=False,
):
"""
Compute correlation of the model with human similarity judgments. `pairs` is a filename of a dataset where
lines are 3-tuples, each consisting of a word pai... | def evaluate_word_pairs(
self,
pairs,
delimiter="\t",
restrict_vocab=300000,
case_insensitive=True,
dummy4unknown=False,
):
"""
Compute correlation of the model with human similarity judgments. `pairs` is a filename of a dataset where
lines are 3-tuples, each consisting of a word pai... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def diff(
self, other, distance="kullback_leibler", num_words=100, n_ann_terms=10, normed=True
):
"""
Calculate difference topic2topic between two Lda models
`other` instances of `LdaMulticore` or `LdaModel`
`distance` is function that will be applied to calculate difference between any topic pair.
... | def diff(
self, other, distance="kullback_leibler", num_words=100, n_ann_terms=10, normed=True
):
"""
Calculate difference topic2topic between two Lda models
`other` instances of `LdaMulticore` or `LdaModel`
`distance` is function that will be applied to calculate difference between any topic pair.
... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def fit_lda_seq(
self, corpus, lda_inference_max_iter, em_min_iter, em_max_iter, chunksize
):
"""
fit an lda sequence model:
for each time period:
set up lda model with E[log p(w|z)] and \alpha
for each document:
perform posterior inference
up... | def fit_lda_seq(
self, corpus, lda_inference_max_iter, em_min_iter, em_max_iter, chunksize
):
"""
fit an lda sequence model:
for each time period
set up lda model with E[log p(w|z)] and \alpha
for each document
perform posterior inference
update sufficient statis... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def compute_post_variance(self, word, chain_variance):
"""
Based on the Variational Kalman Filtering approach for Approximate Inference [https://www.cs.princeton.edu/~blei/papers/BleiLafferty2006a.pdf]
This function accepts the word to compute variance for, along with the associated sslm class object, and r... | def compute_post_variance(self, word, chain_variance):
"""
Based on the Variational Kalman Filtering approach for Approximate Inference [https://www.cs.princeton.edu/~blei/papers/BleiLafferty2006a.pdf]
This function accepts the word to compute variance for, along with the associated sslm class object, and r... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def malletmodel2ldamodel(mallet_model, gamma_threshold=0.001, iterations=50):
"""
Function to convert mallet model to gensim LdaModel. This works by copying the
training model weights (alpha, beta...) from a trained mallet model into the
gensim model.
Args:
mallet_model : Trained mallet mod... | def malletmodel2ldamodel(mallet_model, gamma_threshold=0.001, iterations=50):
"""
Function to convert mallet model to gensim LdaModel. This works by copying the
training model weights (alpha, beta...) from a trained mallet model into the
gensim model.
Args:
----
mallet_model : Trained malle... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def vwmodel2ldamodel(vw_model, iterations=50):
"""
Function to convert vowpal wabbit model to gensim LdaModel. This works by
simply copying the training model weights (alpha, beta...) from a trained
vwmodel into the gensim model.
Args:
vw_model : Trained vowpal wabbit model.
iterati... | def vwmodel2ldamodel(vw_model, iterations=50):
"""
Function to convert vowpal wabbit model to gensim LdaModel. This works by
simply copying the training model weights (alpha, beta...) from a trained
vwmodel into the gensim model.
Args:
----
vw_model : Trained vowpal wabbit model.
iterat... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def train(
cls,
wr_path,
corpus_file,
out_name,
size=100,
window=15,
symmetric=1,
min_count=5,
max_vocab_size=0,
sgd_num=100,
lrate=0.001,
period=10,
iter=90,
epsilon=0.75,
dump_period=10,
reg=0,
alpha=100,
beta=99,
loss="hinge",
memory=4.0... | def train(
cls,
wr_path,
corpus_file,
out_name,
size=100,
window=15,
symmetric=1,
min_count=5,
max_vocab_size=0,
sgd_num=100,
lrate=0.001,
period=10,
iter=90,
epsilon=0.75,
dump_period=10,
reg=0,
alpha=100,
beta=99,
loss="hinge",
memory=4.0... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def glove2word2vec(glove_input_file, word2vec_output_file):
"""Convert `glove_input_file` in GloVe format into `word2vec_output_file` in word2vec format."""
num_lines, num_dims = get_glove_info(glove_input_file)
logger.info(
"converting %i vectors from %s to %s",
num_lines,
glove_inp... | def glove2word2vec(glove_input_file, word2vec_output_file):
"""Convert `glove_input_file` in GloVe format into `word2vec_output_file in word2vec format."""
num_lines, num_dims = get_glove_info(glove_input_file)
logger.info(
"converting %i vectors from %s to %s",
num_lines,
glove_inpu... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def arithmetic_mean(confirmed_measures):
"""
This functoin performs the arithmetic mean aggregation on the output obtained from
the confirmation measure module.
Args:
confirmed_measures : list of calculated confirmation measure on each set in the segmented topics.
Returns:
mean : A... | def arithmetic_mean(confirmed_measures):
"""
This functoin performs the arithmetic mean aggregation on the output obtained from
the confirmation measure module.
Args:
----
confirmed_measures : list of calculated confirmation measure on each set in the segmented topics.
Returns:
-------... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def log_conditional_probability(segmented_topics, accumulator):
"""
This function calculates the log-conditional-probability measure
which is used by coherence measures such as U_mass.
This is defined as: m_lc(S_i) = log[(P(W', W*) + e) / P(W*)]
Args:
segmented_topics : Output from the segm... | def log_conditional_probability(segmented_topics, accumulator):
"""
This function calculates the log-conditional-probability measure
which is used by coherence measures such as U_mass.
This is defined as: m_lc(S_i) = log[(P(W', W*) + e) / P(W*)]
Args:
----
segmented_topics : Output from the... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def log_ratio_measure(segmented_topics, accumulator, normalize=False):
"""
If normalize=False:
Popularly known as PMI.
This function calculates the log-ratio-measure which is used by
coherence measures such as c_v.
This is defined as: m_lr(S_i) = log[(P(W', W*) + e) / (P(W') * P(... | def log_ratio_measure(segmented_topics, accumulator, normalize=False):
"""
If normalize=False:
Popularly known as PMI.
This function calculates the log-ratio-measure which is used by
coherence measures such as c_v.
This is defined as: m_lr(S_i) = log[(P(W', W*) + e) / (P(W') * P(... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def cosine_similarity(segmented_topics, accumulator, topics, measure="nlr", gamma=1):
"""
This function calculates the indirect cosine measure. Given context vectors
u = V(W') and w = V(W*) for the word sets of a pair S_i = (W', W*) indirect
cosine measure is computed as the cosine similarity between u ... | def cosine_similarity(segmented_topics, accumulator, topics, measure="nlr", gamma=1):
"""
This function calculates the indirect cosine measure. Given context vectors
_ _ _ _
u = V(W') and w = V(W*) for the word sets of a pair S_i = (W', W*) indirect
... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def p_boolean_document(corpus, segmented_topics):
"""This function performs the boolean document probability estimation.
Boolean document estimates the probability of a single word as the number
of documents in which the word occurs divided by the total number of documents.
Args:
corpus : The c... | def p_boolean_document(corpus, segmented_topics):
"""This function performs the boolean document probability estimation.
Boolean document estimates the probability of a single word as the number
of documents in which the word occurs divided by the total number of documents.
Args:
----
corpus : ... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def p_boolean_sliding_window(
texts, segmented_topics, dictionary, window_size, processes=1
):
"""This function performs the boolean sliding window probability estimation.
Boolean sliding window determines word counts using a sliding window. The window
moves over the documents one word token per step. ... | def p_boolean_sliding_window(
texts, segmented_topics, dictionary, window_size, processes=1
):
"""This function performs the boolean sliding window probability estimation.
Boolean sliding window determines word counts using a sliding window. The window
moves over the documents one word token per step. ... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def unique_ids_from_segments(segmented_topics):
"""Return the set of all unique ids in a list of segmented topics.
Args:
segmented_topics: list of tuples of (word_id_set1, word_id_set2). Each word_id_set
is either a single integer, or a `numpy.ndarray` of integers.
Returns:
uniq... | def unique_ids_from_segments(segmented_topics):
"""Return the set of all unique ids in a list of segmented topics.
Args:
----
segmented_topics: list of tuples of (word_id_set1, word_id_set2). Each word_id_set
is either a single integer, or a `numpy.ndarray` of integers.
Return... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def s_one_pre(topics):
"""
This function performs s_one_pre segmentation on a list of topics.
s_one_pre segmentation is defined as: s_one_pre = {(W', W*) | W' = {w_i}; W* = {w_j}; w_i, w_j belongs to W; i > j}
Example:
>>> topics = [np.array([1, 2, 3]), np.array([4, 5, 6])]
>>> s_one_pr... | def s_one_pre(topics):
"""
This function performs s_one_pre segmentation on a list of topics.
s_one_pre segmentation is defined as: s_one_pre = {(W', W*) | W' = {w_i};
W* = {w_j}; w_i, w_j belongs to W; i > j}
Example:
>>> topics... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def s_one_one(topics):
"""
This function performs s_one_one segmentation on a list of topics.
s_one_one segmentation is defined as: s_one_one = {(W', W*) | W' = {w_i}; W* = {w_j}; w_i, w_j belongs to W; i != j}
Example:
>>> topics = [np.array([1, 2, 3]), np.array([4, 5, 6])]
>>> s_one_p... | def s_one_one(topics):
"""
This function performs s_one_one segmentation on a list of topics.
s_one_one segmentation is defined as: s_one_one = {(W', W*) | W' = {w_i};
W* = {w_j}; w_i, w_j belongs to W; i != j}
Example:
>>> topic... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def s_one_set(topics):
"""
This function performs s_one_set segmentation on a list of topics.
s_one_set segmentation is defined as: s_one_set = {(W', W*) | W' = {w_i}; w_i belongs to W; W* = W}
Example:
>>> topics = [np.array([9, 10, 7])
>>> s_one_set(topics)
[[(9, array([ 9, 10,... | def s_one_set(topics):
"""
This function performs s_one_set segmentation on a list of topics.
s_one_set segmentation is defined as: s_one_set = {(W', W*) | W' = {w_i}; w_i belongs to W;
W* = W}
Example:
>>> topics = [np.array([9, ... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def _ids_to_words(ids, dictionary):
"""Convert an iterable of ids to their corresponding words using a dictionary.
This function abstracts away the differences between the HashDictionary and the standard one.
Args:
ids: list of list of tuples, where each tuple contains (token_id, iterable of token_... | def _ids_to_words(ids, dictionary):
"""Convert an iterable of ids to their corresponding words using a dictionary.
This function abstracts away the differences between the HashDictionary and the standard one.
Args:
----
ids: list of list of tuples, where each tuple contains (token_id, iterable of t... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def __init__(self, relevant_ids, dictionary):
"""
Args:
relevant_ids: the set of words that occurrences should be accumulated for.
dictionary: Dictionary instance with mappings for the relevant_ids.
"""
super(WindowedTextsAnalyzer, self).__init__(relevant_ids, dictionary)
self._none_... | def __init__(self, relevant_ids, dictionary):
"""
Args:
----
relevant_ids: the set of words that occurrences should be accumulated for.
dictionary: Dictionary instance with mappings for the relevant_ids.
"""
super(WindowedTextsAnalyzer, self).__init__(relevant_ids, dictionary)
self._none... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def __init__(self, processes, *args, **kwargs):
"""
Args:
processes : number of processes to use; must be at least two.
args : should include `relevant_ids` and `dictionary` (see `UsesDictionary.__init__`).
kwargs : can include `batch_size`, which is the number of docs to send to a worke... | def __init__(self, processes, *args, **kwargs):
"""
Args:
----
processes : number of processes to use; must be at least two.
args : should include `relevant_ids` and `dictionary` (see `UsesDictionary.__init__`).
kwargs : can include `batch_size`, which is the number of docs to send to a worker a... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def strided_windows(ndarray, window_size):
"""
Produce a numpy.ndarray of windows, as from a sliding window.
>>> strided_windows(np.arange(5), 2)
array([[0, 1],
[1, 2],
[2, 3],
[3, 4]])
>>> strided_windows(np.arange(10), 5)
array([[0, 1, 2, 3, 4],
[1,... | def strided_windows(ndarray, window_size):
"""
Produce a numpy.ndarray of windows, as from a sliding window.
>>> strided_windows(np.arange(5), 2)
array([[0, 1],
[1, 2],
[2, 3],
[3, 4]])
>>> strided_windows(np.arange(10), 5)
array([[0, 1, 2, 3, 4],
[1,... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def iter_windows(
texts, window_size, copy=False, ignore_below_size=True, include_doc_num=False
):
"""Produce a generator over the given texts using a sliding window of `window_size`.
The windows produced are views of some subsequence of a text. To use deep copies
instead, pass `copy=True`.
Args:
... | def iter_windows(
texts, window_size, copy=False, ignore_below_size=True, include_doc_num=False
):
"""Produce a generator over the given texts using a sliding window of `window_size`.
The windows produced are views of some subsequence of a text. To use deep copies
instead, pass `copy=True`.
Args:
... | https://github.com/RaRe-Technologies/gensim/issues/1192 | rm -rf _build/*
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.5.3
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 82 source files that are out of date
updating environment: 82 ad... | ImportError |
def load_fasttext_format(cls, model_file, encoding="utf8"):
"""
Load the input-hidden weight matrix from the fast text output files.
Note that due to limitations in the FastText API, you cannot continue training
with a model loaded this way, though you can query for word similarity etc.
`model_fil... | def load_fasttext_format(cls, model_file, encoding="utf8"):
"""
Load the input-hidden weight matrix from the fast text output files.
Note that due to limitations in the FastText API, you cannot continue training
with a model loaded this way, though you can query for word similarity etc.
`model_fil... | https://github.com/RaRe-Technologies/gensim/issues/1236 | Traceback (most recent call last):
File "app.py", line 18, in <module>
model = FastText.load_fasttext_format(os.path.abspath('./wiki.fr'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/wrappers/fasttext.py", line 238, in load_fasttext_format
model.load_binar... | AssertionError |
def load_binary_data(self, encoding="utf8"):
"""Loads data from the output binary file created by FastText training"""
with utils.smart_open(self.file_name, "rb") as f:
self.load_model_params(f)
self.load_dict(f, encoding=encoding)
self.load_vectors(f)
| def load_binary_data(self, model_binary_file, encoding="utf8"):
"""Loads data from the output binary file created by FastText training"""
with utils.smart_open(model_binary_file, "rb") as f:
self.load_model_params(f)
self.load_dict(f, encoding=encoding)
self.load_vectors(f)
| https://github.com/RaRe-Technologies/gensim/issues/1236 | Traceback (most recent call last):
File "app.py", line 18, in <module>
model = FastText.load_fasttext_format(os.path.abspath('./wiki.fr'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/wrappers/fasttext.py", line 238, in load_fasttext_format
model.load_binar... | AssertionError |
def load_dict(self, file_handle, encoding="utf8"):
vocab_size, nwords, _ = self.struct_unpack(file_handle, "@3i")
# Vocab stored by [Dictionary::save](https://github.com/facebookresearch/fastText/blob/master/src/dictionary.cc)
logger.info(
"loading %s words for fastText model from %s", vocab_size, s... | def load_dict(self, file_handle, encoding="utf8"):
vocab_size, nwords, _ = self.struct_unpack(file_handle, "@3i")
# Vocab stored by [Dictionary::save](https://github.com/facebookresearch/fastText/blob/master/src/dictionary.cc)
assert len(self.wv.vocab) == nwords, "mismatch between vocab sizes"
assert le... | https://github.com/RaRe-Technologies/gensim/issues/1236 | Traceback (most recent call last):
File "app.py", line 18, in <module>
model = FastText.load_fasttext_format(os.path.abspath('./wiki.fr'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/wrappers/fasttext.py", line 238, in load_fasttext_format
model.load_binar... | AssertionError |
def load_vectors(self, file_handle):
if self.new_format:
self.struct_unpack(file_handle, "@?") # bool quant_input in fasttext.cc
num_vectors, dim = self.struct_unpack(file_handle, "@2q")
# Vectors stored by [Matrix::save](https://github.com/facebookresearch/fastText/blob/master/src/matrix.cc)
a... | def load_vectors(self, file_handle):
if self.new_format:
self.struct_unpack(file_handle, "@?") # bool quant_input in fasttext.cc
num_vectors, dim = self.struct_unpack(file_handle, "@2q")
# Vectors stored by [Matrix::save](https://github.com/facebookresearch/fastText/blob/master/src/matrix.cc)
a... | https://github.com/RaRe-Technologies/gensim/issues/1236 | Traceback (most recent call last):
File "app.py", line 18, in <module>
model = FastText.load_fasttext_format(os.path.abspath('./wiki.fr'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/wrappers/fasttext.py", line 238, in load_fasttext_format
model.load_binar... | AssertionError |
def init_ngrams(self):
"""
Computes ngrams of all words present in vocabulary and stores vectors for only those ngrams.
Vectors for other ngrams are initialized with a random uniform distribution in FastText. These
vectors are discarded here to save space.
"""
self.wv.ngrams = {}
all_ngrams... | def init_ngrams(self):
"""
Computes ngrams of all words present in vocabulary and stores vectors for only those ngrams.
Vectors for other ngrams are initialized with a random uniform distribution in FastText. These
vectors are discarded here to save space.
"""
self.wv.ngrams = {}
all_ngrams... | https://github.com/RaRe-Technologies/gensim/issues/1236 | Traceback (most recent call last):
File "app.py", line 18, in <module>
model = FastText.load_fasttext_format(os.path.abspath('./wiki.fr'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/wrappers/fasttext.py", line 238, in load_fasttext_format
model.load_binar... | AssertionError |
def inference(self, chunk, collect_sstats=False):
"""
Given a chunk of sparse document vectors, estimate gamma (parameters
controlling the topic weights) for each document in the chunk.
This function does not modify the model (=is read-only aka const). The
whole input chunk of document is assumed t... | def inference(self, chunk, collect_sstats=False):
"""
Given a chunk of sparse document vectors, estimate gamma (parameters
controlling the topic weights) for each document in the chunk.
This function does not modify the model (=is read-only aka const). The
whole input chunk of document is assumed t... | https://github.com/RaRe-Technologies/gensim/issues/911 | In [16]: model = models.LdaModel(corpus, id2word=dictionary, num_topics=2, distributed=True)
2016-10-03 09:21:04,056 : INFO : using symmetric alpha at 0.5
2016-10-03 09:21:04,056 : INFO : using symmetric eta at 0.5
2016-10-03 09:21:04,057 : DEBUG : looking for dispatcher at PYRO:gensim.lda_dispatcher@127.0.0.1:41212
20... | ValueError |
def bound(self, corpus, gamma=None, subsample_ratio=1.0):
"""
Estimate the variational bound of documents from `corpus`:
E_q[log p(corpus)] - E_q[log q(corpus)]
`gamma` are the variational parameters on topic weights for each `corpus`
document (=2d matrix=what comes out of `inference()`).
If no... | def bound(self, corpus, gamma=None, subsample_ratio=1.0):
"""
Estimate the variational bound of documents from `corpus`:
E_q[log p(corpus)] - E_q[log q(corpus)]
`gamma` are the variational parameters on topic weights for each `corpus`
document (=2d matrix=what comes out of `inference()`).
If no... | https://github.com/RaRe-Technologies/gensim/issues/911 | In [16]: model = models.LdaModel(corpus, id2word=dictionary, num_topics=2, distributed=True)
2016-10-03 09:21:04,056 : INFO : using symmetric alpha at 0.5
2016-10-03 09:21:04,056 : INFO : using symmetric eta at 0.5
2016-10-03 09:21:04,057 : DEBUG : looking for dispatcher at PYRO:gensim.lda_dispatcher@127.0.0.1:41212
20... | ValueError |
def _get_combined_keywords(_keywords, split_text):
"""
:param keywords:dict of keywords:scores
:param split_text: list of strings
:return: combined_keywords:list
"""
result = []
_keywords = _keywords.copy()
len_text = len(split_text)
for i in xrange(len_text):
word = _strip_w... | def _get_combined_keywords(_keywords, split_text):
"""
:param keywords:dict of keywords:scores
:param split_text: list of strings
:return: combined_keywords:list
"""
result = []
_keywords = _keywords.copy()
len_text = len(split_text)
for i in xrange(len_text):
word = _strip_w... | https://github.com/RaRe-Technologies/gensim/issues/667 | import gensim.summarization
t = "Victor S. Sage Compare Sage 50c Editions Find accounting software that's right for your business Every product comes with anytime, anywhere online access; automatic updates; access to unlimited support; access to built-in credit card processing and payroll; and advanced reporting. Three... | KeyError |
def get_probability_map(self, subject: Subject) -> torch.Tensor:
label_map_tensor = self.get_probability_map_image(subject).data.float()
if self.label_probabilities_dict is None:
return label_map_tensor > 0
probability_map = self.get_probabilities_from_label_map(
label_map_tensor,
s... | def get_probability_map(self, subject: Subject) -> torch.Tensor:
label_map_tensor = self.get_probability_map_image(subject).data
label_map_tensor = label_map_tensor.float()
if self.label_probabilities_dict is None:
return label_map_tensor > 0
probability_map = self.get_probabilities_from_label_... | https://github.com/fepegar/torchio/issues/458 | {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Test label sampler.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyNrlDa49HLQ/jzNDBnNeFDL",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
... | AssertionError |
def get_probabilities_from_label_map(
label_map: torch.Tensor,
label_probabilities_dict: Dict[int, float],
patch_size: np.ndarray,
) -> torch.Tensor:
"""Create probability map according to label map probabilities."""
patch_size = patch_size.astype(int)
ini_i, ini_j, ini_k = patch_size // 2
s... | def get_probabilities_from_label_map(
label_map: torch.Tensor,
label_probabilities_dict: Dict[int, float],
) -> torch.Tensor:
"""Create probability map according to label map probabilities."""
multichannel = label_map.shape[0] > 1
probability_map = torch.zeros_like(label_map)
label_probs = torch... | https://github.com/fepegar/torchio/issues/458 | {
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Test label sampler.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyNrlDa49HLQ/jzNDBnNeFDL",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
... | AssertionError |
def __init__(
self,
subjects_dataset: SubjectsDataset,
max_length: int,
samples_per_volume: int,
sampler: PatchSampler,
num_workers: int = 0,
shuffle_subjects: bool = True,
shuffle_patches: bool = True,
start_background: bool = True,
verbose: bool = False,
):
self.subjects_da... | def __init__(
self,
subjects_dataset: SubjectsDataset,
max_length: int,
samples_per_volume: int,
sampler: PatchSampler,
num_workers: int = 0,
pin_memory: bool = True,
shuffle_subjects: bool = True,
shuffle_patches: bool = True,
start_background: bool = True,
verbose: bool = F... | https://github.com/fepegar/torchio/issues/431 | AttributeError Traceback (most recent call last)
<ipython-input-28-bf125a1bde76> in <module>
----> 1 batch = next(iter(patches_loader))
~/miniconda3/envs/master/lib/python3.7/site-packages/torch/utils/data/dataloader.py in __next__(self)
343
344 def __next__(self):
--> 345 data =... | AttributeError |
def get_subjects_iterable(self) -> Iterator:
# I need a DataLoader to handle parallelism
# But this loader is always expected to yield single subject samples
self._print(f"\nCreating subjects loader with {self.num_workers} workers")
subjects_loader = DataLoader(
self.subjects_dataset,
nu... | def get_subjects_iterable(self) -> Iterator:
# I need a DataLoader to handle parallelism
# But this loader is always expected to yield single subject samples
self._print(f"\nCreating subjects loader with {self.num_workers} workers")
subjects_loader = DataLoader(
self.subjects_dataset,
nu... | https://github.com/fepegar/torchio/issues/431 | AttributeError Traceback (most recent call last)
<ipython-input-28-bf125a1bde76> in <module>
----> 1 batch = next(iter(patches_loader))
~/miniconda3/envs/master/lib/python3.7/site-packages/torch/utils/data/dataloader.py in __next__(self)
343
344 def __next__(self):
--> 345 data =... | AttributeError |
def __init__(
self,
subjects_dataset: SubjectsDataset,
max_length: int,
samples_per_volume: int,
sampler: PatchSampler,
num_workers: int = 0,
pin_memory: bool = True,
shuffle_subjects: bool = True,
shuffle_patches: bool = True,
start_background: bool = True,
verbose: bool = F... | def __init__(
self,
subjects_dataset: SubjectsDataset,
max_length: int,
samples_per_volume: int,
sampler: PatchSampler,
num_workers: int = 0,
shuffle_subjects: bool = True,
shuffle_patches: bool = True,
verbose: bool = False,
):
self.subjects_dataset = subjects_dataset
self.m... | https://github.com/fepegar/torchio/issues/422 | Traceback (most recent call last):
File "C:\Users\fzj\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\fzj\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle loc... | AttributeError |
def get_next_subject(self) -> Subject:
# A StopIteration exception is expected when the queue is empty
try:
subject = next(self.subjects_iterable)
except StopIteration as exception:
self._print("Queue is empty:", exception)
self.initialize_subjects_iterable()
subject = next(s... | def get_next_subject(self) -> Subject:
# A StopIteration exception is expected when the queue is empty
try:
subject = next(self.subjects_iterable)
except StopIteration as exception:
self._print("Queue is empty:", exception)
self.subjects_iterable = self.get_subjects_iterable()
... | https://github.com/fepegar/torchio/issues/422 | Traceback (most recent call last):
File "C:\Users\fzj\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\fzj\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle loc... | AttributeError |
def get_subjects_iterable(self) -> Iterator:
# I need a DataLoader to handle parallelism
# But this loader is always expected to yield single subject samples
self._print(f"\nCreating subjects loader with {self.num_workers} workers")
subjects_loader = DataLoader(
self.subjects_dataset,
nu... | def get_subjects_iterable(self) -> Iterator:
# I need a DataLoader to handle parallelism
# But this loader is always expected to yield single subject samples
self._print("\nCreating subjects loader with", self.num_workers, "workers")
subjects_loader = DataLoader(
self.subjects_dataset,
n... | https://github.com/fepegar/torchio/issues/422 | Traceback (most recent call last):
File "C:\Users\fzj\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
reduction.dump(process_obj, to_child)
File "C:\Users\fzj\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle loc... | AttributeError |
def add_transform_to_subject_history(self, subject):
from .augmentation import RandomTransform
from . import Compose, OneOf, CropOrPad, EnsureShapeMultiple
from .preprocessing import SequentialLabels
call_others = (
RandomTransform,
Compose,
OneOf,
CropOrPad,
Ens... | def add_transform_to_subject_history(self, subject):
from .augmentation import RandomTransform
from . import Compose, OneOf, CropOrPad, EnsureShapeMultiple
from .preprocessing.label import SequentialLabels
call_others = (
RandomTransform,
Compose,
OneOf,
CropOrPad,
... | https://github.com/fepegar/torchio/issues/419 | assert logits.shape == target.shape #1,4,16,16,16 vs. 1,1,16,16,16
AssertionError
Exception ignored in: <function tqdm.__del__ at 0x7f2fef73a550>
Traceback (most recent call last):
File "/home/nico/.local/lib/python3.8/site-packages/tqdm/std.py", line 1090, in __del__
File "/home/nico/.local/lib/python3.8/site-package... | TypeError |
def train(
cls,
images_paths: Sequence[TypePath],
cutoff: Optional[Tuple[float, float]] = None,
mask_path: Optional[TypePath] = None,
masking_function: Optional[Callable] = None,
output_path: Optional[TypePath] = None,
) -> np.ndarray:
"""Extract average histogram landmarks from images used ... | def train(
cls,
images_paths: Sequence[TypePath],
cutoff: Optional[Tuple[float, float]] = None,
mask_path: Optional[TypePath] = None,
masking_function: Optional[Callable] = None,
output_path: Optional[TypePath] = None,
) -> np.ndarray:
"""Extract average histogram landmarks from images used ... | https://github.com/fepegar/torchio/issues/407 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-5-f7eeffa30bdc> in <module>()
10 ]
11 transform = tio.Compose(transforms)
---> 12 preprocessed = transform(subject)
5 frames
/usr/local/lib/python3.6/di... | RuntimeError |
def mean(tensor: torch.Tensor) -> torch.Tensor:
mask = tensor > tensor.float().mean()
return mask
| def mean(tensor: torch.Tensor) -> torch.Tensor:
mask = tensor > tensor.mean()
return mask
| https://github.com/fepegar/torchio/issues/407 | ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-5-f7eeffa30bdc> in <module>()
10 ]
11 transform = tio.Compose(transforms)
---> 12 preprocessed = transform(subject)
5 frames
/usr/local/lib/python3.6/di... | RuntimeError |
def generate_bias_field(
data: TypeData,
order: int,
coefficients: TypeData,
) -> np.ndarray:
# Create the bias field map using a linear combination of polynomial
# functions and the coefficients previously sampled
shape = np.array(data.shape[1:]) # first axis is channels
half_shape = shape... | def generate_bias_field(
data: TypeData,
order: int,
coefficients: TypeData,
) -> np.ndarray:
# Create the bias field map using a linear combination of polynomial
# functions and the coefficients previously sampled
shape = np.array(data.shape[1:]) # first axis is channels
half_shape = shape... | https://github.com/fepegar/torchio/issues/300 | ---------------------------------------------------------------------------
FloatingPointError Traceback (most recent call last)
<ipython-input-3-fb6790e7e65a> in <module>
----> 1 tio.RandomBiasField()(torch.rand(1, 2, 3, 4))
~/git/torchio/torchio/transforms/augmentation/random_transform.py in _... | FloatingPointError |
def _parse_path(
self, path: Union[TypePath, Sequence[TypePath]]
) -> Optional[Union[Path, List[Path]]]:
if path is None:
return None
if isinstance(path, (str, Path)):
return self._parse_single_path(path)
else:
return [self._parse_single_path(p) for p in path]
| def _parse_path(
self, path: Union[TypePath, Sequence[TypePath]]
) -> Union[Path, List[Path]]:
if path is None:
return None
if isinstance(path, (str, Path)):
return self._parse_single_path(path)
else:
return [self._parse_single_path(p) for p in path]
| https://github.com/fepegar/torchio/issues/383 | ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-bf55f6468bbb> in <module>
----> 1 x.as_pil()
AttributeError: 'numpy.ndarray' object has no attribute 'as_pil'
In [5]: im = tio.ScalarImage(tensor=x)
... | AttributeError |
def as_pil(self) -> ImagePIL:
"""Get the image as an instance of :class:`PIL.Image`.
.. note:: Values will be clamped to 0-255 and cast to uint8.
"""
self.check_is_2d()
tensor = self.data
if len(tensor) == 1:
tensor = torch.cat(3 * [tensor])
if len(tensor) != 3:
raise Runtim... | def as_pil(self) -> ImagePIL:
"""Get the image as an instance of :class:`PIL.Image`."""
self.check_is_2d()
return ImagePIL.open(self.path)
| https://github.com/fepegar/torchio/issues/383 | ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-bf55f6468bbb> in <module>
----> 1 x.as_pil()
AttributeError: 'numpy.ndarray' object has no attribute 'as_pil'
In [5]: im = tio.ScalarImage(tensor=x)
... | AttributeError |
def __init__(self, *args, **kwargs: Dict[str, Any]):
if args:
if len(args) == 1 and isinstance(args[0], dict):
kwargs.update(args[0])
else:
message = "Only one dictionary as positional argument is allowed"
raise ValueError(message)
super().__init__(**kwargs)
... | def __init__(self, *args, **kwargs: Dict[str, Any]):
if args:
if len(args) == 1 and isinstance(args[0], dict):
kwargs.update(args[0])
else:
message = "Only one dictionary as positional argument is allowed"
raise ValueError(message)
super().__init__(**kwargs)
... | https://github.com/fepegar/torchio/issues/265 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-6b7dc2edb3cc> in <module>
----> 1 icbm.spatial_shape
~/git/torchio/torchio/data/subject.py in spatial_shape(self)
95 Consistency of shapes acr... | ValueError |
def __repr__(self):
num_images = len(self.get_images(intensity_only=False))
string = (
f"{self.__class__.__name__}(Keys: {tuple(self.keys())}; images: {num_images})"
)
return string
| def __repr__(self):
string = (
f"{self.__class__.__name__}"
f"(Keys: {tuple(self.keys())}; images: {len(self.images)})"
)
return string
| https://github.com/fepegar/torchio/issues/265 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-6b7dc2edb3cc> in <module>
----> 1 icbm.spatial_shape
~/git/torchio/torchio/data/subject.py in spatial_shape(self)
95 Consistency of shapes acr... | ValueError |
def shape(self):
"""Return shape of first image in subject.
Consistency of shapes across images in the subject is checked first.
"""
self.check_consistent_attribute("shape")
return self.get_first_image().shape
| def shape(self):
"""Return shape of first image in subject.
Consistency of shapes across images in the subject is checked first.
"""
self.check_consistent_shape()
image = self.get_images(intensity_only=False)[0]
return image.shape
| https://github.com/fepegar/torchio/issues/265 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-6b7dc2edb3cc> in <module>
----> 1 icbm.spatial_shape
~/git/torchio/torchio/data/subject.py in spatial_shape(self)
95 Consistency of shapes acr... | ValueError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.