OptunaSharp 1.0.0
dotnet add package OptunaSharp --version 1.0.0
NuGet\Install-Package OptunaSharp -Version 1.0.0
<PackageReference Include="OptunaSharp" Version="1.0.0" />
<PackageVersion Include="OptunaSharp" Version="1.0.0" />
<PackageReference Include="OptunaSharp" />
paket add OptunaSharp --version 1.0.0
#r "nuget: OptunaSharp, 1.0.0"
#:package OptunaSharp@1.0.0
#addin nuget:?package=OptunaSharp&version=1.0.0
#tool nuget:?package=OptunaSharp&version=1.0.0
OptunaSharp
Optuna for .NET: a C#/F# port of Optuna, the define-by-run hyperparameter optimization framework, built on NumSharp.
Install
dotnet add package OptunaSharp
The package targets .NET 8 and .NET 10.
Quick start
using OptunaSharp;
var study = Optuna.CreateStudy(direction: StudyDirection.Minimize);
study.Optimize(trial =>
{
double x = trial.SuggestFloat("x", -10, 10);
return (x - 2) * (x - 2);
}, nTrials: 100);
Console.WriteLine(study.BestValue); // ~0
Console.WriteLine(study.BestParams["x"]); // ~2
What this package contains
- Studies and trials:
Optuna.CreateStudy/LoadStudy,Optimize, ask-and-tell, multi-objective directions, constraints, user and system attributes, callbacks. - Distributions and search spaces: float, int and categorical distributions, plus search-space inference for dynamic (define-by-run) spaces.
- Samplers: TPE, CMA-ES, GP, Random, Grid, QMC, BruteForce, PartialFixed, NSGA-II and NSGA-III. It also ships samplers Optuna does not have, among them AGE-MOEA-2, SMS-EMOA, MOEA/D, RVEA, LM-CMA, VkD-CMA, differential evolution, PSO, the natural evolution strategies (OpenAI-ES, SNES, xNES), TuRBO, REMBO, SAASBO and JANUS.
- Pruners: Median, Percentile, SuccessiveHalving, Hyperband, Threshold, Patient, Wilcoxon and Nop.
- Storages: in-memory and journal-file storage, heartbeats and
RetryFailedTrialCallback. - Analysis: parameter importance (fANOVA, mean decrease impurity, PED-ANOVA, SHAP), terminators,
the data layer behind every
plot_*function, and a scikit-learn-styleOptunaSearchCV. - Artifacts: a file-system artifact store.
Companion packages
Anything that needs a foreign runtime or a heavy client library ships separately, so this package
depends only on NumSharp, its OpenBLAS backend and Microsoft.Extensions.DependencyInjection.Abstractions.
| Package | What it adds |
|---|---|
OptunaSharp.Storage.Sqlite |
SQLite RDBStorage, database-compatible with Python Optuna |
OptunaSharp.Storage.EFCore |
PostgreSQL and MySQL RDBStorage over Entity Framework Core |
OptunaSharp.Storage.Grpc |
the gRPC storage proxy, client and server |
OptunaSharp.Storage.StackExchange.Redis, .NRedisStack, .ServiceStack.Redis |
Redis journal backends, one per Redis client, over the shared OptunaSharp.Storage.Redis |
OptunaSharp.Artifacts.S3, .Gcs, .AzureBlob, .R2 |
cloud artifact stores |
OptunaSharp.Visualization.Plotly |
interactive figures for every plot_* function |
OptunaSharp.Integration.LightGbm, .ML.NET |
LightGBMTuner, pruning callbacks and ML.NET-backed importance evaluators |
OptunaSharp.Interop.pythonnet, .BoTorch, .PyCma, .Pymoo |
bridges that drive OptunaHub, BoTorch, pycma and pymoo in-process |
OptunaSharp.Cli |
the optunasharp command-line tool (dotnet tool install -g OptunaSharp.Cli) |
Compatibility target
OptunaSharp tracks Optuna 5.x as its behavioral source of truth: names, defaults, edge cases and error messages follow Optuna. Where OptunaSharp and Optuna differ, Optuna is treated as correct and OptunaSharp is aligned to it. The test suite checks OptunaSharp against live Python Optuna, including seeded runs that must reproduce the values Optuna samples exactly.
Links
- Documentation: https://scisharp.github.io/OptunaSharp
- Source and issues: https://github.com/SciSharp/OptunaSharp
License
MIT. OptunaSharp is a derivative of Optuna (© Preferred Networks, Inc.) and retains its notice —
see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- NumSharp (>= 0.80.0)
- NumSharp.Interop.OpenBLAS (>= 0.80.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- NumSharp (>= 0.80.0)
- NumSharp.Interop.OpenBLAS (>= 0.80.0)
NuGet packages (17)
Showing the top 5 NuGet packages that depend on OptunaSharp:
| Package | Downloads |
|---|---|
|
OptunaSharp.Artifacts.S3
Amazon S3 (and S3-compatible) artifact store for OptunaSharp — a port of optuna.artifacts.Boto3ArtifactStore, backed by the official AWS SDK for .NET (AWSSDK.S3). Optional satellite package; OptunaSharp Core stays pure-managed and does not depend on it. |
|
|
OptunaSharp.Artifacts.AzureBlob
Azure Blob Storage artifact store for OptunaSharp — an OptunaSharp extension (Optuna ships no Azure backend). Backed by the official Azure.Storage.Blobs and Azure.Identity clients; supports connection-string, caller-supplied client, and Microsoft Entra ID (DefaultAzureCredential) construction. OptunaSharp Core stays pure-managed and does not depend on it. |
|
|
OptunaSharp.Interop.BoTorch
BoTorchSampler for OptunaSharp — a native OptunaSharp BaseSampler that drives the real BoTorch (PyTorch + GPyTorch) library in-process via Python.NET (pythonnet). A faithful C# port of optuna_integration's BoTorchSampler glue (sampler protocol + candidates_func selection) whose numerics are direct botorch calls, so it is byte-exact with BoTorch. You pick the acquisition function with the pythonnet-free BoTorchCandidatesFunc enum: LogEI, qEI, qLogEI and qNEI for one objective; qEHVI, EHVI, qNEHVI, qParEGO and qLogEI-ParEGO for several; the knowledge-gradient qKG and qHVKG; constrained optimization through Trial.SetConstraint. Does NOT require the Python optuna_integration package — install only `botorch`. The .NET analog of using optuna_integration.BoTorchSampler, built on OptunaSharp.Interop.pythonnet. Part of the SciSharp STACK. |
|
|
OptunaSharp.Artifacts.Gcs
Google Cloud Storage (GCS) artifact store for OptunaSharp — a port of optuna.artifacts.GCSArtifactStore, backed by the official Google.Cloud.Storage.V1 client. Optional satellite package; OptunaSharp Core stays pure-managed and does not depend on it. |
|
|
OptunaSharp.Storage.Grpc
gRPC storage proxy for OptunaSharp — the port of optuna.storages.GrpcStorageProxy (client) and optuna.storages.run_grpc_proxy_server (server). Reuses Optuna's api.proto verbatim, so an OptunaSharp client and a Python Optuna gRPC proxy server (and vice versa) are wire-compatible. Client on Grpc.Net.Client, server on Grpc.AspNetCore. Part of the SciSharp STACK. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 57 | 11/8/2026 |