8/31/2015

Setup Eclipse for C++ 11


Eclipse version

Setting up the compiler is fairly straightforward: 
1. Right click your project and click Properties
2. Under C/C++ Build click Settings
3. Under GCC C++ Compiler, click Miscellaneous. In the Other Flags box, append "-std=c++11" to the list of tokens.


C++11 includes and C++ indexing: 
1. Right click your project and click Properties
2. Under C/C++ General click "Preprocessor Include Paths, Macros"
3. Select the Providers tab
4. Select "CDT GCC Built-in Compiler Settings"
5. Uncheck the "Use global provider shared between projects" option
6. Under the list there's an box that says "Command to get compiler specs." Append "-std=c++11"   to this.


7. Move the "GCC Built in Compiler Settings" provider at the top of the list using the 'Move Up' button on the right. Click Apply and then OK
8. Go to Properties" C/C++ General -> Paths and Symbols -> Symbols -> GNU C++
9. Add __GXX_EXPERIMENTAL_CXX0X__ into "Name" and leave "Value" blank

10. Back in your Eclipse workspace, you project will start indexing. If not, select the Project Menu, C/C++ Index, and click "Re-resolve unresolved includes."


Note:

Setting up **__GXX_EXPERIMENTAL_CXX0X__** does not help 
To fix C++11 syntax highlighting go to:
Project Properties --> C/C++ General --> Paths and Symbols --> Symbols --> GNU C++
and overwrite the symbol (i.e. add new symbol):

__cplusplus
with value
201103L
Besides, you can try to enable indexer to scan all files: Window -> Preferences -> C/C++ -> Indexer

8/09/2015

Android-NDK Eclipse setup


1. Download Eclipse for C/C++ or Eclipse for Jave but you need to download CDT

Eclipse for C/C++


2. Install Android Developer Tools (ADT)

Choose Help->Install New Software from the main menu. 


3. Download Native Development Kit (NDK)

Download NDK and extract it.

Go to Window->Preference->Android->NDK  
Locate your NDK Path




















4. Try to import a NDK project containing Android.mk amd Applicaiton.mk already
$ git clone https://github.com/julienr/libpng-android.git

Open Eclipse and import C/C++ Project (Select C/++ -> Existing Code as Makefile Project)























Give a project name,  locate code path, select Android GCC tool chain.































You can check your project's properties. You build command should be 'ndk-build'. IDE should include android-ndk's headers in C/C++ -> General Path and Symbols.



























5. Start to build it 

Choose Project->Build Project from the main menu.

If your project is executable, you push and test it on your Android device.

$ adb push [/local/path/binary] /data/local/tmp

$ adb shell ./data/local/tmp/[binary]

8/03/2015

Neural Network's common ways to improve generalization and reduce overfitting


1. Data augmentation

 It is the easiest and most common way to reduce overfitting in Machine learning. For example, for images, you can generate data by translating, flipping the images on the training set. For another example, you can augment your data with PCA variables and feature selection.

2. Regulation 

 Add regulation term L1 or L2, and weight decay to loss function in order to penalize certain parameter configurations.

3. Early stopping 

  It's a strategy to stop training before the learner begins to over-fit. Simply stated, "Early stopping" stops training the learner when the error on the validation set is increasing instead of decreasing.

Reference:

4. Dropout 

  Dropout works completely on the level of the activation functions by setting the neuron randomly to 0 with a probability of 0.5. In some research,  the researchers tried to use dropout, and they found that dropout helps prevent overfitting to a large extent in terms of long-term performance during training—the decrease of validation accuracy due to overfitting is much smaller than networks without dropout. 

Reference:
[Srivastavaetal.2014N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. Journal of Machine Learning Research 15: 929-1958, 2014