semvec/pypi-packages huggingface dataset:
hmm-tool 0.0.4
A fast Python implementation of HMM.
License: MIT

=================
HMM
=================

A fast Python implementation of HMM

Installation
============
To install:

.. code-block:: bash

    $ pip install hmm-tool

Quickstart
==========

.. code-block:: python

    from hmmtool import HMM
    import numpy as np
    
    ### 3 states, 6 observations:
    ### states values:0/1/2, observations values:0/1/2/3/4/5 
    hmm = HMM(3,6)
	
    #train
    s1 = np.random.randint(6,size = 60)
    s2 = np.random.randint(6,size = 40)
    hmm.add_data([s1,s2])
    hmm.train(maxStep=50,delta=0.001)
	
    #get params
    print(hmm.pi)
    print(hmm.A)
    print(hmm.B)
	
    #predict
    #random data
    s3 = np.random.randint(6,size = 10)
    s4 = np.random.randint(6,size = 10)
	
    #multi inputs:[[o1,o2,o3,...,ot1],[o1,o2,o3,...,ot2]]
    #output: [prob1, prob2]
    print(hmm.estimate_prob([s3,s4]))
    #output: [(prob1, [s1,s2,s3,...,st1]), (prob2, [s1,s2,s3,...,st2])]
    print(hmm.decode([s3,s4]))
pylaprof 0.4.6
A Python sampling profiler for AWS Lambda functions (and not only).
License: MIT
Requires Python: >=3.7,<4.0
Keywords: profiling,flamegraph,lambda,aws,serverless

# pylaprof
pylaprof is a Python library that allows you to profile functions or sections of code.

As a decorator:
```python
from pylaprof import profile

@profile()
def handler(event, context):
  ...
```

As a context manager:
```python
from pylaprof import Profiler

def main():
  ...
  with Profiler():
    # Only code inside this context will be profiled.
    ...
```

It is built around three main abstractions: the *profiler*, the *sampler*, and
the *storer*.

The profiler is the main component of pylaprof, it takes care of taking
snapshots of your program's stack at regular intervals and feeding them
to the *sampler* for processing; at the end of the profiling session, it will
then ask the *sampler* for a report and provide it to the *storer*.

Take a look at the [source](./pylaprof/__init__.py) for more documentation
and some pre-implemented samplers and storers or [here](./examples) for some
usage examples.

## Features
- Accessible: pylaprof's code is thoroughly documented and written to be read and
  understood by other humans.

- Extensible: you can write your own sampler or storer to generate reports in the format
  you like and store them where and how you want.

- Zero external dependencies[^1].

- Close to zero impact on performances (check [benchmark](./benchmark) for
  more details).

- Reliable: pylaprof was built with the context of long-running
  applications or continuously invoked lambda functions in mind.
  It will never break your code or pollute your standard output or error
  with unwanted messages.

- Turn on/off profiling with an environment variable.

- Store the profiling report only if execution takes longer than a threshold.

[^1]: boto3 is optional and required only if you want to use the S3 storer.

### pylaprof-merge
`pylaprof-merge` is a CLI tool to merge multiple stackcollapse reports into a
single one. This might come in handy if you want to get an aggregated overview
of a function or piece of code that is executed frequently for short periods.
It is installed automatically if you get pylaprof with pip.


## Installation
```
pip install pylaprof
```

Or just copy-paste the pylaprof directory where you need it.


## Credits
- This library is heavily inspired to [pprofile](
  https://github.com/vpelletier/pprofile): thanks to its authors for writing such
  accessible and well-documented code.
- Thanks to @jvns for writing and distributing some of her *wizard zines* for free:
  that's what got me into the rabbit hole of profiling in the first place.