semvec/pypi-packages huggingface dataset:
milwrap 0.2.0
milwrap - multiple instane meta-learner that can use any supervised-learning algorithms.
License: MIT
Requires Python: >=3.10
Keywords: machine learning

# milwrap

[![Python Tests](https://github.com/inoueakimitsu/milwrap/actions/workflows/python-tests.yml/badge.svg)](https://github.com/inoueakimitsu/milwrap/actions/workflows/python-tests.yml)
<a href="https://github.com/inoueakimitsu/milwrap/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/inoueakimitsu/milwrap"></a>
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/inoueakimitsu/milwrap/blob/master/introduction.ipynb)

Python package for multiple instance learning (MIL).
This wraps single instance learning algorithms so that they can be fitted to data for MIL.

## Features

- support count-based multiple instance assumptions (see [wikipedia](https://en.wikipedia.org/wiki/Multiple_instance_learning#:~:text=Presence-%2C%20threshold-%2C%20and%20count-based%20assumptions%5Bedit%5D))
- support multi-class setting
- support scikit-learn algorithms (such as `RandomForestClassifier`, `SVC`, `LogisticRegression`)

## Installation

```bash
pip install milwrap
```

## Usage

For more information, see [Use scikit-learn models in multiple instance learning based on the count-based assumption](https://github.com/inoueakimitsu/milwrap/blob/main/intro-en.md).

```python
# Prepare single-instance supervised-learning algorithm
# Note: only supports models with predict_proba() method.
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression()

# Wrap it with MilCountBasedMultiClassLearner
from milwrap import MilCountBasedMultiClassLearner
mil_learner = MilCountBasedMultiClassLearner(clf)

# Prepare follwing dataset
#
# - bags ... list of np.ndarray
#            (num_instance_in_the_bag * num_features)
# - lower_threshold ... np.ndarray (num_bags * num_classes)
# - upper_threshold ... np.ndarray (num_bags * num_classes)
#
# bags[i_bag] contains not less than lower_thrshold[i_bag, i_class]
# i_class instances.

# run multiple instance learning
clf_mil, y_mil = learner.fit(
    bags,
    lower_threshold,
    upper_threshold,
    n_classes,
    max_iter=10)

# after multiple instance learning,
# you can predict instance class
clf_mil.predict([instance_feature])
```

See `tests/test_countbased.py` for an example of a fully working test data generation process.

## License

milwrap is available under the MIT License.
hype 1.1
Yet another resource mapper.
License: MIT

====
hype
====

A Python library for flexible resource mapping and API development. Hype provides a powerful way to define, traverse, and transform resources with support for multiple output formats including JSON, WAC-JSON, and URL-encoded forms.

Features
--------

* Resource mapping and traversal with cycle detection
* Multiple output format support (JSON, WAC-JSON, API-JSON, URL-encoded)
* Field-based resource definition with type validation
* Automatic URL generation and linking between resources
* Pagination support with cursor-based navigation
* Flexible resource transformation pipeline
* Thread-safe global context management

Installation
------------

.. code-block:: bash

    pip install hype

Requirements
------------

* Python 2.7

Usage
-----

Here's a quick example of defining and transforming a resource:

.. code-block:: python

    from hype import Resource, fields
    
    class User(Resource):
        name = fields.String()
        email = fields.String()
        profile = fields.Link(endpoint='profile.show')
    
    # Transform to JSON
    from hype.mime import application_json
    
    def url_for(ref):
        return f'/api/{ref.name}/{ref.params["id"]}'
    
    user = User(name='John Doe', email='john@example.com')
    json_output = application_json.serialize(user, url_for=url_for)

Documentation
-------------

Full documentation is available at https://github.com/balanced/hype/

Contributing
------------

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

This project is licensed under the ISC License - see the LICENSE file for details.

Author
------

Balanced Developers (dev@balancedpayments.com)
@bninja
@mahmoudimus
@mjallday