From 0589b8f7a483cc8af52686ece5ef65c61e6b32ad Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:31:20 -0400 Subject: [PATCH 1/2] Add language tags to code samples --- src/MLJClusteringInterface.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/MLJClusteringInterface.jl b/src/MLJClusteringInterface.jl index 4e9b17e..a8d6778 100644 --- a/src/MLJClusteringInterface.jl +++ b/src/MLJClusteringInterface.jl @@ -265,6 +265,7 @@ algorithm that solves the following optimization problem: ```math \\text{minimize} \\ \\sum_{i=1}^n \\| \\mathbf{x}_i - \\boldsymbol{\\mu}_{z_i} \\|^2 \\ \\text{w.r.t.} \\ (\\boldsymbol{\\mu}, z) ``` + Here, ``\\boldsymbol{\\mu}_k`` is the center of the ``k``-th cluster, and ``z_i`` is an index of the cluster for ``i``-th point ``\\mathbf{x}_i``. @@ -272,8 +273,9 @@ Here, ``\\boldsymbol{\\mu}_k`` is the center of the ``k``-th cluster, and # Training data In MLJ or MLJBase, bind an instance `model` to data with - - mach = machine(model, X) +``` +mach = machine(model, X) +``` Here: @@ -322,7 +324,7 @@ The fields of `report(mach)` are: # Examples -``` +```julia using MLJ KMeans = @load KMeans pkg=Clustering @@ -410,7 +412,7 @@ The fields of `report(mach)` are: # Examples -``` +```julia using MLJ KMedoids = @load KMedoids pkg=Clustering @@ -500,7 +502,7 @@ After calling `predict(mach)`, the fields of `report(mach)` are: # Examples -``` +```julia using MLJ X, labels = make_moons(400, noise=0.09, rng=1) # synthetic data with 2 clusters; X @@ -591,7 +593,7 @@ After calling `predict(mach)`, the fields of `report(mach)` are: # Examples -``` +```julia using MLJ X, labels = make_moons(400, noise=0.09, rng=1) # synthetic data with 2 clusters; X From 63a9c1b81a7e6f2705b2216d529b375991ad869d Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Thu, 18 Apr 2024 20:57:46 -0400 Subject: [PATCH 2/2] Make code samples consistent in fencing --- src/MLJClusteringInterface.jl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/MLJClusteringInterface.jl b/src/MLJClusteringInterface.jl index a8d6778..9bb3976 100644 --- a/src/MLJClusteringInterface.jl +++ b/src/MLJClusteringInterface.jl @@ -361,8 +361,9 @@ point and the closest *medoid* is minimal. # Training data In MLJ or MLJBase, bind an instance `model` to data with - - mach = machine(model, X) +``` +mach = machine(model, X) +``` Here: @@ -455,8 +456,9 @@ there is no training data. For clusterers that do generalize, see [`KMeans`](@re [`KMedoids`](@ref). In MLJ or MLJBase, create a machine with - - mach = machine(model) +``` +mach = machine(model) +``` # Hyper-parameters @@ -558,9 +560,9 @@ there is no training data. For clusterers that do generalize, see [`KMeans`](@re [`KMedoids`](@ref). In MLJ or MLJBase, create a machine with - - mach = machine(model) - +``` +mach = machine(model) +``` # Hyper-parameters - `linkage = :single`: linkage method (:single, :average, :complete, :ward, :ward_presquared)