Mocha, deep learning tool - debugging

I am new to deep learning, and have found a tool named "Mocha". This is the tool written in Julia. But I have confronted a bug while I was loading files. The program failed to read files, and I had no idea. The part of code is as follows:
using HDF5
datasets = ["train" => ["train-labels.idx1-ubyte","train-images.idx3-ubyte"],
"test" => ["t10k-labels.idx1-ubyte","t10k-images.idx3-ubyte"]]
The compiler reported that HDF5 is not installed properly. Does anybody know how to fix it?

Error is pretty clear, you need to install HDF5. On a mac (assuming you have homebrew) it would be brew install hdf5.rb

Check this link: https://github.com/JuliaIO/HDF5.jl
You can install HDF5 package for Julia by following instructions on the page.
And I wonder why you chose Julia based framework for Deep learning?

Related

OpenMDAO: First Steps

I am new in the world of OpenMDAO (and also on Python) and I am having some problems to understand the use of the software. I have already installed Anaconda (pyth v2.7) and the OpenMDAO, but I don't know how to run it. I am following this tutorial but I am not sure if I am doing it properly. I write the .py files in notepad++, and I try to run on the IPython but when I use the command : from paraboloid import Paraboloid it appears an error : No module named.api. I think that maybe I am not using the correct path (I'm in the folder where I have the .py files). Probably it's an stupid error, so sorry for the question.
Thank you all, Jose M O
If your tutorial link above is correct, I see that you are using a tutorial for OpenMDAO 0.1.0. That version is 5.5 years old at this time, and is no longer supported. We will be happy to help with your questions, but to get a better foundation, and a much more useful tool, please consider:
Install OpenMDAO 1.5.0 (pip install openmdao or read these installation docs)
Try this paraboloid tutorial instead.
Good luck,
Keith
NOTE: If you installed OpenMDAO 1.x.x and are using the tutorial from 0.1.0, you would have many problems with api imports, as many things have changed since 0.1.0.

RQuantlib and Mac OS X 10.8.2

I'm a total newbie in Mac OS X, R and C++. Sound like a good mix, doesn't it?
I have the need to use RQuantLib, because I want to use some pricing functions part of the QuantLib package inside R, all on a Mac OS X-powered environment.
I've correctly installed QuantLib. I've already asked to the official QuantLib mailing list, and together we seem to have reached the conclusion that the problems I'm encountering are not related to my QuantLib installation, which seems ok and correctly configured.
So, I turned to R to try and solve the problem. Whenever I try to run ZeroCouponBond from within R, copying and pasting the first example provided with the official documentation, I get the following error:
"Error in DiscountCurve.default(discountCurve.param, list(flat = 0.05)) :
cannot find function errorOccured"
Now, I would rule any syntax.related problem out, since I'm copying the very same example present in the official help.
I don't know what I did wrong, but I know I need to find a solution at all costs. I've installed Rcpp, and the configuration seems really ok. Just one question I was not able to find an answert to: in my understanding, RQuantLib basically acts as a link between QuantLib and R. If that's correct, how can I tell RQuantLib where to look to find libQuantLib.a, that is, the compiled library resulting from the "make && sudo make install" commands performed while installing QuantLib itself?
Right, so, I've finally managed to get it to work.
First of all, I would like to say that things would have been much easier if a thorough, step-by-step installation procedure had been provided. I acknowledge I'm a total newbie, but I think other people approaching to R for the first time might encounter difficulties similar to those I had to overcome.
Anyway, this is what I did:
I've downloaded the .tar.gz source packages for both Rcpp and RQuantLib from cran.r-project.org
I've compiled them installing them from within the R environment. This is where I was making a mistake. Indeed, I was trying to compile them by invoking the configure installation script from the terminal; however, as Dirk said, the config script looks for QuantLib's quantlib-config script, and I didn't know the correct syntax to tell the configure script the correct path to QuantLib. Executing the procedure from R (by just installing the package) sorts out any problem, as all the dependencies are correctly located and loaded
So, that's pretty much it: just install the .tar.gz source package as you would do with the binary version, and everything should work ok.
Of course, I'm still curious to understand:
If it is possible to compile Rcpp and RQuantLib from the terminal; and
Why the binary version for Mac OS X will not work on my system, ie: why do I have to compile starting from the source code?
Thank you so much to anyone willing to answer my (probably naive and silly) questions. I'm eager to understand a bit more!
Thanks!
The RQuantLib package uses a tool called configure which determines the patch at package build-time. It looks for the script quantlib-config from which it learns about the location of libQuantLib.a.
First, install boost (brew install boost) and, secondly, Quantlib (currently at 1.7.1) by following instructions at http://quantlib.org/install/macosx.shtml:
cd QuantLib-1.x.y
./configure --enable-static --with-boost-include=/opt/local/include/ \
--with-boost-lib=/opt/local/lib/ --prefix=/opt/local/
make && sudo make install
It takes some time (~1 hour) for make.
Then in R or Rstudio, install packages Rcpp and RQuantlib. The later requires type="source" since only source package is available.
At this point, you should be able to use RQuantlib. The American Option value (SPY as of 4/1/2016, maturity 7/15/2016) can be calculated in R as
AmericanOption("put", strike=206, volatility=0.1525, underlying = 206.92, 0.021, 0.003, 73/252, engine="CrankNicolson")

Totally Lost on "Installing" OpenCV / ctypes-opencv for Python 3

edit: The real solution to this is now that OpenCV supports python 3. I'm leaving the details below for anyone who happens to be stuck with an old setup.
I'm trying to get OpenCV working with Python 3. A friend showed me ctypes-opencv that appears to work with Python 3. The problem is I totally can not figure out how to "install" or get any code working. I've followed all instructions I could find from a few people mentioning installs on google and none of those seemed to work or I couldn't even get through the basics that they mentioned.
I am just hacking around with the version of IDLE that came with Python 3. No IDE.
Start with OpenCV:
The only windows installer for OpenCV 2.1 is a visual studio installer. I assume that means that it installs files that make it easier to use in Visual Studio. However, does it also mean that I can't use that installer with Python 3? I tried the vs installer together with ctypes-opencv as below, and I got errors that the dlls were not in my path (but my path variable did include the OpenCV bin folder with dlls). Is this the wrong direction?
The apparent alternative is to build OpenCV myself. I tried following the directions here and all I get is "project files may be invalid" from the CMake gui application when pressing the "Configure" button. Same when following these hints from Stack Overflow. I'm suspicious that this is also the wrong direction since I am not currently using any of the tools that are listed in the CMake configure. Is this also the wrong direction?
Next ctypes-opencv:
I installed this and the installer recognizes Python3.1 and puts itself into the site-packages folder. If I try to run demos, it tells me the dlls are not in the path although they are, as mentioned above.
Summary:
I think I generally understand each piece here (code, compile, dll, imports, ...) but I do not know how all the pieces fit together and where I am going wrong. Can someone please tell me what steps or understanding I am missing here?
I get the feeling that I need to be reading a book or two to fill in the holes in my understanding of how all these pieces fit together. I wouldn't even know what area of books to get though so any suggestions there would be appreciated as well.
Python's ctypes is a wrapper around the opencv dll files, as long as you can point to the compiled libraries it doesn't matter what the source code is set up to be edited in. For windows I would simply run the installer, then try to load the dll with ctypes. If you can get that far, any other errors can be fixed by looking at the ctypes wrapper file and editing the load section to look like your test file.
Christoph Gohlke maintains Windows binaries for many Python packages, including the production version of OpenCV 3.0 with Python 3.x bindings, released 4 June 2015:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.
Yakiimo san, OpenCV 2.1 DLL can be loaded with ctypes. I have tested it.
p.s. I have set the C;\OpenCV2.1\bin in Env Path.

CoffeeScript on Windows?

How can I try CoffeeScript on Windows?
The installation instructions are only for *nix: http://jashkenas.github.com/coffee-script/#installation
EDIT:
Since I asked this a while ago, many new answers have appeared. The number ( and quality ) of options for Windows users has been increased a lot. I "accepted" an answer a long time ago, then changed to other ( better ) answers as they came up, but I have now decided to not accept any answer, and let the community ( votes ) show which answers are best. Thanks to everyone for the input.
UPDATE: See my other answer to this question, How can I compile CoffeeScript from .NET? for a far more accurate and up-to-date list of the current options.
CoffeeScript-Compiler-for-Windows works well.
Maybe it was more complicated when this question was posted. But as of 2012, CoffeeScript is as easy to use on any platform. The instructions are the same for Windows, Mac, or Linux
Install Nodejs from http://nodejs.org/
Install CoffeeScript globally with the node package manager npm install -g coffeescript or locally npm install --save-dev coffeescript
Write a script in your favourite text editor. Save it, say as hello.coffee
Run your script coffee hello.coffee or compile it coffee -c hello.coffee (to hello.js)
Node.js runs on Cygwin these days, so that's probably your best bet with getting CoffeeScript running on Windows. I'd try that first.
If you have a different preferred JavaScript runtime, you can probably use the prebuilt-compiler (extras/coffee-script.js). For example, if you include that script on a webpage, you can call
CoffeeScript.compile(code);
... to get back the compiled JavaScript string.
UPDATE 2012-04-12: Cygwin is no longer needed to run Node on Windows. Microsoft
worked with Joyent through 2H 2011 to improve node's support for
Windows IOCP async IO. Node 0.6 was the first release of node to
natively support Windows.
You can run the CoffeeScript compiler under good old Window Script Host (cscript.exe), a standard component on Windows since Windows 98. Admittedly I tried this a while back and it didn't work, but I tried again recently and now all the standard CoffeeScript tests compile just fine.
A bit of plumbing code using a *.wsf file and coffee-script.js is all you need. My code is on GitHub: https://github.com/duncansmart/coffeescript-windows
I blogged about it here: http://blog.dotsmart.net/2011/06/20/the-simplest-way-to-compile-coffeescript-on-windows/
You can use jcoffeescript as a command-line solution.
It uses a Java-based javascript engine (Rhino) and wraps up the task of compiling coffee-script.js from the CoffeeScript project. This allows it to run the CoffeeScript compiler as a Java program.
The command to use (on Windows/Linux) looks like this:
java -jar jcoffeescript-1.0.jar < foo.coffee > foo.js
You will need to download & build the Java source code (use IntelliJ Community Edition to avoid downloading Ant) or a pre-built download for CoffeeScript v1.0.
I now use jcoffeescript in place of the Ruby solution (another answer here), because this allows me to keep up with the latest CoffeeScript version.
You can use a command-line version of CoffeeScript by installing Ruby on Windows and then installing the CoffeeScript Gem.
After that, the command-line is available, for example, 'coffee bla.coffee' - to compile your CoffeeScript code down to JavaScript code.
The only disadvantage doing it this way (not using Node.js) is that the Ruby version of CoffeeScript is restricted to version 0.3.2 - the last version written in Ruby before it was moved over to Node.js.
*However, I still use the Ruby version of CoffeeScript in my current employment and my personal web page and I don't see much of a problem as this version of CoffeeScript is quite mature and most of the features listed on the CoffeeScript website can be used.
*striked out this last statement which was correct at the time but is becoming more incorrect every few days; CoffeeScript has now advanced a long way since 0.3.2 and is past 1.1
There're already bunch of answers here, but let me add mine. I wrote a .NET library for compiling CoffeeScript on Windows.
As jashkenas suggested, I've used the pre-compiled extras/coffee-script.js file.
Together with the Jurassic JavaScript compiler I've wrapped it all up in a single library: CoffeeSharp
The library also ships with a commandline tool and a HttpHandler for ASP.NET web development.
I've used this one: https://bitbucket.org/maly/coffeescript-win/zealots
looks working well, althouth you need to manually need to update coffee.script from 0.95 to 1.0.1.
Since node.js is now ported to Windows, this is actually pretty easy:
http://www.colourcoding.net/blog/archive/2011/09/20/using-coffeescript-on-windows.aspx
If you want to use CoffeeScript in an ASP.NET application then you can use this HTTP handler to serve compiled CoffeeScript code.
I haven't tried this myself yet, but it seems to be an answer. (I've downloaded and installed but not used it yet.)
There's an add-in for Visual Studio 2010 that adds CoffeeScript editing to VS (among other things).
It's called Web Workbench and is downloaded as a vsix. (i.e. can be downloaded from within the VS UI.)
I'm only putting this in only as an answer to the more general implied question for "How can I try" tools that don't normally run on Windows or have yet to be ported. Use a virtual machine running a UNIX-like OS such as Linux or BSD.
Provided you have enough RAM and are willing to learn enough to get around, it will make trying open source software a lot easier. In the CoffeeScript case you can still do things like --watch on a shared folder and remain in Windows land most of the time. You also won't pollute your system with tools and services you try and don't buy into, which is handy if you do that a lot.
Consider using Chocolatey to install http://chocolatey.org/packages/CoffeeScript on Windows.
(Installing Chocolatey : https://github.com/chocolatey/chocolatey/wiki/Installation)

Can Ruby + Crate + Windows work?

I've got a project for work I'd like to do in Ruby that will have to run on Windows, but perturbing the filesystem for a Ruby install or RubyScript2Exe unpack isn't an option (this is supposed to be the harness for a testing system). Has anyone successfully used Crate to package up something on Windows? If so, what was your build environment like and can you pass on any other hints?
I've tried and worked in getting Crate work under Windows, but is a more complicated system than I would expect.
If extraction of code for your system is your problem. I recommend take a look to Exerb, and specially: exerb-mingw hosted on GitHub exerb-mingw
It will generate a single executable like Ocra or RubyScript2Exe, but with the difference that the source code will not be extracted and extensions will be dynamically loaded.
This works perfectly with RubyInstaller packages, and is being used with Pik (Ruby version manager for Windows).
Hope this helps.
You can embed a Ruby interpreter and script into a C program, which may be easier than trying to run Crate. Here are some helpful links that describe how to do this, and may provide enough sample code to use as a skeleton for what you are trying to build.

Resources