katib

module
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0

README

logo

Build Status Coverage Status Go Report Card Releases Slack Status

Katib is a Kubernetes-native project for automated machine learning (AutoML). Katib supports Hyperparameter Tuning, Early Stopping and Neural Architecture Search.

Katib is the project which is agnostic to machine learning (ML) frameworks. It can tune hyperparameters of applications written in any language of the users’ choice and natively supports many ML frameworks, such as TensorFlow, Apache MXNet, PyTorch, XGBoost, and others.

Katib can perform training jobs using any Kubernetes Custom Resources with out of the box support for Kubeflow Training Operator, Argo Workflows, Tekton Pipelines and many more.

Katib stands for secretary in Arabic.

Search Algorithms

Katib supports several search algorithms. Follow the Kubeflow documentation to know more about each algorithm and check the Suggestion service guide to implement your custom algorithm.

Hyperparameter Tuning Neural Architecture Search Early Stopping
Random Search ENAS Median Stop
Grid Search DARTS
Bayesian Optimization
TPE
Multivariate TPE
CMA-ES
Sobol's Quasirandom Sequence
HyperBand
Population Based Training

To perform above algorithms Katib supports the following frameworks:

Installation

For the various Katib installs check the Kubeflow guide. Follow the next steps to install Katib standalone.

Prerequisites

This is the minimal requirements to install Katib:

  • Kubernetes >= 1.25
  • kubectl >= 1.25

Latest Version

For the latest Katib version run this command:

kubectl apply -k "github.com/kubeflow/katib.git/manifests/v1beta1/installs/katib-standalone?ref=master"

Release Version

For the specific Katib release (for example v0.14.0) run this command:

kubectl apply -k "github.com/kubeflow/katib.git/manifests/v1beta1/installs/katib-standalone?ref=v0.14.0"

Make sure that all Katib components are running:

$ kubectl get pods -n kubeflow

NAME                                READY   STATUS      RESTARTS   AGE
katib-controller-566595bdd8-hbxgf   1/1     Running     0          36s
katib-db-manager-57cd769cdb-4g99m   1/1     Running     0          36s
katib-mysql-7894994f88-5d4s5        1/1     Running     0          36s
katib-ui-5767cfccdc-pwg2x           1/1     Running     0          36s

For the Katib Experiments check the complete examples list.

Quickstart

You can run your first HyperParameter Tuning Experiment using Katib Python SDK.

In the following example we are going to maximize a simple objective function: $F(a,b) = 4a - b^2$. The bigger $a$ and the lesser $b$ value, the bigger the function value $F$.

import kubeflow.katib as katib

# Step 1. Create an objective function.
def objective(parameters):
    # Import required packages.
    import time
    time.sleep(5)
    # Calculate objective function.
    result = 4 * int(parameters["a"]) - float(parameters["b"]) ** 2
    # Katib parses metrics in this format: <metric-name>=<metric-value>.
    print(f"result={result}")

# Step 2. Create HyperParameter search space.
parameters = {
    "a": katib.search.int(min=10, max=20),
    "b": katib.search.double(min=0.1, max=0.2)
}

# Step 3. Create Katib Experiment.
katib_client = katib.KatibClient()
name = "tune-experiment"
katib_client.tune(
    name=name,
    objective=objective,
    parameters=parameters,
    objective_metric_name="result",
    max_trial_count=12
)

# Step 4. Get the best HyperParameters.
print(katib_client.get_optimal_hyperparameters(name))

Documentation

Community

We are always growing our community and invite new users and AutoML enthusiasts to contribute to the Katib project. The following links provide information about getting involved in the community:

Contributing

Please feel free to test the system! Developer guide is a good starting point for our developers.

Blog posts

Events

Citation

If you use Katib in a scientific publication, we would appreciate citations to the following paper:

A Scalable and Cloud-Native Hyperparameter Tuning System, George et al., arXiv:2006.02085, 2020.

Bibtex entry:

@misc{george2020katib,
    title={A Scalable and Cloud-Native Hyperparameter Tuning System},
    author={Johnu George and Ce Gao and Richard Liu and Hou Gang Liu and Yuan Tang and Ramdoot Pydipaty and Amit Kumar Saha},
    year={2020},
    eprint={2006.02085},
    archivePrefix={arXiv},
    primaryClass={cs.DC}
}

Directories

Path Synopsis
cmd
katib-controller/v1beta1
Katib-controller is a controller (operator) for Experiments and Trials
Katib-controller is a controller (operator) for Experiments and Trials
hack
pkg
apis/config/v1beta1
Package v1beta1 contains API Schema definitions for the config v1beta1 API group +kubebuilder:object:generate=true +groupName=config.kubeflow.org
Package v1beta1 contains API Schema definitions for the config v1beta1 API group +kubebuilder:object:generate=true +groupName=config.kubeflow.org
apis/controller
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
apis/controller/common
Package experiment contains experiment API versions
Package experiment contains experiment API versions
apis/controller/common/v1beta1
Package v1beta1 contains API Schema definitions for the common v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=common.kubeflow.org
Package v1beta1 contains API Schema definitions for the common v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=common.kubeflow.org
apis/controller/experiments
Package experiments contains experiment API versions
Package experiments contains experiment API versions
apis/controller/experiments/v1beta1
Package v1beta1 contains API Schema definitions for the experiment v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=experiment.kubeflow.org
Package v1beta1 contains API Schema definitions for the experiment v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=experiment.kubeflow.org
apis/controller/suggestions
Package suggestions contains suggestion API versions
Package suggestions contains suggestion API versions
apis/controller/suggestions/v1beta1
Package v1beta1 contains API Schema definitions for the suggestion v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=suggestion.kubeflow.org
Package v1beta1 contains API Schema definitions for the suggestion v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=suggestion.kubeflow.org
apis/controller/trials
Package trials contains trial API versions
Package trials contains trial API versions
apis/controller/trials/v1beta1
Package v1beta1 contains API Schema definitions for the trial v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=trial.kubeflow.org
Package v1beta1 contains API Schema definitions for the trial v1beta1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1 +k8s:defaulter-gen=TypeMeta +kubebuilder:subresource:status +groupName=trial.kubeflow.org
apis/manager/health
Package grpc_health_v1 is a generated protocol buffer package.
Package grpc_health_v1 is a generated protocol buffer package.
apis/manager/v1beta1
Package api_v1_beta1 is a generated protocol buffer package.
Package api_v1_beta1 is a generated protocol buffer package.
client/controller/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/controller/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/controller/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/controller/clientset/versioned/typed/common/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/controller/clientset/versioned/typed/common/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
client/controller/clientset/versioned/typed/experiments/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/controller/clientset/versioned/typed/experiments/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
client/controller/clientset/versioned/typed/suggestions/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/controller/clientset/versioned/typed/suggestions/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
client/controller/clientset/versioned/typed/trials/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/controller/clientset/versioned/typed/trials/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
mock/v1beta1/api
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/db
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/experiment/manifest
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/experiment/suggestion
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/suggestion/suggestionclient
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/trial/managerclient
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock/v1beta1/util/katibclient
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL