Skip to main content

kstpy

General package informaation

Remarks

  • Please note that is an early stage package.
  • Especially the functions in the kstpy.basics module may be rather inefficient.

Installation from PyPI

$ pip install kstpy

License

kstpy was created by Cord Hockemeyer. It is licensed under the terms of the GNU General Public License v3.0 license.

Credits

  • The graphicx module is a copy of Simon Hegele's hasseNetworkx module from GitHub. I opted for this way because I did not find any comparable Python package.
  • kstpy was created with cookiecutter and the py-pkgs-cookiecutter template.

Modules and functions overview

Gwenerally, knowledge spaces and structures are stored as sets of kstFrozensets (see below).

Module kstpy.helpers

This module provides several small functions and some classes to be used by the other modules.

A core element is the kstFrozenset class, a derivative of the builtin frozenset class. The diference is just the way of printing: the 'frozenset' is omitted and kstFroszensets are printed like normal sets.

The functions of this module are

  • itemname: Produce an itemname corresponding to a number. We start with single lowercase letter ('a' to 'z'), then two-letter string ('aa' to 'zz') and finally three-letter strings ('aaa' to 'zzz'). This gives a some 18,000 different item names---and that should suffice.
  • nitemnames: Produce a list of countitem names.
  • domain: Determine the domain of a knowledge structure or data set, i.e. the union of all kstF>rozensets in a given set or list.
  • srdomain: Determine the domain of a surmise relation, i.e. all elements in a set of 2-tuples.
  • reduceSR: DSelete transitivities from a relation.
  • powerset: Produce the power set for a given domain.
  • vector2kstFrozenset: The kstFrozenset for a set specified as binary vector. This is used for reading structure files.
  • kstFrozenset2vecrtor: A Binary vector corresponding to a kstFrozenset. This is used for writing structure files.

Module kstpy.basics

The basicsmodule focuses on functions working with the different represenatations of knowledge spaces.

  • constr: Closing a knowledge structure und union, i.e. computing the corresponding knowledge space.
  • basis: The counterpart computing the basis for a knowledge space (or structure).
  • surmiserelation: Compiutes the surmise relation for a knowledge structure. (Surmise) relations are stored as sets of 2-tuples.
  • sr2basis: Determine the basis of the knowledge space corresponding to a giben surmise relation.
  • neighbourhood: The neighbourhood is the set of neighbouring knowledge states within a knowledge structure.
  • fringe: The fringe is the set of items by which a knowledge ste differs from its neighbours. We distinguish the inner fringe, i.e. the set of items distinguishing a state from its smaller neighbours, and the outer fringe, i.e. the set of items distinguishing a state from its larger neighbours.
  • equivalence: Determine the equivalence classes of items for a knowledge structure, i.e. the groups of items which are exactly in the same knowledge states.
  • gradations and learningpaths: A gradation is a path from a smaller state s1 to a larger state s2 where each step means adding exactly one item. Learning paths are gradations from the empty set to the full set.
  • trace: The trace of a knowledge structure/space is its reduction to a subset of items.

Module kstpy.graphics

Most parts of this module were taken from teh internet (see Credits above). The following functions are meant for the end user:

  • hasse draws a Hasse diagram for a knowledge structure/space.
  • sr_hasse does the same for a surmise relation.

Module kstpy.io

Functions for reading and writing KST files.

The classical format starts with a line cotaining the number of items and a line with the number of states/patterns. Then there follows a binary matrix describing the structure/data with columns for items and rows for states/patterns. This matrix does not contain any spaces.

The reading functions also accept a leading line starting with a hash sign ('#') thus allowing for the SRBT file formats.

  • readPatterns: Read a data file. Data are internally stored as lists of kstFrozensets.
  • readstructure: Read a knowledge structure or basis (more generally, any family of sets)
  • writekst: Write a structure of data file.

Module kstpy.simulation

This module contains functions for BLIM--based (Basic Local Independence Model) simulations.

  • simpleSimulation: Simulate with a beta and an eta value equal for all items
  • simulation: Simulate with beta and eta values different for each item.

Module kstpy.validation

  • distvec: Compute a list of distances between the response patterns and the knowledge structure
  • difreq: Determine the frequency distribution within the distance vector
  • di: Compute the Discrepancy Index between data set and knowledge structure.
  • da: Compute the Distance Agreement Coefficient between data set and knowledge structure.

Usage

from kstpy.data import xpl_base
from kstpy.basics import constr

print(constr(xpl_base))

For further information, please have a look at the API reference.

print(constr(xpl_base))

Metadata

Release files for kstpy 1.0.0

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

Source distribution (sdist)

Source distribution for kstpy 1.0.0
File Size Uploaded Provenance Actions
kstpy-1.0.0.tar.gz 25.1 kB Without provenance Details for kstpy-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 51.5 kB

Release files / kstpy-1.0.0.tar.gz

Download URL kstpy-1.0.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
baa8415543148a6d171b69183f07667532c88af647f74fa35db781f74cee5653
BLAKE2b-256 checksum
How to use checksums
0edc6007122536f7ede3326c9c0c57dcf9774a8c447712545f07a1a49b1a564d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.8 Linux/4.18.0-553.47.1.el8_10.x86_64

Release files / kstpy-1.0.0-py3-none-any.whl

Download URL kstpy-1.0.0-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a871c2ce9a034b2abb4a6a4b882b65fd904a2b372e7c11063b5230e4110830aa
BLAKE2b-256 checksum
How to use checksums
bdaf3e31b340492503c0e371572ccf460cebc320d62868f8a1a885e75ec65712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.8 Linux/4.18.0-553.47.1.el8_10.x86_64

Security for kstpy 1.0.0

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