{"id":16223786,"url":"https://github.com/simleek/pnums","last_synced_at":"2025-03-19T12:30:36.115Z","repository":{"id":62564770,"uuid":"207464832","full_name":"SimLeek/pnums","owner":"SimLeek","description":"Predictive Neural Coordinates in PyTorch","archived":false,"fork":false,"pushed_at":"2022-01-17T19:49:51.000Z","size":49,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T08:39:26.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SimLeek.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-10T04:24:14.000Z","updated_at":"2022-01-12T16:46:18.000Z","dependencies_parsed_at":"2022-11-03T16:46:43.680Z","dependency_job_id":null,"html_url":"https://github.com/SimLeek/pnums","commit_stats":null,"previous_names":["simleek/coordencode"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fpnums","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fpnums/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fpnums/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimLeek%2Fpnums/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimLeek","download_url":"https://codeload.github.com/SimLeek/pnums/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243989576,"owners_count":20379648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T12:20:10.760Z","updated_at":"2025-03-19T12:30:35.859Z","avatar_url":"https://github.com/SimLeek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"PNums\n=======\nProbabilistic numbers.\n\nThis library simulates the coordinate system in the mammalian entorhinal cortex, which is used as part of a larger\nsystem for recognizing and mapping features to locations, or SLAM (Simultaneous Localization and Mapping).\n\nThe pnums here support coordinates in n-dimensions as well as mathematical operations on those numbers, which should\nallow for sensor fusion. Some research suggests this system is repeated in the neocortex. [Hawkins2019]_\n\nExample\n-------\n\n.. code-block:: python\n\n    a = PInt(10, 11, bits=8, confidence=0.8)\n    b = PInt(6, 13, bits=8, confidence=0.9)\n    c = a + b\n\n    assert c.asfloat() == (16, 24)\n\n    np.testing.assert_array_almost_equal(\n        [\n            [\n                [\n                    0.15804069,\n                    0.16226967,\n                    0.20636845,\n                    0.6811368,\n                    0.31998023,\n                    0.21316226,\n                    0.16209187,\n                    0.1548889,\n                ],\n                [\n                    0.16720827,\n                    0.17999499,\n                    0.23011242,\n                    0.2770214,\n                    0.30978364,\n                    0.30276603,\n                    0.15728992,\n                    0.1548889,\n                ],\n            ],\n            [\n                [\n                    0.16867277,\n                    0.18810391,\n                    0.27501187,\n                    0.5256308,\n                    0.6511188,\n                    0.44122377,\n                    0.35417086,\n                    0.1548889,\n                ],\n                [\n                    1.2060783,\n                    1.1696315,\n                    0.9885073,\n                    0.21621099,\n                    0.41911733,\n                    0.742848,\n                    1.0264474,\n                    1.2353333,\n                ],\n            ],\n        ],\n        c.tensor,\n    )\n\n    np.testing.assert_array_almost_equal(\n        [\n            [\n                [\n                    0.04648256,\n                    0.04772637,\n                    0.0606966,\n                    0.20033436,\n                    0.09411184,\n                    0.06269478,\n                    0.04767408,\n                    0.04555556,\n                ],\n                [\n                    0.0491789,\n                    0.0529397,\n                    0.06768012,\n                    0.08147689,\n                    0.09111284,\n                    0.08904883,\n                    0.04626174,\n                    0.04555556,\n                ],\n            ],\n            [\n                [\n                    0.04960964,\n                    0.05532468,\n                    0.08088584,\n                    0.1545973,\n                    0.19150554,\n                    0.1297717,\n                    0.10416789,\n                    0.04555556,\n                ],\n                [\n                    0.3547289,\n                    0.34400925,\n                    0.29073742,\n                    0.06359147,\n                    0.12326981,\n                    0.2184847,\n                    0.3018963,\n                    0.3633333,\n                ],\n            ],\n        ],\n        c.normalize(0.5).tensor,\n    )\n\n    q = c.quantize()\n    np.testing.assert_array_almost_equal(\n        [\n            [\n                [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0],\n                [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n            ],\n            [\n                [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],\n                [1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0],\n            ],\n        ],\n        q.tensor,\n    )\n\nInstallation\n------------\n\n:code:`pip install pnums`\n\nCitations\n---------\n.. [Hawkins2019]\n    Hawkins, J., Lewis, M., Klukas, M., Purdy, S., \u0026amp; Ahmad, S. (2019). A framework for intelligence and cortical function based on grid cells in the neocortex. Frontiers in Neural Circuits, 12. https://doi.org/10.3389/fncir.2018.00121\n\nTo Do\n-----\n* Needs to be tested for various use cases vs using a floating point number and an extra linear layer.\n\n  * Known probabilities in training data\n  * Combining outputs from multiple neural networks\n  * Use as coordinates for transformer neural networks\n  * Automatically gaining probability information from training data with no probability information\n\n* More mathematical operations need to be defined\n\n  * Currently only addition, subtraction, and a few logical operations are defined, but the rest of the operations can be defined out of the current logical operations.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimleek%2Fpnums","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimleek%2Fpnums","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimleek%2Fpnums/lists"}