Metadata-Version: 2.4
Name: metalearning_class
Version: 0.1.9
Summary: A library for meta-learning in Python with neural networks and transformers.
Author: Gabriel Alves Castro, João Bizzo Brandt, Lucca Huguet
Maintainer: Panaceia
License: # Sofon Client Library & Vendor License (SCLVL)
        
        Version 1.3 — © 2026 Panaceia
        
        This License governs the use of the Sofon Client Library ("the Library"), its Extensions, and any accompanying components.\
        By using the Library, the Licensee agrees to all provisions below.
        
        ---
        
        # 1. Ownership and Rights
        
        1.1. The Library, its source code, architecture, API design, protocol specifications, and all related intellectual property are the exclusive property of Panaceia.
        
        1.2. Panaceia retains **unrestricted rights** to:
        
        - use, modify, extend, sublicense, commercialize, and integrate the Library,
        - use any Extensions or Modifications made by third parties for internal or commercial purposes,\
          regardless of whether these Extensions are publicly released.
        
        1.3. This License does **not** transfer ownership of the Library to the Licensee.
        
        ---
        
        # 2. Definitions
        
        - **Library**: The Sofon Python client library and all its components.
        - **Extension**: Any modification, adaptation, plugin, integration, or derived code that interacts with or extends the Library.
        - **Backend**: The Sofon Meta-Learning Platform, including APIs, servers, data pipelines, cloud infrastructure, and metadata systems.
        - **Metadata**: Architectural information, hyperparameters, performance logs, problem descriptions, challenge submissions, or other data generated by the use of the Backend and library.
        
        ---
        
        # 3. Permitted Use
        
        3.1. The Licensee may:
        
        - use the Library locally for research or commercial purposes,
        - train models locally using the Library,
        - commercialize models trained locally,
        - integrate the Library into internal workflows, products, or research pipelines.
        - Create Extensions and encapsulate new machine learning models, provided that such Extensions and models comply with this License, the Sofon Terms & Conditions, and any applicable challenge rules, and do not operate, implement, replicate, or substitute any Sofon Backend functionality outside Panaceia’s platform or enable any competing meta-learning system.
        
        3.2. Local use is permitted **as long as it does not use, imitate, or replicate the Backend** outside Panaceia’s platform.
        3.3. For the avoidance of doubt, permitted uses under this Section 3 do not override or limit the restrictions set forth in Sections 4, 6, and 8.
        
        ---
        
        # 4. Restrictions on Commercial Use
        
        4.1. The Licensee **may not** use the Library, Extensions, or any derived works to:
        
        - build a meta-learning platform, marketplace, automated model selector, AutoML system, or\
          competitive product similar to Panaceia’s Sofon platform,
        - enable, support, integrate with, or provide services to any other meta-learning framework, backend, or platform,
        - create interoperable or competing APIs or systems.
        
        4.2. The Library **may not be sold, licensed, or offered as a meta-learning solution**.
        
        ---
        
        # 5. Extension and Derivative Work Rules
        
        5.1. Any Extension or Modification of the Library:
        
        - **must retain this License**,
        - may remain private and does **not** need to be published publicly,
        - may only be distributed under this same License.
        
        5.2. Extensions may depend on third-party open-source components **only if** their licenses are compatible with this License.
        
        5.3. An Extension must not include or depend on software that would force the Library to be distributed under a different license.
        
        ---
        
        # 6. API and Architecture Protection
        
        6.1. The Licensee shall **not**:
        
        - copy, replicate, reimplement, or imitate the Library’s API design, structure, or behavior\
          for creating competing, interoperable, or substitutive products,
        - reverse-engineer the Library for competitive use,
        - extract algorithms, heuristics, or meta-learning logic for use in another product.
        
        6.2. “Inspiration” clauses are clarified:\
        General conceptual inspiration is unavoidable, but **no code, design, structure, protocol, or functional equivalence** may be reproduced for competitive use.
        
        ---
        
        # 7. Backend Usage and Metadata Rights
        
        7.1. The Backend is not licensed under this License.\
        Use of the Backend requires acceptance of Sofon’s Terms & Conditions.
        
        7.2. **Models trained locally** belong exclusively to the Licensee.
        
        7.3. Models or Metadata submitted to the Backend:
        
        - may be used, analyzed, stored, or commercialized by Panaceia,
        - may be offered on the Sofon marketplace or integrated into the Meta-Learning system according to the challenges rules or terms and conditions.
        - shall be governed byfollow the challenges rules or terms and conditions of Sofon platform.
        
        7.4. Any model whose **weights, metadata, or architecture** that are submitted to Panaceia\
        must follow the challenges rules or terms and conditions of Sofon platform upon submission or upload.
        
        ---
        
        # 8. Prohibition of Third-Party Meta-Learning Systems
        
        8.1. The Licensee may not integrate the Library with:
        
        - third-party meta-learning servers,
        - AutoML frameworks with backend components,
        - other model selection or model marketplace systems.
        - for the purpose of enabling or operating a third-party meta-learning backend.
        
        8.2. The Library may be used with other ML libraries **only locally**, and only if not used to feed or integrate another meta-learning backend.
        
        ---
        
        # 9. Termination
        
        Violation of any clause automatically terminates this License.\
        Upon termination, the Licensee must stop using the Library and destroy all copies.
        
        ---
        
        # 10. No Warranty
        
        The Library is provided "AS IS".\
        Panaceia disclaims all warranties.
        
        ---
        
        # 11. Good Faith and Purpose of License
        
        This License is granted for the specific purpose of enabling the use of the Library as a client-side tool within Panaceia’s ecosystem, fostering research, experimentation, and local commercial use, while preserving the integrity and exclusivity of the Sofon Backend and Meta-Learning Platform.
        
        The Licensee agrees to exercise all rights granted herein in accordance with the principles of good faith, loyalty, and fair dealing.
        
        Any use of the Library, Extensions, or derived works that, while formally compliant with the literal terms of this License, circumvents its essential purpose, enables competitive substitution, or exploits interpretative gaps in an opportunistic or abusive manner shall constitute a material breach of this License.
        
        ---
        
        # 12. Governing Law
        
        This License is governed by the laws of the Federative Republic of Brazil, with exclusive venue in Brasília, DF.
        
        
        ---
        
        **© 2026 Panaceia – All Rights Reserved**
Project-URL: Homepage, https://github.com/panaceia/metalearning
Project-URL: Documentation, https://github.com/panaceia/metalearning#readme
Project-URL: Bug_Tracker, https://github.com/panaceia/metalearning/issues
Project-URL: Changelog, https://github.com/panaceia/metalearning/releases
Keywords: machine learning,metalearning,meta-learning,neural networks,transformers
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: tensorflow>=2.8.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: dill==0.4.0
Requires-Dist: matplotlib==3.10.5
Requires-Dist: si-prefix==1.3.3
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=3.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"
Requires-Dist: mypy>=0.900; extra == "dev"
Requires-Dist: ipython>=8.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=5.0; extra == "docs"
Requires-Dist: furo>=2022.6.0; extra == "docs"
Requires-Dist: sphinx-copybutton>=0.5.0; extra == "docs"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-mock>=3.0; extra == "test"
Requires-Dist: pytest-xdist>=3.0; extra == "test"
Dynamic: license-file

# Metalearning Library (`metalearning_class`)

A Python client library for meta-learning, designed to interface with the Panaceia/Sofon Meta-Learning Platform. 

This library focuses on developing advanced machine learning techniques that "learn how to learn." It provides a robust, extensible framework for building meta-learning models leveraging neural networks and transformer architectures to solve complex regression and classification challenges efficiently.

## 🚀 Features

*   **Meta-Learning Development**: Facilitates the creation and rapid experimentation of meta-learning algorithms.
*   **Key Components**: Provides implementations for essential meta-learning components such as meta-learners and task encoders.
*   **Flexible Architectures**: Supports diverse applications, from standard deep neural networks to custom Transformers and Robust RNNs.
*   **Platform Integration**: Automatically synchronizes local model architectures, weights, and telemetry with the Sofon backend.

## 📦 Installation

To install the library, run the following command (requires Python 3.8+):

```bash
pip install metalearning_class
```

## 🛠️ Quick Start

Below is a basic workflow demonstrating how to initialize the client, authenticate, load data, and start working on a Sofon challenge.

> [!TIP]
> **Security Best Practice**: Never hardcode your credentials. Use a `.env` file and `python-dotenv` to securely load your Sofon username and password.

```python
import os
import metalearning_class as mtl
from dotenv import load_dotenv

# Load environment variables (.env)
load_dotenv()

# 1. Initialize the metalearning client
# Set gpu=True if you have a CUDA-compatible GPU configured
ml = mtl.Metalearning(gpu=False)

# 2. Login securely with your Sofon account
ml.login(os.getenv("SOFON_USERNAME"), os.getenv("SOFON_PASSWORD"))

# 3. Subscribe to a challenge and download the dataset
train_data = ml.subscribe_and_get_task("challenge_taskname")

# 4. Build and train your topology
# (Implementation depends on the specific challenge and architecture)
# ...
```

## ⚠️ Important Considerations

*   **Authentication Dependency**: The library requires active communication with the Sofon backend. Most data retrieval and submission workflows will fail if you skip the `ml.login()` step.
*   **Data Types**: Always cast your Pandas DataFrame features to `numpy.float32` arrays before passing them to the training or inference pipelines to ensure compatibility with underlying TensorFlow operations.
*   **Mandatory Tracking**: Ensure required tracking methods (like `subscribe_and_get_task` and setting topology names) are executed before attempting to define models or run predictions to avoid missing metadata errors.

## 📝 Recent Updates

**v0.1.9 (2026-06-04)**
* Added native support for base64-encoded and gzip-compressed backend training data payloads. Directly converts to Pandas DataFrame to optimize performance and reduce memory consumption.

**v0.1.8 (2026-05-19)**
* Standardized `load_test_input` preprocessing and input formatting with the training data pipeline.

*(For a full history of changes, see the `CHANGELOG.md` file.)*

## 🤝 Contributing

We will be transitioning to open-source soon and look forward to welcoming contributions to the Metalearning Library!

---

**© 2026 Panaceia – All Rights Reserved**
