semvec/pypi-packages huggingface dataset:
lh 0.0.5
logging functions
License: apache-2.0

# lh
logging functions

To install:	```pip install lh```

## Overview

The `lh` package provides a set of utilities for logging and progress tracking in Python applications. It includes functions to print progress messages with timestamps, manage logging configurations, and output iterable items one per line.

## Features

- **Progress Printing**: Functions to display progress messages with the current time.
- **Logging Setup**: Simplified setup for logging with custom configurations.
- **Iterable Printing**: Utility to print each item of an iterable on a new line.

## Usage

### Progress Printing

#### `print_progress`

Prints a progress message with an optional timestamp.

```python
from lh import print_progress

print_progress("Processing data...", refresh=True)
```

#### `printProgress`

Prints a formatted progress message with an optional timestamp, supporting sprintf-style string formatting.

```python
from lh import printProgress

printProgress("Step {0} of {1}", args=[1, 10], refresh=True)
```

### Logging Setup

#### `get_a_logger`

Creates and returns a logger with a specified configuration. Defaults to DEBUG level and outputs to 'default_log.log'.

```python
from lh import get_a_logger

logger = get_a_logger(filename='app.log', level='INFO')
logger.info("Application started")
```

### Iterable Printing

#### `print_iter_one_per_line`

Prints each element of an iterable on a new line.

```python
from lh import print_iter_one_per_line

print_iter_one_per_line(['apple', 'banana', 'cherry'])
```

## Function Documentation

### `hms_message`

Generates a timestamped message.

- **Parameters**:
  - `msg` (str): The message to timestamp.
- **Returns**:
  - str: A string with the current day and time followed by the message.

### `print_progress`

Prints a progress message, optionally refreshing the line and displaying the current time.

- **Parameters**:
  - `msg` (str): The message to print.
  - `refresh` (bool, optional): Whether to refresh the line. Defaults to None.
  - `display_time` (bool, optional): Whether to display the current time. Defaults to True.

### `printProgress`

Formatted version of `print_progress` supporting variable arguments.

- **Parameters**:
  - `message` (str): The message template.
  - `args` (list, optional): List of arguments to format the message.
  - `refresh` (bool, optional): Whether to refresh the line.
  - `refresh_suffix` (str, optional): Suffix to append after the message when refreshing.

### `print_iter_one_per_line`

Prints each item of an iterable on a new line.

- **Parameters**:
  - `it` (iterable): The iterable whose items are to be printed.

### `get_a_logger`

Sets up and returns a logger with specified configurations.

- **Parameters**:
  - `**kwargs`: Arbitrary keyword arguments for logger configuration.
- **Returns**:
  - logging.Logger: Configured logger object.

This package streamlines logging and progress tracking in Python, making it easier to manage output and diagnostics in your applications.
og 0.0.5
Frequent itemsets -- fp-tree naeseth
License: apache-2.0

# og
Frequent itemsets -- fp-tree naeseth

To install:	```pip install og```

## Overview
The `og` package provides a Python implementation of the FP-growth algorithm for finding frequent itemsets in transactional data sets. This method is efficient and scalable, making it suitable for large data sets where traditional apriori-based methods may be too slow. It constructs a compressed representation of the dataset, the FP-tree, which is then used to extract frequent itemsets directly.

## Features
- Efficiently find frequent itemsets without candidate generation.
- Return itemsets along with their support counts if desired.
- Handle any iterable of iterables as input for transactions.

## Usage

### Basic Usage
To use the `find_frequent_itemsets` function, you need to provide a list of transactions and a minimum support threshold. Here is a simple example:

```python
from og import find_frequent_itemsets

# Sample transactions
transactions = [
    ['milk', 'bread', 'butter'],
    ['beer', 'bread'],
    ['milk', 'bread'],
    ['butter', 'beer'],
    ['bread', 'butter'],
    ['milk', 'butter'],
    ['milk', 'bread', 'butter', 'beer']
]

# Finding itemsets with a minimum support of 3
result = list(find_frequent_itemsets(transactions, minimum_support=3))
print(result)
```

### Including Support Counts
If you want to include the support counts of the itemsets in the results, set `include_support=True`:

```python
# Finding itemsets with support counts
result_with_support = list(find_frequent_itemsets(transactions, minimum_support=3, include_support=True))
print(result_with_support)
```

## Classes and Functions

### `FPTree`
This class represents an FP-tree structure that can store transaction items. It supports adding transactions, and provides methods to access the nodes and items.

### `FPNode`
Represents a node in an FP-tree. Each node contains a count of occurrences, links to child nodes, and a reference to its parent node.

### `find_frequent_itemsets`
A function to find frequent itemsets in the given transactions using the FP-growth algorithm. It can optionally return the support count for each itemset.

#### Parameters:
- **transactions**: An iterable of iterable items. Each inner iterable represents a transaction.
- **minimum_support**: An integer specifying the minimum number of occurrences for an itemset to be considered frequent.
- **include_support**: A boolean flag that, when set to True, includes the support count of each itemset in the results.

## Development and Contributions
Contributions to the `og` package are welcome. You can contribute in several ways including providing feedback, reporting bugs, and submitting feature requests or pull requests.

For more detailed contribution guidelines, please refer to the official repository documentation.

## License
This project is licensed under the MIT License - see the LICENSE file for details.
ou 0.0.5
Window pairs of sequences
License: apache-2.0

# ou
Window pairs of sequences

To install:	```pip install ou```

## Overview
The `ou` package provides tools for analyzing sequences by creating and manipulating pairs of sliding windows over data. This can be particularly useful in time series analysis, event sequence analysis, or any scenario where relationships between different segments of a dataset are of interest.

## Main Features
- **Window Pair Iterators**: Generate pairs of indices representing windows over a data range, which can be used to extract and analyze overlapping or consecutive segments of data.
- **Event Window Analysis**: Functions to handle timestamped event data, allowing analysis of events occurring within specified past and future windows relative to a present moment.
- **Feature Extraction**: Utilities to extract features from data within generated windows, which can be used for further statistical analysis or machine learning.
- **Aggregation and Counting**: Tools to aggregate and count occurrences across pairs of windows, useful for frequency analysis in categorical data.

## Usage Examples

### Window Pair Iteration
Generate sliding window pairs from a data sequence:
```python
from ou import wp_iter_with_sliding_discrete_step
data_range = 10
x_range = 2
y_range = 3
offset = 1

for window_pair in wp_iter_with_sliding_discrete_step(data_range, x_range, y_range, offset):
    print(window_pair)
```

### Event Window Analysis
Analyze events with past and future context:
```python
from ou import past_present_future_idx_and_duration_iter
timestamp_seq = [0, 5, 10, 15, 20]
past_range = 5
future_range = 5

for ppf_idx, duration, present_timestamp in past_present_future_idx_and_duration_iter(timestamp_seq, past_range, future_range):
    print(f"Past-Present-Future Index: {ppf_idx}, Duration: {duration}, Present Timestamp: {present_timestamp}")
```

### Feature Extraction from Data Windows
Extract features using predefined or custom functions applied to data windows:
```python
import pandas as pd
from ou import FeaturePairFactory, extract_series

# Sample data
data = pd.DataFrame({'timestamp': range(0, 100, 10), 'value': range(10)})

# Define feature extraction functions
def sum_values(df):
    return df['value'].sum()

# Setup feature pair factory
factory = FeaturePairFactory(past_feat_func=sum_values, past_range=30)

# Generate feature pairs
for feature_pair in factory.feature_pair_and_duration_iter(data):
    print(feature_pair)
```

### Aggregation of Windowed Data
Aggregate counts across pairs of windows:
```python
from ou import extract_series, agg_counts

# Using the same 'data' DataFrame from the previous example
window_iterator = wp_iter_with_sliding_discrete_step(data_range=len(data))
pairs_of_series = extract_series(data, window_iterator)

# Aggregate counts
aggregated_counts = agg_counts(pairs_of_series)
print(aggregated_counts)
```

## Documentation
Each function and class in the `ou` package is documented with docstrings, providing detailed usage instructions and examples. Users are encouraged to refer to these docstrings for more specific information on function parameters and expected data formats.