Skip to content

Commit

Permalink
Merge branch 'upstream/master' into awhitesong/LeakyReLU, resolving m…
Browse files Browse the repository at this point in the history
…erge conflicts
  • Loading branch information
awhitesong committed Mar 8, 2016
2 parents 611eeb6 + fd84f3a commit 858e010
Show file tree
Hide file tree
Showing 37 changed files with 1,087 additions and 647 deletions.
47 changes: 47 additions & 0 deletions .appveyor.yml
@@ -0,0 +1,47 @@
clone_depth: 30
environment:
VisualStudioVersion: 14.0
configuration: Release
os: Visual Studio 2015
install:
- ps: nuget install boost -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install boost_unit_test_framework-vc140 -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install boost_program_options-vc140 -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install boost_random-vc140 -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install boost_serialization-vc140 -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install boost_math_c99-vc140 -o "${env:APPVEYOR_BUILD_FOLDER}"
- ps: nuget install OpenBLAS -o "${env:APPVEYOR_BUILD_FOLDER}"
build_script:
- mkdir boost_libs
- ps: cp C:\projects\mlpack\boost_program_options-vc140.1.60.0.0\lib\native\address-model-64\lib\*.* C:\projects\mlpack\boost_libs\
- ps: cp C:\projects\mlpack\boost_math_c99-vc140.1.60.0.0\lib\native\address-model-64\lib\*.* C:\projects\mlpack\boost_libs\
- ps: cp C:\projects\mlpack\boost_random-vc140.1.60.0.0\lib\native\address-model-64\lib\*.* C:\projects\mlpack\boost_libs\
- ps: cp C:\projects\mlpack\boost_serialization-vc140.1.60.0.0\lib\native\address-model-64\lib\*.* C:\projects\mlpack\boost_libs\
- ps: cp C:\projects\mlpack\boost_unit_test_framework-vc140.1.60.0.0\lib\native\address-model-64\lib\*.* C:\projects\mlpack\boost_libs\
- appveyor DownloadFile http://sourceforge.net/projects/arma/files/armadillo-6.500.5.tar.gz
- 7z x armadillo-6.500.5.tar.gz -so | 7z x -si -ttar > nul
- cd armadillo-6.500.5 && mkdir build && cd build
- cmake -G "Visual Studio 14 2015 Win64" -DBLAS_LIBRARY:FILEPATH="%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DLAPACK_LIBRARY:FILEPATH="%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DCMAKE_PREFIX:FILEPATH="%APPVEYOR_BUILD_FOLDER%/armadillo" -DBUILD_SHARED_LIBS=OFF ..
- '"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\projects\mlpack\armadillo-6.500.5\build\armadillo.sln" /m /verbosity:quiet /p:Configuration=Release;Platform=x64'
- cd C:\projects\mlpack && mkdir build && cd build
- cmake -G "Visual Studio 14 2015 Win64" -DBLAS_LIBRARY:FILEPATH="%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DLAPACK_LIBRARY:FILEPATH="%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DARMADILLO_INCLUDE_DIR="C:/projects/mlpack/armadillo-6.500.5/include" -DARMADILLO_LIBRARY:FILEPATH="C:\projects\mlpack\armadillo-6.500.5\build\Debug\armadillo.lib" -DBOOST_INCLUDEDIR:PATH="C:\projects\mlpack\boost.1.60.0.0\lib\native\include" -DBOOST_LIBRARYDIR:PATH="C:\projects\mlpack\boost_libs" -DDEBUG=OFF -DPROFILE=OFF ..
- '"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\projects\mlpack\build\mlpack.sln" /m /verbosity:normal /p:Configuration=Release;Platform=x64'
- 7z a mlpack-windows-no-libs.zip "%APPVEYOR_BUILD_FOLDER%\build\Release\*.exe"
- 7z a mlpack-windows.zip "%APPVEYOR_BUILD_FOLDER%\build\Release\*.*" "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/*.*"

artifacts:
- path: '**\*.zip'

notifications:
- provider: Email
to:
- mlpack-git@cc.gatech.edu
on_build_success: true
on_build_failure: true
on_build_status_changed: true

# All plans have maximum build job execution time of 60 minutes. But right, now
# the machine takes 30 minutes to build the code and at least 50 minutes to run
# all tests.
# test_script: -
# '"C:\projects\mlpack\build\Release\mlpack_test.exe" -p'
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -8,7 +8,7 @@ learning researchers.

**Download [current stable version (2.0.1)](http://www.mlpack.org/files/mlpack-2.0.1.tar.gz).**

[![Build Status](http://big.mlpack.org:7780/job/mlpack%20-%20git%20commit%20test/badge/icon)](http://www.mlpack.org:8088/job/mlpack%20-%20git%20commit%20test/)
[![Build Status](http://big.mlpack.org:7780/job/mlpack%20-%20git%20commit%20test/badge/icon)](http://www.mlpack.org:8088/job/mlpack%20-%20git%20commit%20test/) <a href="https://ci.appveyor.com/project/mlpack/mlpack"><img src="https://ci.appveyor.com/api/projects/status/lmbfc78wi16agx4q?svg=true" alt="Build status" height="18"></a>

0. Contents
-----------
Expand All @@ -30,9 +30,9 @@ mlpack is, how to install it, how to run it, and where to find more
documentation. The website should be consulted for further information:

- [mlpack homepage](http://www.mlpack.org/)
- [Tutorials](http://www.mlpack.org/tutorials.html)
- [Tutorials](http://www.mlpack.org/docs/mlpack-git/doxygen.php?doc=tutorials.html)
- [Development Site (Github)](http://www.github.com/mlpack/mlpack/)
- [API documentation](http://www.mlpack.org/doxygen.php)
- [API documentation](http://www.mlpack.org/docs/mlpack-git/doxygen.php)

2. Citation details
-------------------
Expand Down
42 changes: 42 additions & 0 deletions doc/policies/elemtype.hpp
@@ -0,0 +1,42 @@
/*! @page elem The ElemType policy in mlpack
@section Overview
\b mlpack algorithms should be as generic as possible. Often this means
allowing arbitrary metrics or kernels to be used, but this also means allowing
any type of data point to be used. This means that \b mlpack classes should
support \c float, \c double, and other observation types. Some algorithms
support this through the use of a \c MatType template parameter; others will
have their own template parameter, \c ElemType.
The \c ElemType template parameter can take any value that can be used by
Armadillo (or, specifically, classes like \c arma::Mat<> and others); this
encompasses the types
- \c double
- \c float
- \c int
- \c unsigned int
- \c std::complex<double>
- \c std::complex<float>
and other primitive numeric types. Note that Armadillo does not support some
integer types for functionality such as matrix decompositions or other more
advanced linear algebra. This means that when these integer types are used,
some algorithms may fail with Armadillo error messages indicating that those
types cannot be used.
@section A note for developers
If the class has a \c MatType template parameter, \c ElemType can be easily
defined as below:
@code
typedef typename MatType::elem_type ElemType;
@endcode
and otherwise a template parameter with the name \c ElemType can be used. It is
generally a good idea to expose the element type somehow for use by other
classes.
*/
3 changes: 2 additions & 1 deletion src/mlpack/core/math/range_impl.hpp
Expand Up @@ -18,7 +18,8 @@ namespace math {
*/
template<typename T>
inline RangeType<T>::RangeType() :
lo(DBL_MAX), hi(-DBL_MAX) { /* nothing else to do */ }
lo(std::numeric_limits<T>::max()),
hi(-std::numeric_limits<T>::max()) { /* nothing else to do */ }

/**
* Initialize a range to enclose only the given point.
Expand Down
101 changes: 0 additions & 101 deletions src/mlpack/core/tree/TREE_EXPLANATION.txt

This file was deleted.

41 changes: 22 additions & 19 deletions src/mlpack/core/tree/ballbound.hpp
Expand Up @@ -19,21 +19,24 @@ namespace bound {
* specific point (center). TMetricType is the custom metric type that defaults
* to the Euclidean (L2) distance.
*
* @tparam VecType Type of vector (arma::vec or arma::sp_vec).
* @tparam VecType Type of vector (arma::vec or arma::sp_vec or similar).
* @tparam TMetricType metric type used in the distance measure.
*/
template<typename VecType = arma::vec,
typename TMetricType = metric::LMetric<2, true> >
typename TMetricType = metric::LMetric<2, true>>
class BallBound
{
public:
//! The underlying data type.
typedef typename VecType::elem_type ElemType;
//! A public version of the vector type.
typedef VecType Vec;
//! Needed for BinarySpaceTree.
typedef TMetricType MetricType;

private:
//! The radius of the ball bound.
double radius;
ElemType radius;
//! The center of the ball bound.
VecType center;
//! The metric used in this bound.
Expand Down Expand Up @@ -65,7 +68,7 @@ class BallBound
* @param radius Radius of ball bound.
* @param center Center of ball bound.
*/
BallBound(const double radius, const VecType& center);
BallBound(const ElemType radius, const VecType& center);

//! Copy constructor. To prevent memory leaks.
BallBound(const BallBound& other);
Expand All @@ -80,26 +83,26 @@ class BallBound
~BallBound();

//! Get the radius of the ball.
double Radius() const { return radius; }
ElemType Radius() const { return radius; }
//! Modify the radius of the ball.
double& Radius() { return radius; }
ElemType& Radius() { return radius; }

//! Get the center point of the ball.
const VecType& Center() const { return center; }
//! Modify the center point of the ball.
VecType& Center() { return center; }

//! Get the dimensionality of the ball.
double Dim() const { return center.n_elem; }
size_t Dim() const { return center.n_elem; }

/**
* Get the minimum width of the bound (this is same as the diameter).
* For ball bounds, width along all dimensions remain same.
*/
double MinWidth() const { return radius * 2.0; }
ElemType MinWidth() const { return radius * 2.0; }

//! Get the range in a certain dimension.
math::Range operator[](const size_t i) const;
math::RangeType<ElemType> operator[](const size_t i) const;

/**
* Determines if a point is within this bound.
Expand All @@ -117,42 +120,42 @@ class BallBound
* Calculates minimum bound-to-point squared distance.
*/
template<typename OtherVecType>
double MinDistance(const OtherVecType& point,
typename boost::enable_if<IsVector<OtherVecType> >* = 0)
ElemType MinDistance(const OtherVecType& point,
typename boost::enable_if<IsVector<OtherVecType>>* = 0)
const;

/**
* Calculates minimum bound-to-bound squared distance.
*/
double MinDistance(const BallBound& other) const;
ElemType MinDistance(const BallBound& other) const;

/**
* Computes maximum distance.
*/
template<typename OtherVecType>
double MaxDistance(const OtherVecType& point,
typename boost::enable_if<IsVector<OtherVecType> >* = 0)
ElemType MaxDistance(const OtherVecType& point,
typename boost::enable_if<IsVector<OtherVecType>>* = 0)
const;

/**
* Computes maximum distance.
*/
double MaxDistance(const BallBound& other) const;
ElemType MaxDistance(const BallBound& other) const;

/**
* Calculates minimum and maximum bound-to-point distance.
*/
template<typename OtherVecType>
math::Range RangeDistance(
math::RangeType<ElemType> RangeDistance(
const OtherVecType& other,
typename boost::enable_if<IsVector<OtherVecType> >* = 0) const;
typename boost::enable_if<IsVector<OtherVecType>>* = 0) const;

/**
* Calculates minimum and maximum bound-to-bound distance.
*
* Example: bound1.MinDistanceSq(other) for minimum distance.
*/
math::Range RangeDistance(const BallBound& other) const;
math::RangeType<ElemType> RangeDistance(const BallBound& other) const;

/**
* Expand the bound to include the given node.
Expand All @@ -173,7 +176,7 @@ class BallBound
/**
* Returns the diameter of the ballbound.
*/
double Diameter() const { return 2 * radius; }
ElemType Diameter() const { return 2 * radius; }

//! Returns the distance metric used in this bound.
const TMetricType& Metric() const { return *metric; }
Expand Down

0 comments on commit 858e010

Please sign in to comment.