[mlpack-svn] r15399 - mlpack/trunk/src/mlpack/methods/nca
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jul 3 15:03:04 EDT 2013
Author: rcurtin
Date: Wed Jul 3 15:03:03 2013
New Revision: 15399
Log:
Use arma::Col<size_t> instead of arma::uvec for labels.
Modified:
mlpack/trunk/src/mlpack/methods/nca/nca.hpp
mlpack/trunk/src/mlpack/methods/nca/nca_impl.hpp
mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp
mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
Modified: mlpack/trunk/src/mlpack/methods/nca/nca.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca.hpp (original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca.hpp Wed Jul 3 15:03:03 2013
@@ -58,7 +58,7 @@
* @param metric Instantiated metric to use.
*/
NCA(const arma::mat& dataset,
- const arma::uvec& labels,
+ const arma::Col<size_t>& labels,
MetricType metric = MetricType());
/**
@@ -75,7 +75,7 @@
//! Get the dataset reference.
const arma::mat& Dataset() const { return dataset; }
//! Get the labels reference.
- const arma::uvec& Labels() const { return labels; }
+ const arma::Col<size_t>& Labels() const { return labels; }
//! Get the optimizer.
const OptimizerType<SoftmaxErrorFunction<MetricType> >& Optimizer() const
@@ -87,7 +87,7 @@
//! Dataset reference.
const arma::mat& dataset;
//! Labels reference.
- const arma::uvec& labels;
+ const arma::Col<size_t>& labels;
//! Metric to be used.
MetricType metric;
Modified: mlpack/trunk/src/mlpack/methods/nca/nca_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_impl.hpp Wed Jul 3 15:03:03 2013
@@ -16,7 +16,7 @@
// Just set the internal matrix reference.
template<typename MetricType, template<typename> class OptimizerType>
NCA<MetricType, OptimizerType>::NCA(const arma::mat& dataset,
- const arma::uvec& labels,
+ const arma::Col<size_t>& labels,
MetricType metric) :
dataset(dataset),
labels(labels),
Modified: mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp (original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp Wed Jul 3 15:03:03 2013
@@ -48,7 +48,7 @@
* @param kernel Instantiated kernel (optional).
*/
SoftmaxErrorFunction(const arma::mat& dataset,
- const arma::uvec& labels,
+ const arma::Col<size_t>& labels,
MetricType metric = MetricType());
/**
@@ -109,9 +109,12 @@
size_t NumFunctions() const { return dataset.n_cols; }
private:
+ //! The dataset.
const arma::mat& dataset;
- const arma::uvec& labels;
+ //! Labels for each point in the dataset.
+ const arma::Col<size_t>& labels;
+ //! The instantiated metric.
MetricType metric;
//! Last coordinates. Used for the non-separable Evaluate() and Gradient().
Modified: mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp Wed Jul 3 15:03:03 2013
@@ -15,13 +15,14 @@
// Initialize with the given kernel.
template<typename MetricType>
-SoftmaxErrorFunction<MetricType>::SoftmaxErrorFunction(const arma::mat& dataset,
- const arma::uvec& labels,
- MetricType metric) :
- dataset(dataset),
- labels(labels),
- metric(metric),
- precalculated(false)
+SoftmaxErrorFunction<MetricType>::SoftmaxErrorFunction(
+ const arma::mat& dataset,
+ const arma::Col<size_t>& labels,
+ MetricType metric) :
+ dataset(dataset),
+ labels(labels),
+ metric(metric),
+ precalculated(false)
{ /* nothing to do */ }
//! The non-separable implementation, which uses Precalculate() to save time.
More information about the mlpack-svn
mailing list