Package: neural-pipeline-search
Neural Pipeline Search (NePS)Welcome to NePS, a powerful and flexible Python library for hyperparameter optimization (HPO) and neural architecture search (NAS) with its primary goal: enable HPO adoption in practice for deep learners!NePS houses recently published and some more well-established algorithms that are all capable of being run massively parallel on any distributed setup, with tools to analyze runs, restart runs, etc.Take a look at ourdocumentationand continue following through current README for instructions on how to use NePS!Key FeaturesIn addition to the common features offered by traditional HPO and NAS libraries, NePS stands out with the following key features:Hyperparameter Optimization (HPO) With Prior Knowledge:NePS excels in efficiently tuning hyperparameters using algorithms that enable users to make use of their prior knowledge within the search space. This is leveraged by the insights presented in:PriorBand: Practical Hyperparameter Optimization in the Age of Deep LearningπBO: Augmenting Acquisition Functions with User Beliefs for Bayesian OptimizationNeural Architecture Search (NAS) With Context-free Grammar Search Spaces:NePS is equipped to handle context-free grammar search spaces, providing advanced capabilities for designing and optimizing architectures. this is leveraged by the insights presented in:Construction of Hierarchical Neural Architecture Search Spaces based on Context-free GrammarsEasy Parallelization and Resumption of Runs:NePS simplifies the process of parallelizing optimization tasks both on individual computers and in distributed
computing environments. It also allows users to conveniently resume these optimization tasks after completion to
ensure a seamless and efficient workflow for long-running experiments.Seamless User Code Integration:NePS's modular design ensures flexibility and extensibility. Integrate NePS effortlessly into existing machine learning workflows.Getting Started1. InstallationUsing pip:pipinstallneural-pipeline-searchNote: As indicated with thev0.x.xversion number, NePS is early stage code and APIs might change in the future.2. Basic UsageUsingnepsalways follows the same pattern:Define arun_pipelinefunction capable of evaluating different architectural and/or hyperparameter configurations
for your problem.Define a search space namedpipeline_spaceof those Parameters e.g. via a dictionaryCallneps.runto optimizerun_pipelineoverpipeline_spaceIn code, the usage pattern can look like this:importnepsimportlogging# 1. Define a function that accepts hyperparameters and computes the validation errordefrun_pipeline(hyperparameter_a:float,hyperparameter_b:int,architecture_parameter:str)->dict:# Create your modelmodel=MyModel(architecture_parameter)# Train and evaluate the model with your training pipelinevalidation_error,training_error=train_and_eval(model,hyperparameter_a,hyperparameter_b)return{# dict or float(validation error)"loss":validation_error,"info_dict":{"training_error":training_error# + Other metrics},}# 2. Define a search space of parameters; use the same names for the parameters as in run_pipelinepipeline_space=dict(hyperparameter_b=neps.IntegerParameter(lower=1,upper=42,is_fidelity=True),# Mark 'is_fidelity' as true for a multi-fidelity approach.hyperparameter_a=neps.FloatParameter(lower=0.001,upper=0.1,log=True),# If True, the search space is sampled in log space.architecture_parameter=neps.CategoricalParameter(["option_a","option_b","option_c"]),)if__name__=="__main__":# 3. Run the NePS optimizationlogging.basicConfig(level=logging.INFO)neps.run(run_pipeline=run_pipeline,pipeline_space=pipeline_space,root_directory="path/to/save/results",# Replace with the actual path.max_evaluations_total=100,searcher="hyperband"# Optional specifies the search strategy,# otherwise NePs decides based on your data.)ExamplesDiscover how NePS works through these practical examples:Pipeline Space via YAML: Explore how to define thepipeline_spaceusing a
YAML file instead of a dictionary.Hyperparameter Optimization (HPO): Learn the essentials of hyperparameter optimization with NePS.Architecture Search with Primitives: Dive into architecture search using primitives in NePS.Multi-Fidelity Optimization: Understand how to leverage multi-fidelity optimization for efficient model tuning.Utilizing Expert Priors for Hyperparameters: Learn how to incorporate expert priors for more efficient hyperparameter selection.Additional NePS Examples: Explore more examples, including various use cases and advanced configurations in NePS.DocumentationFor more details and features please have a look at ourdocumentationAnalysing runsSee ourdocumentation on analysing runs.ContributingPlease see thedocumentation for contributors.CitationsPlease consider citing us if you use our tool!Refer to ourdocumentation on citations.AlternativesNePS does not cover your use-case? Have a look atsome alternatives.