diff --git a/doc/user/bindings/cli.md b/doc/user/bindings/cli.md index bc02653831..adfd721f22 100644 --- a/doc/user/bindings/cli.md +++ b/doc/user/bindings/cli.md @@ -1677,9 +1677,9 @@ $ mlpack_linear_svm --input_model_file lsvm_model.bin --test_file test.csv $ mlpack_lmnn [--batch_size 50] [--center] [--distance_file ] [--help] [--info ] --input_file [--k 1] [--labels_file ] [--linear_scan] [--max_iterations 100000] [--normalize] - [--optimizer 'amsgrad'] [--passes 50] [--print_accuracy] [--range 1] - [--rank 0] [--regularization 0.5] [--seed 0] [--step_size 0.01] - [--tolerance 1e-07] [--verbose] [--version] [--centered_data_file + [--optimizer 'amsgrad'] [--passes 50] [--print_accuracy] [--rank 0] + [--regularization 0.5] [--seed 0] [--step_size 0.01] [--tolerance 1e-07] + [--update_interval 1] [--verbose] [--version] [--centered_data_file ] [--output_file ] [--transformed_data_file ] ``` @@ -1706,12 +1706,12 @@ An implementation of Large Margin Nearest Neighbors (LMNN), a distance learning | `--optimizer (-O)` | [`string`](#doc_string) | Optimizer to use; 'amsgrad', 'bbsgd', 'sgd', or 'lbfgs'. | `'amsgrad'` | | `--passes (-p)` | [`int`](#doc_int) | Maximum number of full passes over dataset for AMSGrad, BB_SGD and SGD. | `50` | | `--print_accuracy (-P)` | [`flag`](#doc_flag) | Print accuracies on initial and transformed dataset | | -| `--range (-R)` | [`int`](#doc_int) | Number of iterations after which impostors needs to be recalculated | `1` | | `--rank (-A)` | [`int`](#doc_int) | Rank of distance matrix to be optimized. | `0` | | `--regularization (-r)` | [`double`](#doc_double) | Regularization for LMNN objective function | `0.5` | | `--seed (-s)` | [`int`](#doc_int) | Random seed. If 0, 'std::time(NULL)' is used. | `0` | | `--step_size (-a)` | [`double`](#doc_double) | Step size for AMSGrad, BB_SGD and SGD (alpha). | `0.01` | | `--tolerance (-t)` | [`double`](#doc_double) | Maximum tolerance for termination of AMSGrad, BB_SGD, SGD or L-BFGS. | `1e-07` | +| `--update_interval (-R)` | [`int`](#doc_int) | Number of iterations after which impostors need to be recalculated. | `1` | | `--verbose (-v)` | [`flag`](#doc_flag) | Display informational messages and the full list of parameters and timers at the end of execution. | | | `--version (-V)` | [`flag`](#doc_flag) | Display the version of mlpack. Only exists in CLI binding. | | @@ -1731,7 +1731,7 @@ This program implements Large Margin Nearest Neighbors, a distance learning tech To work, this algorithm needs labeled data. It can be given as the last row of the input dataset (specified with `--input_file (-i)`), or alternatively as a separate matrix (specified with `--labels_file (-l)`). Additionally, a starting point for optimization (specified with `--distance_file (-d)`can be given, having (r x d) dimensionality. Here r should satisfy 1 <= r <= d, Consequently a Low-Rank matrix will be optimized. Alternatively, Low-Rank distance can be learned by specifying the `--rank (-A)`parameter (A Low-Rank matrix with uniformly distributed values will be used as initial learning point). -The program also requires number of targets neighbors to work with ( specified with `--k (-k)`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `--regularization (-r)`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `--range (-R)`). +The program also requires number of targets neighbors to work with ( specified with `--k (-k)`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `--regularization (-r)`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `--update_interval (-R)`). Output can either be the learned distance matrix (specified with `--output_file (-o)`), or the transformed dataset (specified with `--transformed_data_file (-D)`), or both. Additionally mean-centered dataset (specified with `--centered_data_file (-c)`) can be accessed given mean-centering (specified with `--center (-C)`) is performed on the dataset. Accuracy on initial dataset and final transformed dataset can be printed by specifying the `--print_accuracy (-P)`parameter. @@ -1755,10 +1755,10 @@ $ mlpack_lmnn --input_file iris.csv --labels_file iris_labels.csv --k 3 --optimizer bbsgd --output_file output.csv ``` -An another program call making use of range & regularization parameter with dataset having labels as last column can be made as: +Another program call making use of update interval & regularization parameter with dataset having labels as last column can be made as: ```bash -$ mlpack_lmnn --input_file letter_recognition.csv --k 5 --range 10 +$ mlpack_lmnn --input_file letter_recognition.csv --k 5 --update_interval 10 --regularization 0.4 --output_file output.csv ``` diff --git a/doc/user/bindings/go.md b/doc/user/bindings/go.md index c9baae764f..71878e2430 100644 --- a/doc/user/bindings/go.md +++ b/doc/user/bindings/go.md @@ -2069,12 +2069,12 @@ param.Normalize = false param.Optimizer = "amsgrad" param.Passes = 50 param.PrintAccuracy = false -param.Range = 1 param.Rank = 0 param.Regularization = 0.5 param.Seed = 0 param.StepSize = 0.01 param.Tolerance = 1e-07 +param.UpdateInterval = 1 param.Verbose = false centered_data, output, transformed_data := mlpack.Lmnn(input, param) @@ -2102,12 +2102,12 @@ There are two types of input options: required options, which are passed directl | `Optimizer` | [`string`](#doc_string) | Optimizer to use; 'amsgrad', 'bbsgd', 'sgd', or 'lbfgs'. | `"amsgrad"` | | `Passes` | [`int`](#doc_int) | Maximum number of full passes over dataset for AMSGrad, BB_SGD and SGD. | `50` | | `PrintAccuracy` | [`bool`](#doc_bool) | Print accuracies on initial and transformed dataset | `false` | -| `Range` | [`int`](#doc_int) | Number of iterations after which impostors needs to be recalculated | `1` | | `Rank` | [`int`](#doc_int) | Rank of distance matrix to be optimized. | `0` | | `Regularization` | [`float64`](#doc_float64) | Regularization for LMNN objective function | `0.5` | | `Seed` | [`int`](#doc_int) | Random seed. If 0, 'std::time(NULL)' is used. | `0` | | `StepSize` | [`float64`](#doc_float64) | Step size for AMSGrad, BB_SGD and SGD (alpha). | `0.01` | | `Tolerance` | [`float64`](#doc_float64) | Maximum tolerance for termination of AMSGrad, BB_SGD, SGD or L-BFGS. | `1e-07` | +| `UpdateInterval` | [`int`](#doc_int) | Number of iterations after which impostors need to be recalculated. | `1` | | `Verbose` | [`bool`](#doc_bool) | Display informational messages and the full list of parameters and timers at the end of execution. | `false` | ### Output options @@ -2127,7 +2127,7 @@ This program implements Large Margin Nearest Neighbors, a distance learning tech To work, this algorithm needs labeled data. It can be given as the last row of the input dataset (specified with `Input`), or alternatively as a separate matrix (specified with `Labels`). Additionally, a starting point for optimization (specified with `Distance`can be given, having (r x d) dimensionality. Here r should satisfy 1 <= r <= d, Consequently a Low-Rank matrix will be optimized. Alternatively, Low-Rank distance can be learned by specifying the `Rank`parameter (A Low-Rank matrix with uniformly distributed values will be used as initial learning point). -The program also requires number of targets neighbors to work with ( specified with `K`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `Regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `Range`). +The program also requires number of targets neighbors to work with ( specified with `K`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `Regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `UpdateInterval`). Output can either be the learned distance matrix (specified with `Output`), or the transformed dataset (specified with `TransformedData`), or both. Additionally mean-centered dataset (specified with `CenteredData`) can be accessed given mean-centering (specified with `Center`) is performed on the dataset. Accuracy on initial dataset and final transformed dataset can be printed by specifying the `PrintAccuracy`parameter. @@ -2156,13 +2156,13 @@ param.Optimizer = "bbsgd" _, output, _ := mlpack.Lmnn(iris, param) ``` -An another program call making use of range & regularization parameter with dataset having labels as last column can be made as: +Another program call making use of update interval & regularization parameter with dataset having labels as last column can be made as: ```go // Initialize optional parameters for Lmnn(). param := mlpack.LmnnOptions() param.K = 5 -param.Range = 10 +param.UpdateInterval = 10 param.Regularization = 0.4 _, output, _ := mlpack.Lmnn(letter_recognition, param) diff --git a/doc/user/bindings/julia.md b/doc/user/bindings/julia.md index 5d9e699354..6b81648246 100644 --- a/doc/user/bindings/julia.md +++ b/doc/user/bindings/julia.md @@ -1696,9 +1696,9 @@ julia> using mlpack: lmnn julia> centered_data, output, transformed_data = lmnn(input; batch_size=50, center=false, distance=zeros(0, 0), k=1, labels=Int[], linear_scan=false, max_iterations=100000, normalize=false, - optimizer="amsgrad", passes=50, print_accuracy=false, range=1, rank=0, + optimizer="amsgrad", passes=50, print_accuracy=false, rank=0, regularization=0.5, seed=0, step_size=0.01, tolerance=1e-07, - verbose=false) + update_interval=1, verbose=false) ``` An implementation of Large Margin Nearest Neighbors (LMNN), a distance learning technique. Given a labeled dataset, this learns a transformation of the data that improves k-nearest-neighbor performance; this can be useful as a preprocessing step. [Detailed documentation](#lmnn_detailed-documentation). @@ -1722,12 +1722,12 @@ An implementation of Large Margin Nearest Neighbors (LMNN), a distance learning | `optimizer` | [`String`](#doc_String) | Optimizer to use; 'amsgrad', 'bbsgd', 'sgd', or 'lbfgs'. | `"amsgrad"` | | `passes` | [`Int`](#doc_Int) | Maximum number of full passes over dataset for AMSGrad, BB_SGD and SGD. | `50` | | `print_accuracy` | [`Bool`](#doc_Bool) | Print accuracies on initial and transformed dataset | `false` | -| `range` | [`Int`](#doc_Int) | Number of iterations after which impostors needs to be recalculated | `1` | | `rank` | [`Int`](#doc_Int) | Rank of distance matrix to be optimized. | `0` | | `regularization` | [`Float64`](#doc_Float64) | Regularization for LMNN objective function | `0.5` | | `seed` | [`Int`](#doc_Int) | Random seed. If 0, 'std::time(NULL)' is used. | `0` | | `step_size` | [`Float64`](#doc_Float64) | Step size for AMSGrad, BB_SGD and SGD (alpha). | `0.01` | | `tolerance` | [`Float64`](#doc_Float64) | Maximum tolerance for termination of AMSGrad, BB_SGD, SGD or L-BFGS. | `1e-07` | +| `update_interval` | [`Int`](#doc_Int) | Number of iterations after which impostors need to be recalculated. | `1` | | `verbose` | [`Bool`](#doc_Bool) | Display informational messages and the full list of parameters and timers at the end of execution. | `false` | ### Output options @@ -1747,7 +1747,7 @@ This program implements Large Margin Nearest Neighbors, a distance learning tech To work, this algorithm needs labeled data. It can be given as the last row of the input dataset (specified with `input`), or alternatively as a separate matrix (specified with `labels`). Additionally, a starting point for optimization (specified with `distance`can be given, having (r x d) dimensionality. Here r should satisfy 1 <= r <= d, Consequently a Low-Rank matrix will be optimized. Alternatively, Low-Rank distance can be learned by specifying the `rank`parameter (A Low-Rank matrix with uniformly distributed values will be used as initial learning point). -The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `range`). +The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `update_interval`). Output can either be the learned distance matrix (specified with `output`), or the transformed dataset (specified with `transformed_data`), or both. Additionally mean-centered dataset (specified with `centered_data`) can be accessed given mean-centering (specified with `center`) is performed on the dataset. Accuracy on initial dataset and final transformed dataset can be printed by specifying the `print_accuracy`parameter. @@ -1774,13 +1774,13 @@ julia> _, output, _ = lmnn(iris; k=3, labels=iris_labels, optimizer="bbsgd") ``` -An another program call making use of range & regularization parameter with dataset having labels as last column can be made as: +Another program call making use of update interval & regularization parameter with dataset having labels as last column can be made as: ```julia julia> using CSV julia> letter_recognition = CSV.read("letter_recognition.csv") -julia> _, output, _ = lmnn(letter_recognition; k=5, range=10, - regularization=0.4) +julia> _, output, _ = lmnn(letter_recognition; k=5, + regularization=0.4, update_interval=10) ``` ### See also diff --git a/doc/user/bindings/python.md b/doc/user/bindings/python.md index a0a777fc72..8399b13531 100644 --- a/doc/user/bindings/python.md +++ b/doc/user/bindings/python.md @@ -1715,8 +1715,8 @@ Then, to use that model to predict classes for the dataset '`'test'`', storing t copy_all_inputs=False, distance=np.empty([0, 0]), input_=np.empty([0, 0]), k=1, labels=np.empty([0], dtype=np.uint64), linear_scan=False, max_iterations=100000, normalize=False, optimizer='amsgrad', passes=50, - print_accuracy=False, range=1, rank=0, regularization=0.5, seed=0, - step_size=0.01, tolerance=1e-07, verbose=False) + print_accuracy=False, rank=0, regularization=0.5, seed=0, + step_size=0.01, tolerance=1e-07, update_interval=1, verbose=False) >>> centered_data = d['centered_data'] >>> output = d['output'] >>> transformed_data = d['transformed_data'] @@ -1744,12 +1744,12 @@ An implementation of Large Margin Nearest Neighbors (LMNN), a distance learning | `optimizer` | [`str`](#doc_str) | Optimizer to use; 'amsgrad', 'bbsgd', 'sgd', or 'lbfgs'. | `'amsgrad'` | | `passes` | [`int`](#doc_int) | Maximum number of full passes over dataset for AMSGrad, BB_SGD and SGD. | `50` | | `print_accuracy` | [`bool`](#doc_bool) | Print accuracies on initial and transformed dataset | `False` | -| `range` | [`int`](#doc_int) | Number of iterations after which impostors needs to be recalculated | `1` | | `rank` | [`int`](#doc_int) | Rank of distance matrix to be optimized. | `0` | | `regularization` | [`float`](#doc_float) | Regularization for LMNN objective function | `0.5` | | `seed` | [`int`](#doc_int) | Random seed. If 0, 'std::time(NULL)' is used. | `0` | | `step_size` | [`float`](#doc_float) | Step size for AMSGrad, BB_SGD and SGD (alpha). | `0.01` | | `tolerance` | [`float`](#doc_float) | Maximum tolerance for termination of AMSGrad, BB_SGD, SGD or L-BFGS. | `1e-07` | +| `update_interval` | [`int`](#doc_int) | Number of iterations after which impostors need to be recalculated. | `1` | | `verbose` | [`bool`](#doc_bool) | Display informational messages and the full list of parameters and timers at the end of execution. | `False` | ### Output options @@ -1769,7 +1769,7 @@ This program implements Large Margin Nearest Neighbors, a distance learning tech To work, this algorithm needs labeled data. It can be given as the last row of the input dataset (specified with `input_`), or alternatively as a separate matrix (specified with `labels`). Additionally, a starting point for optimization (specified with `distance`can be given, having (r x d) dimensionality. Here r should satisfy 1 <= r <= d, Consequently a Low-Rank matrix will be optimized. Alternatively, Low-Rank distance can be learned by specifying the `rank`parameter (A Low-Rank matrix with uniformly distributed values will be used as initial learning point). -The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `range`). +The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `update_interval`). Output can either be the learned distance matrix (specified with `output`), or the transformed dataset (specified with `transformed_data`), or both. Additionally mean-centered dataset (specified with `centered_data`) can be accessed given mean-centering (specified with `center`) is performed on the dataset. Accuracy on initial dataset and final transformed dataset can be printed by specifying the `print_accuracy`parameter. @@ -1793,10 +1793,10 @@ Example - Let's say we want to learn distance on iris dataset with number of tar >>> output = output['output'] ``` -An another program call making use of range & regularization parameter with dataset having labels as last column can be made as: +Another program call making use of update interval & regularization parameter with dataset having labels as last column can be made as: ```python ->>> output = lmnn(input_=letter_recognition, k=5, range=10, +>>> output = lmnn(input_=letter_recognition, k=5, update_interval=10, regularization=0.4) >>> output = output['output'] ``` diff --git a/doc/user/bindings/r.md b/doc/user/bindings/r.md index 2aa0037959..b6a242b521 100644 --- a/doc/user/bindings/r.md +++ b/doc/user/bindings/r.md @@ -1689,9 +1689,9 @@ R> library(mlpack) R> d <- lmnn(batch_size=50, center=FALSE, distance=matrix(numeric(), 0, 0), input=matrix(numeric(), 0, 0), k=1, labels=matrix(integer(), 0, 0), linear_scan=FALSE, max_iterations=100000, normalize=FALSE, - optimizer="amsgrad", passes=50, print_accuracy=FALSE, range=1, rank=0, + optimizer="amsgrad", passes=50, print_accuracy=FALSE, rank=0, regularization=0.5, seed=0, step_size=0.01, tolerance=1e-07, - verbose=getOption("mlpack.verbose", FALSE)) + update_interval=1, verbose=getOption("mlpack.verbose", FALSE)) R> centered_data <- d$centered_data R> output <- d$output R> transformed_data <- d$transformed_data @@ -1718,12 +1718,12 @@ An implementation of Large Margin Nearest Neighbors (LMNN), a distance learning | `optimizer` | [`character`](#doc_character) | Optimizer to use; 'amsgrad', 'bbsgd', 'sgd', or 'lbfgs'. | `"amsgrad"` | | `passes` | [`integer`](#doc_integer) | Maximum number of full passes over dataset for AMSGrad, BB_SGD and SGD. | `50` | | `print_accuracy` | [`logical`](#doc_logical) | Print accuracies on initial and transformed dataset | `FALSE` | -| `range` | [`integer`](#doc_integer) | Number of iterations after which impostors needs to be recalculated | `1` | | `rank` | [`integer`](#doc_integer) | Rank of distance matrix to be optimized. | `0` | | `regularization` | [`numeric`](#doc_numeric) | Regularization for LMNN objective function | `0.5` | | `seed` | [`integer`](#doc_integer) | Random seed. If 0, 'std::time(NULL)' is used. | `0` | | `step_size` | [`numeric`](#doc_numeric) | Step size for AMSGrad, BB_SGD and SGD (alpha). | `0.01` | | `tolerance` | [`numeric`](#doc_numeric) | Maximum tolerance for termination of AMSGrad, BB_SGD, SGD or L-BFGS. | `1e-07` | +| `update_interval` | [`integer`](#doc_integer) | Number of iterations after which impostors need to be recalculated. | `1` | | `verbose` | [`logical`](#doc_logical) | Display informational messages and the full list of parameters and timers at the end of execution. | `getOption("mlpack.verbose", FALSE)` | ### Output options @@ -1743,7 +1743,7 @@ This program implements Large Margin Nearest Neighbors, a distance learning tech To work, this algorithm needs labeled data. It can be given as the last row of the input dataset (specified with `input`), or alternatively as a separate matrix (specified with `labels`). Additionally, a starting point for optimization (specified with `distance`can be given, having (r x d) dimensionality. Here r should satisfy 1 <= r <= d, Consequently a Low-Rank matrix will be optimized. Alternatively, Low-Rank distance can be learned by specifying the `rank`parameter (A Low-Rank matrix with uniformly distributed values will be used as initial learning point). -The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `range`). +The program also requires number of targets neighbors to work with ( specified with `k`), A regularization parameter can also be passed, It acts as a trade of between the pulling and pushing terms (specified with `regularization`), In addition, this implementation of LMNN includes a parameter to decide the interval after which impostors must be re-calculated (specified with `update_interval`). Output can either be the learned distance matrix (specified with `output`), or the transformed dataset (specified with `transformed_data`), or both. Additionally mean-centered dataset (specified with `centered_data`) can be accessed given mean-centering (specified with `center`) is performed on the dataset. Accuracy on initial dataset and final transformed dataset can be printed by specifying the `print_accuracy`parameter. @@ -1767,10 +1767,10 @@ R> output <- lmnn(input=iris, labels=iris_labels, k=3, optimizer="bbsgd") R> output <- output$output ``` -An another program call making use of range & regularization parameter with dataset having labels as last column can be made as: +Another program call making use of update interval & regularization parameter with dataset having labels as last column can be made as: ```R -R> output <- lmnn(input=letter_recognition, k=5, range=10, +R> output <- lmnn(input=letter_recognition, k=5, update_interval=10, regularization=0.4) R> output <- output$output ``` diff --git a/doc/user/core.md b/doc/user/core.md index 0654103a66..1917958ed2 100644 --- a/doc/user/core.md +++ b/doc/user/core.md @@ -862,9 +862,9 @@ including: * [`NeighborSearch`](/src/mlpack/methods/neighbor_search/neighbor_search.hpp) * [`RangeSearch`](/src/mlpack/methods/range_search/range_search.hpp) - * [`LMNN`](/src/mlpack/methods/lmnn/lmnn.hpp) + * [`LMNN`](user/methods/lmnn.md) * [`EMST`](/src/mlpack/methods/emst/emst.hpp) - * [`NCA`](/src/mlpack/methods/nca/nca.hpp) + * [`NCA`](user/methods/nca.md) * [`RANN`](/src/mlpack/methods/rann/rann.hpp) * [`KMeans`](/src/mlpack/methods/kmeans/kmeans.hpp)