cattykit 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {cattykit-0.1.0 → cattykit-0.1.2}/PKG-INFO +46 -37
  2. cattykit-0.1.2/README.md +61 -0
  3. cattykit-0.1.2/cattykit/cli.py +28 -0
  4. cattykit-0.1.2/cattykit/experiments.py +602 -0
  5. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/logging/__init__.py +2 -3
  6. cattykit-0.1.0/cattykit/logging/sqlite_logger.py → cattykit-0.1.2/cattykit/logging/cattycam_logger.py +258 -129
  7. cattykit-0.1.2/cattykit/logging/identifiers.py +209 -0
  8. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/logging/model_logger.py +1 -4
  9. cattykit-0.1.2/cattykit/logging/null_logger.py +16 -0
  10. cattykit-0.1.2/cattykit/logging/print_logger.py +36 -0
  11. cattykit-0.1.2/cattykit/models/loading.py +314 -0
  12. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit.egg-info/PKG-INFO +46 -37
  13. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit.egg-info/SOURCES.txt +4 -2
  14. cattykit-0.1.2/cattykit.egg-info/entry_points.txt +2 -0
  15. cattykit-0.1.2/cattykit.egg-info/requires.txt +2 -0
  16. {cattykit-0.1.0 → cattykit-0.1.2}/pyproject.toml +5 -1
  17. cattykit-0.1.0/README.md +0 -53
  18. cattykit-0.1.0/cattykit/experiments.py +0 -99
  19. cattykit-0.1.0/cattykit/logging/event.py +0 -32
  20. cattykit-0.1.0/cattykit/logging/null_logger.py +0 -13
  21. cattykit-0.1.0/cattykit/logging/print_logger.py +0 -24
  22. cattykit-0.1.0/cattykit/models/loading.py +0 -186
  23. cattykit-0.1.0/cattykit.egg-info/requires.txt +0 -1
  24. {cattykit-0.1.0 → cattykit-0.1.2}/LICENSE +0 -0
  25. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/__init__.py +0 -0
  26. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/models/__init__.py +0 -0
  27. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/models/protocol.py +0 -0
  28. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/models/registry.py +0 -0
  29. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit/py.typed +0 -0
  30. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit.egg-info/dependency_links.txt +0 -0
  31. {cattykit-0.1.0 → cattykit-0.1.2}/cattykit.egg-info/top_level.txt +0 -0
  32. {cattykit-0.1.0 → cattykit-0.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cattykit
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A framework for implementing artificial intelligence models using components from the cognitive models of the Fluid Analogies Research Group
5
5
  Author-email: George Alexander Wright <me@georgeaw.com>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -672,58 +672,67 @@ Requires-Python: >=3.12
672
672
  Description-Content-Type: text/markdown
673
673
  License-File: LICENSE
674
674
  Requires-Dist: numpy>=2.4.3
675
+ Requires-Dist: pandas>=3.0.5
675
676
  Dynamic: license-file
676
677
 
677
678
  # Cattykit
678
679
 
679
- Cattykit is a framework for implementing artificial intelligence models based on components from the cognitive models of the Fluid Analogies Research Group including a shared workspace, slipnet, coderack, and codelets.
680
+ Cattykit (in development) is a framework for implementing artificial intelligence models based on components from the cognitive models of the Fluid Analogies Research Group described in Hofstadter _et al_ 1995. Their models are typically built with similar components, including: a shared _workspace_, _slipnet_, _coderack_, and _codelets_.
680
681
 
681
- ## Usage
682
+ Models solve problems represented by graph-like structures in a workspace which is incrementally edited by micro-agents called _codelets_ that propose, build, and destroy new structures. The _slipnet_ keeps track of concepts relevant to the structures present in the workspace and encourages codelets that continue their construction. The _coderack_ is a stochastic scheduler of codelets, which are selected according to urgency. All processes in each model occur with a degree of randomness mediated by its _temperature_ which (unlike the related concept used in language model decoding and simulated annealing) is a measure of workspace quality constantly adjusted by the model itself.
682
683
 
683
- To install and run a model once on a single problem:
684
+ This repository was initially motivated by the lack of a common software framework for FARG models, which were typically developed as isolated projects, often using different programming languages (some of which are now obsolete). This hinders further research into the models and, despite the promise they show as an approach to symbolic AI, acts as a barrier to their adoption in AI more widely.
684
685
 
685
- ```python
686
+ ## Installation
687
+
688
+ Install with pip:
689
+
690
+ ``` bash
691
+ pip install cattykit
692
+ ```
693
+
694
+ ## Quick start
695
+
696
+ Start by installing a model in your environment (this requires pip in the local environment).
697
+
698
+ ``` python
686
699
  import cattykit
687
- from cattykit.logging import PrintLogger
688
700
 
689
- # Install a model package once. The source can also be a model name or HTTPS URL.
690
- cattykit.install_model("./models/copycat")
701
+ # providing a name will install the model from the Cattykit repository
702
+ cattykit.install_model("copycat")
691
703
 
692
704
  print(cattykit.available_models())
693
- # ("copycat",)
705
+ # ('cattykit',)
694
706
 
695
- logger = PrintLogger()
696
- try:
697
- copycat = cattykit.load_model(
698
- "copycat",
699
- config={"seed": 1234},
700
- logger=logger,
701
- )
702
- copycat.solve("abc -> abd ==> ijk -> ?")
703
- finally:
704
- logger.close()
707
+ # providing a uri will install a model from your computer or elsewhere
708
+ cattykit.install_model("path/to/model")
705
709
  ```
706
710
 
707
- To run a suite of problems on a single model:
711
+ The same installation is available from the command line:
708
712
 
709
- ``` python
710
- from cattykit import install_model, run_experiment
713
+ ```bash
714
+ cattykit install copycat --version 0.1.0
715
+ ```
716
+
717
+ Once you have installed a model, you can ask it to solve a problem.
718
+
719
+ ```python
720
+ import cattykit
711
721
 
712
- # Install the model if necessary.
713
- cattykit.install_model("./models/copycat")
722
+ copycat = cattykit.load_model("copycat", config={"seed": 1234})
714
723
 
715
- results_db = run_experiment(
716
- model_name="copycat",
717
- problems=[
718
- "abc -> abd ==> ijk -> ?",
719
- "abc -> abc ==> iijjkk -> ?",
720
- "abc -> abc ==> kji -> ?",
721
- "abc -> abc ==> mrrjjj -> ?",
722
- "abc -> abc ==> xyz -> ?",
723
- ],
724
- iterations=1000
725
- )
726
- print(results_db)
724
+ result = copycat.solve("abc -> abd ==> ijk -> ?")
725
+
726
+ print(result)
727
+ # 'ijl'
727
728
  ```
728
729
 
729
- This will generate a database located at `results_db` containing logs of the runs and summary statistics. These can be explored using the Cattycam package.
730
+ ## References
731
+
732
+ * Hofstadter, D. R., et al. (1995). Fluid Concepts and Creative Analogies: Computer Models of the Fundamental Mechanisms of Thought. Basic Books. [doi:10.5555/218753](https://dl.acm.org/doi/10.5555/218753)
733
+ * Mitchell, M (1993). Analogy-Making as Perception: A Computer Model. The MIT Press. [doi:10.5555/152203](https://dl.acm.org/doi/book/10.5555/152203)
734
+
735
+ ## License
736
+
737
+ Cattykit is licensed under the GNU Affero General Public License v3.0 or later.
738
+ See [LICENSE](LICENSE) for details.
@@ -0,0 +1,61 @@
1
+ # Cattykit
2
+
3
+ Cattykit (in development) is a framework for implementing artificial intelligence models based on components from the cognitive models of the Fluid Analogies Research Group described in Hofstadter _et al_ 1995. Their models are typically built with similar components, including: a shared _workspace_, _slipnet_, _coderack_, and _codelets_.
4
+
5
+ Models solve problems represented by graph-like structures in a workspace which is incrementally edited by micro-agents called _codelets_ that propose, build, and destroy new structures. The _slipnet_ keeps track of concepts relevant to the structures present in the workspace and encourages codelets that continue their construction. The _coderack_ is a stochastic scheduler of codelets, which are selected according to urgency. All processes in each model occur with a degree of randomness mediated by its _temperature_ which (unlike the related concept used in language model decoding and simulated annealing) is a measure of workspace quality constantly adjusted by the model itself.
6
+
7
+ This repository was initially motivated by the lack of a common software framework for FARG models, which were typically developed as isolated projects, often using different programming languages (some of which are now obsolete). This hinders further research into the models and, despite the promise they show as an approach to symbolic AI, acts as a barrier to their adoption in AI more widely.
8
+
9
+ ## Installation
10
+
11
+ Install with pip:
12
+
13
+ ``` bash
14
+ pip install cattykit
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ Start by installing a model in your environment (this requires pip in the local environment).
20
+
21
+ ``` python
22
+ import cattykit
23
+
24
+ # providing a name will install the model from the Cattykit repository
25
+ cattykit.install_model("copycat")
26
+
27
+ print(cattykit.available_models())
28
+ # ('cattykit',)
29
+
30
+ # providing a uri will install a model from your computer or elsewhere
31
+ cattykit.install_model("path/to/model")
32
+ ```
33
+
34
+ The same installation is available from the command line:
35
+
36
+ ```bash
37
+ cattykit install copycat --version 0.1.0
38
+ ```
39
+
40
+ Once you have installed a model, you can ask it to solve a problem.
41
+
42
+ ```python
43
+ import cattykit
44
+
45
+ copycat = cattykit.load_model("copycat", config={"seed": 1234})
46
+
47
+ result = copycat.solve("abc -> abd ==> ijk -> ?")
48
+
49
+ print(result)
50
+ # 'ijl'
51
+ ```
52
+
53
+ ## References
54
+
55
+ * Hofstadter, D. R., et al. (1995). Fluid Concepts and Creative Analogies: Computer Models of the Fundamental Mechanisms of Thought. Basic Books. [doi:10.5555/218753](https://dl.acm.org/doi/10.5555/218753)
56
+ * Mitchell, M (1993). Analogy-Making as Perception: A Computer Model. The MIT Press. [doi:10.5555/152203](https://dl.acm.org/doi/book/10.5555/152203)
57
+
58
+ ## License
59
+
60
+ Cattykit is licensed under the GNU Affero General Public License v3.0 or later.
61
+ See [LICENSE](LICENSE) for details.
@@ -0,0 +1,28 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from collections.abc import Sequence
5
+
6
+ from .models import ModelInstallationError, ModelSourceError, install_model
7
+
8
+
9
+ def main(argv: Sequence[str] | None = None) -> None:
10
+ """Run the CattyKit command-line interface."""
11
+ parser = argparse.ArgumentParser(prog="cattykit")
12
+ commands = parser.add_subparsers(dest="command", required=True)
13
+
14
+ install_parser = commands.add_parser("install", help="Install a model.")
15
+ install_parser.add_argument(
16
+ "source", help="Official model name, HTTPS URL, or local path."
17
+ )
18
+ install_parser.add_argument(
19
+ "--version",
20
+ help="Official model version to install.",
21
+ )
22
+
23
+ args = parser.parse_args(argv)
24
+
25
+ try:
26
+ install_model(args.source, version=args.version)
27
+ except (ModelInstallationError, ModelSourceError) as error:
28
+ parser.error(str(error))