Skip to main content

Optimization of hyperparameters for Machine Learning (AI)

Project description

Introduction to Opptimizer

Opptimizer is an optimization framework designed for AI pipelines, enabling efficient management and execution of complex processes and workflows.

This section provides a quick overview of installation, basic usage, and simple examples.
To dive deeper, please see the full documentation at https://opptimizer.readthedocs.io/.

Installation

Installin by PyPI is appropriate for most use cases.

pip install opptimizer

There is also advanced way of local install described here.

Basic Usage

1. Import the opptimizer Library

Begin by importing the opptimizer library into your project:

import opptimizer

2. Create an Executor Instance

Create an instance of the Executor class. You can optionally set the context and/or specify a configuration file containing the context during instantiation:

executor = opptimizer.Executor(context=my_context)
# or with a configuration file (you can use any file name)
executor = opptimizer.Executor(cfg="path/to/opp.cfg")

3. Define Modules

Define the modules you intend to use. Modules can be function:

def module_exec(mod_obj, params, tokenData):
    # Process tokenData
    return tokenData

or instances of the Mod class:

module_instance = opptimizer.Mod(module_exec)

4. Run the Executor.run() Method

Run the Executor with input data or a list of modules:

result = executor.run(input_data,modules=[module_exec])

or with an module instance:

result = executor.run(input_data, modules=[module_instance])

You can use any number of modules in modules list that will be executed sequentially.

5. Get the Result from Execution

Retrieve the result from the execution:

final_result = result.get_result()

Examples of Usage

Basic Pipeline Example

The following example demonstrates a simple pipeline that extends an input string by adding additional parts through modules mod_1 and mod_2, ultimately returning the combined text.

import opptimizer as op

def mod_1(mod_obj, params, tokenData = None):
    tokenData = tokenData + 'result 1'
    return tokenData

def mod_2(mod_obj, params, tokenData = None):
    tokenData = tokenData + ', result 2'
    mod_obj.setResult(tokenData)

executor = op.Executor(modules = [mod_1, mod_2])
response = executor.run('Results: ')

print(f"{response.get_result()}")
Output:
    Results: result 1, result 2

License

This project is licensed under the Apache License 2.0. You may use, modify, and distribute this software freely, provided that you comply with the terms of the license, which include attribution and a disclaimer of warranties. For the full license text, please see Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opptimizer-2.3.4.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

opptimizer-2.3.4-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file opptimizer-2.3.4.tar.gz.

File metadata

  • Download URL: opptimizer-2.3.4.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.4.0

File hashes

Hashes for opptimizer-2.3.4.tar.gz
Algorithm Hash digest
SHA256 f3d1471ea554a02858ba9f859521770711110218cb5db27638f3ad89df98ee8f
MD5 b443b43b45cf854720e6111fa042b4cb
BLAKE2b-256 9f1bebcb844dabc117ea2428b8d1fe68e87728578b4d0446c895836f777e076b

See more details on using hashes here.

File details

Details for the file opptimizer-2.3.4-py3-none-any.whl.

File metadata

  • Download URL: opptimizer-2.3.4-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.4.0

File hashes

Hashes for opptimizer-2.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dfc9da4408fcefaca7d0b27425e72f4af805ff9105dd65e0d7394a7a3c003966
MD5 dd7c376620de29145580d920777243e1
BLAKE2b-256 d077d595b7690d8087cd9b8f46c0fd6faa829c660f7d075ea30517a3d8305c87

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page