Skip to main content

proposalsampler

Experimental project. For given proposal or equation it generate its implementation (context or sample space $\Omega$ or model (like model for theory in logic therms)) at which this proposal (or equation) is true. For example below, given the sent "abelian(G) \and subgroup(H, G,) => abelian(H)", the program will generate some groups (described with they generators (like in GAP)) for G, H, at which this proposal is true (i.e. $\Omega = {{H_{i}, G_{i}} | where i \leq n}$ where $n$ is count of samples to be generated). Only part of that "arguments" of the proposal can be given ($\Theta$) such that only remained part ($\Psi$) ought to be generated (so $\Omega = \Theta + \Psi$).
The main idea is that such samples can give you better understanding of a proposal itself, especially if such proposal have been taken from some abstract math theory.

sampling proposals:
from tokentranslator.db_models.model_main import TokenizerDB
from tokentranslator.env.clause.clause_main import Clause

model = TokenizerDB()

# switch to clauses db:
model.change_dialect_db("cs")

clause = Clause("abelian(G) \\and subgroup(H, G,) => abelian(H)", db=model)
clause.parser.parse()

# now import and use sampling:
from proposalsampler.sampling.slambda.tests_slambda_main import test_ventries 
from proposalsampler.sampling.slambda import slambda_main as sm

# for this example test_ventries[3] is init data for proposal clause:
test_ventries[3] =
{'G': ('(1,4)(2,3)', '(1,3)(2,4)'),
 "['s', 1, 0, 0]": True,
 "['s', 1, 1, 0]": True,
 'idd': "['s']",
 'successors_count': 0}

# so group G is given but group H is not, and must be found
# during sampling:
sampler = sm.Sampler(clause.net_out, test_ventries[3])

sampler.run()
# if successors found, they entries would look like:

{'G': ('(1,4)(2,3)', '(1,3)(2,4)'),  'H': ('(1,3)(2,4)', '(1,4)(2,3)')", ['s', 1, 1, 0]": True, "['s', 1, 0, 0]": True, 'idd': "['s', 4, 3, 0]", 'successors_count': 0, 'checked_nodes': ["['s']", "['s', 1]", "['s', 1, 1, 0]", "['s', 1, 0, 0]", "['s', 0, 0]"], 'failure_statuses': {}, 'parent_idd': "['s', 4, 3]", "['s']": True, "['s', 0, 0]": True, "['s', 1]": True}

# so group H found and in this case H = Group('(1,3)(2,4)', '(1,4)(2,3)') (= G but proposal is still holding) 
# if no results were generated, try run again.
sampling equations:
>>> e = Equation("f(a*x+b*y)=a*f(x)+b*f(y)")
>>> e.parser.parse()
>>> e.sampling.sympy.sampling_vars()
>>> # or e.sampling.sympy.sampling_subs()

>>> e.sampling.sympy.show_rand()
>>> # or "".join(e.eq_tree.flatten('rand_sympy'))

sin(0.243*0.570+0.369*0.078)=0.243*sin(0.570)+0.369*sin(0.078)

Requirements

pip install -r requirements.txt

Installation and running

pip install proposalsampler

GUI:

There is also a GUI for this project at
https://github.com/tokentranslator-group/tokentranslator-gui

Tests:

see tests/test_list.txt

References:

Sampling:

Probabilistic Models of Cognition: https://probmods.org/

(eng: George Pólya: Mathematics and Plausible Reasoning, Princeton University Press 1954, 2 volumes (Vol. 1: Induction and Analogy in Mathematics, Vol. 2: Patterns of Plausible Inference)

(ru: Джордж Пойа: Математика и правдоподобные рассуждения)

Metadata

Release files for proposalsampler 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proposalsampler 0.0.2
File Size Uploaded Provenance Actions
proposalsampler-0.0.2.tar.gz 30.1 kB Without provenance Details for proposalsampler-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for proposalsampler 0.0.2
File Interpreter ABI Platform Actions
proposalsampler-0.0.2-py3-none-any.whl Python 3 none any Details for proposalsampler-0.0.2-py3-none-any.whl

Total release size: 66.2 kB

Release files / proposalsampler-0.0.2.tar.gz

Download URL proposalsampler-0.0.2.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d121eed50229ef95324f8dbc6008c764b67fdff825339bf6d07adffffefc06a8
BLAKE2b-256 checksum
How to use checksums
a2f41134d3ca80c2cd6992400b81811677699a0d98aca7a344b1c77337bd1e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.48.2 importlib-metadata/3.10.1 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.2

Release files / proposalsampler-0.0.2-py3-none-any.whl

Download URL proposalsampler-0.0.2-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4932e096476b7fecf15c34bf0d1c5794e7f2663ec662385635d3d620333e912
BLAKE2b-256 checksum
How to use checksums
8d68f58f127c719609224ad9d3f0b175d205a5a7347a88e154ecbee0fadb1eb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.48.2 importlib-metadata/3.10.1 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.2

Security for proposalsampler 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page