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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opptimizer-2.3.8.tar.gz
.
File metadata
- Download URL: opptimizer-2.3.8.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d45d5b72a434decf2f83eb1c0c07152fee86e2bbcee8ba1ecca341e6be5fbd3 |
|
MD5 | e5da7707f712bf75d4521cbce9e2015f |
|
BLAKE2b-256 | 872c293add25a4c206aab407800e4f8c8b8e595f4b70f8c6b5f045bea4ea1752 |
File details
Details for the file opptimizer-2.3.8-py3-none-any.whl
.
File metadata
- Download URL: opptimizer-2.3.8-py3-none-any.whl
- Upload date:
- Size: 41.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1792181942a45857602c6bd0ec0a71e873b6477fc8cb27001544e419c9dc342 |
|
MD5 | 0dca0fee0a3662abbbd5e3483fd8b38f |
|
BLAKE2b-256 | 352c15c6c7e5c37a06e049c66a4ca7d4f59410378351fd6af1fc3e93d44e1536 |