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.Storage.Redis
Shared, client-agnostic primitives for the OptunaSharp Redis journal backends: the redis:// URL parser (RedisEndpoint / RedisUrl), the Redis key layout, and the atomic append Lua script (RedisJournalProtocol). No Redis client dependency of its own — the StackExchange / NRedisStack / ServiceStack backend packages build on this. Part of the SciSharp STACK. |
|
|
OptunaSharp.Interop.pythonnet
OptunaSharp's bridge to the live Python Optuna ecosystem via Python.NET (pythonnet), most importantly OptunaHub (https://hub.optuna.org/). OptunaHub.LoadModule("samplers/auto_sampler") / ("benchmarks/bbob") mirrors optunahub.load_module, and the loaded contributor packages are wrapped so an OptunaSharp Study can drive them directly: a hub SimpleBaseSampler becomes an OptunaSharp BaseSampler (over a synchronized shadow study), and a hub BaseProblem becomes an OptunaSharp objective (search space + directions + evaluate). The .NET analog of NumSharp.Interop.pythonnet. Requires a discoverable CPython with `pip install optuna optunahub`. Part of the SciSharp STACK. |
|
|
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.Storage.Sqlite
SQLite RDB storage for OptunaSharp — the port of optuna.storages.RDBStorage on Microsoft.Data.Sqlite. Persists a study to a local .db file with Optuna's exact schema (alembic v3.2.0.a, schema_version 12), so Python Optuna and OptunaSharp can open the same database file. Part of the SciSharp STACK. |
|
|
OptunaSharp.Storage.ServiceStack.Redis
Redis journal-log backend for OptunaSharp on ServiceStack.Redis. ServiceStackJournalRedisBackend persists an Optuna study's operation log to a Redis server (standalone or cluster), byte-compatible with Python Optuna and the sibling StackExchange/NRedisStack backends. NOTE: ServiceStack.Redis is COMMERCIALLY licensed (its free tier is request-quota-limited) — see the package README. Part of the SciSharp STACK. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 313 | 11/8/2026 |