This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// computes and steps along the gradient of the SVM objective function: Sum_i HingeLoss(1.0 - normal^Tx_i y_i) + ||w||_2^2 | |
public static double[] SupportVectorStep(PINQueryable<Example> input, double[] normal, double epsilon) | |
{ | |
// select the examples that are currently mis-labeled by the normal vector. also add some negative normal for our regularizer | |
var errors = input.Where(x => x.label * x.vector.Select((v, i) => v * normal[i]).Sum() < 1.0) | |
.Concat(Enumerable.Repeat(new Example(normal, -1.0), 10).AsQueryable()); | |
// fold the average error into the normal | |
var newnormal = new double[normal.Length]; | |
foreach (var coordinate in Enumerable.Range(0, normal.Length)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stephentu@ben:/x/2/stephentu/dice/src/cpp(master)$ ./simulator opt.values | |
starting simulation of 10000 trials | |
mean=271.217, std=41.8306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline SDP | |
ConstructMaxCutSDPFromGraph(const UndirectedGraph& g) | |
{ | |
SDP sdp(g.NumVertices(), g.NumVertices(), 0); | |
g.Laplacian(sdp.SparseC()); | |
sdp.SparseC() *= -1; | |
for (size_t i = 0; i < g.NumVertices(); i++) | |
{ | |
sdp.SparseA()[i].zeros(g.NumVertices(), g.NumVertices()); | |
sdp.SparseA()[i](i, i) = 1.; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve_sparse(C): | |
"""Solve using the low level interface | |
""" | |
if not scipy.sparse.isspmatrix_coo(C): | |
raise ValueError("needs COO input") | |
n, _ = C.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMakeFiles/cf.dir/cf_main.cpp.o: In function `double arma::blas::dot<double>(unsigned int, double const*, double const*)': | |
/home/stephentu/armadillo-4.000.5/include/armadillo_bits/blas_wrapper.hpp:183: undefined reference to `wrapper_ddot_' | |
CMakeFiles/cf.dir/cf_main.cpp.o: In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)': | |
/home/stephentu/armadillo-4.000.5/include/armadillo_bits/blas_wrapper.hpp:34: undefined reference to `wrapper_dgemv_' | |
CMakeFiles/cf.dir/cf_main.cpp.o: In function `void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)': | |
/home/stephentu/armadillo-4.000.5/include/armadillo_bits/blas_wrapper.hpp:69: undefined reference to `wrapper_dgemm_' | |
CMakeFiles/cf.dir/cf_main.cpp.o: In function `void arma::blas::syrk<double>(char c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stephentu@fender build-old(master)$ cmake -DARMADILLO_LIBRARY=$HOME/armadillo-4.000.5/libarmadillo.so -DARMADILLO_INCLUDE_DIR=$HOME/armadillo-4.000.5/include .. | |
-- The C compiler identification is GNU 4.9.2 | |
-- The CXX compiler identification is GNU 4.9.2 | |
-- Check for working C compiler: /usr/bin/cc | |
-- Check for working C compiler: /usr/bin/cc -- works | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Detecting C compile features | |
-- Detecting C compile features - done | |
-- Check for working CXX compiler: /usr/bin/c++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stephentu@peavey:~/mlpack/build(master)$ make | |
[ 1%] Updating gitversion.hpp (if necessary) | |
-- Found Git: /usr/local/bin/git (found version "2.3.4") | |
-- gitversion.hpp is already up to date. | |
[ 1%] Built target mlpack_gitversion | |
Moving header files to include/mlpack/ | |
[ 1%] Built target mlpack_headers | |
Linking CXX shared library ../../lib/libmlpack.dylib | |
Error running link command: No such file or directory | |
make[2]: *** [lib/libmlpack.1.0.dylib] Error 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stephentu@fender ~$ ipython | |
Python 2.7.9 |Continuum Analytics, Inc.| (default, Mar 9 2015, 16:20:48) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 3.1.0 -- An enhanced Interactive Python. | |
Anaconda is brought to you by Continuum Analytics. | |
Please check out: http://continuum.io/thanks and https://binstar.org | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <atomic> | |
#include <cyclades/macros.hpp> | |
namespace cyclades { | |
// implements Lockable concept (C++11) | |
class spinlock { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[error] Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NegativeArraySizeException | |
[error] at java.util.concurrent.FutureTask.report(FutureTask.java:122) | |
[error] at java.util.concurrent.FutureTask.get(FutureTask.java:188) | |
[error] at edu.berkeley.cs.cyclades.AuxiliaryFunctions$$anonfun$5.apply(AuxiliaryFunctions.scala:203) | |
[error] at edu.berkeley.cs.cyclades.AuxiliaryFunctions$$anonfun$5.apply(AuxiliaryFunctions.scala:203) | |
[error] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) | |
[error] at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) | |
[error] at scala.collection.Iterator$class.foreach(Iterator.scala:750) | |
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1202) | |
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) |
OlderNewer