some functions to machine learning applications in octave/matlab