Cet article décrit le R version de GPopt de Python (un package pour l’optimisation « bayésienne » des fonctions de boîte noire et le réglage des hyperparamètres d’apprentissage automatique, à l’aide de la régression de processus gaussien et d’autres substituts conformalisés. Le package est disponible sur GitHub et via l’univers R.
Gardez à l’esprit que ce package est destiné au réglage des hyperparamètres du Machine Learning : le minimum global ne sera pas toujours trouvé, mais ce n’est pas une problèmepuisque cela signifie que vous ne surajustez pas l’ensemble d’entraînement.
Il est porté de la même manière que nnetsauce pour R : avec uv pour créer un environnement virtuel Python isolé contenant le Python GPopt paquet, et reticulate pour l’appeler depuis R. Chaque fonction de ce package R est un mince wrapper qui renvoie l’objet Python sous-jacent ; la règle générale est la suivante : accès aux objets avec .en Python sont remplacés par $est dans R.
Voir cet article pour la technique : J’ai enfin trouvé un moyen de porter des packages Python vers R en utilisant uv et reticulate.
Installer
1. Créez un environnement virtuel Python avec uv
# pip install uv # if necessary uv venv venv source venv/bin/activate # on Windows: venv\Scripts\activate uv pip install pip GPopt
Gardez une trace de l’endroit où venv/ vies – vous suivrez son chemin comme venv_path à chaque fonction de ce package.
2. Installez le package R
install.packages("remotes")
remotes::install_github("Techtonique/GPopt_r")
reticulate sera installé automatiquement en tant que dépendance.
Exemples
Minimiser la fonction Branin
Il s’agit d’une fonction de test standard pour les algorithmes d’optimisation. GPOpt est plus adapté aux fonctions coûteuses de boîte noire, mais c’est un bon exemple pour illustrer l’utilisation du package.
library(GPopt)
branin <- function(x) {
x1 <- x[1]; x2 <- x[2]
term1 <- (x2 - (5.1 * x1^2) / (4 * pi^2) + (5 * x1) / pi - 6)^2
term2 <- 10 * (1 - 1 / (8 * pi)) * cos(x1)
term1 + term2 + 10
}
opt <- GPOpt(
lower_bound = c(-5, 0),
upper_bound = c(10, 15),
objective_func = branin,
n_init = 10,
n_iter = 40,
venv_path = "./venv"
)
opt$optimize(verbose = 1L)
print(opt$x_min) # best parameters
print(opt$y_min) # best objective value
Réglage des hyperparamètres d’un modèle scikit-learn
library(GPopt) sklearn <- get_sklearn(venv_path = "./venv") RandomForestClassifier <- sklearn$ensemble$RandomForestClassifier X <- as.matrix(iris[, 1:4]) y <- as.integer(iris$Species) - 1L mlopt <- MLOptimizer(scoring = "accuracy", cv = 5, venv_path = "./venv") param_config <- list( n_estimators = list(bounds = c(10, 300), dtype = "int"), max_depth = list(bounds = c(1, 20), dtype = "int") ) mlopt$optimize( X_train = X, y_train = y, estimator_class = RandomForestClassifier(), param_config = param_config, verbose = 1L ) print(mlopt$get_best_parameters()) print(mlopt$get_best_score())
Optimisation bayésienne avec arrêt anticipé
library(GPopt) opt <- BOstopping( f = branin, bounds = rbind(c(-5, 10), c(0, 15)), venv_path = "./venv" ) result <- opt$optimize(n_iter = 100L)
Utilisation d’un modèle de substitution personnalisé (conformalisé)
library(GPopt) sklearn <- get_sklearn(venv_path = "./venv") ns <- get_nnetsauce(venv_path = "./venv") opt <- GPOpt( lower_bound = c(-5, 0), upper_bound = c(10, 15), objective_func = branin, acquisition="ucb", method="splitconformal", surrogate_obj = ns$PredictionInterval(sklearn$ensemble$RandomForestRegressor()), venv_path = "./venv" ) opt$optimize(verbose = 1L)

En rapport
PakarPBN
A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.
In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.
The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.