verne.freenode.net changed the topic of #mlpack to: http://www.mlpack.org/ -- We don't respond instantly... but we will respond. Give it a few minutes. Or hours. -- Channel logs: http://www.mlpack.org/irc/
kris1 has quit [Quit: kris1]
kris1 has joined #mlpack
kris1 has quit [Quit: kris1]
kris1 has joined #mlpack
kris1 has quit [Quit: kris1]
kris1 has joined #mlpack
< bvr> zoq: "lr.Train(data.t(), responses.t()); remove the transpose from the
< bvr> second parameter." I did that, but there is a runtime error:
< bvr> zoq: Mat::init(): requested size is not compatible with column vector layout terminate called after throwing an instance of 'std::logic_error'
partobs-mdp has joined #mlpack
kris1 has quit [Quit: kris1]
partobs-mdp has quit [Remote host closed the connection]
sumedhghaisas has quit [Ping timeout: 240 seconds]
< rcurtin> bvr: I think you need to use 'data' not 'data.t()'
< rcurtin> in mlpack a single point is a column, so you want to use the shape where n_points = n_cols (which I think is nontransposed)
< bvr> rcurtin: Yeah.. I tried that too...
< bvr> lr.Train(data, responses);
< bvr> But the same error!
< bvr> error: Mat::init(): requested size is not compatible with column vector layout terminate called after throwing an instance of 'std::logic_error'
< bvr> rcurtin: Here is the verbose output:
< bvr> rcurtin: data.n_rows: 1, data.n_cols: 7
< bvr> 1.0000 2.0000 -3.0000 -1.5000 8.0000 7.0000 4.0000
< bvr>
< bvr> responses.n_rows: 1, responses.n_cols: 7
< bvr> 1.0000 2.0000 -3.0000 -1.5000 8.0000 7.0000 4.0000
< bvr>
< bvr>
< bvr> error: Mat::init(): requested size is not compatible with column vector layout
< bvr> terminate called after throwing an instance of 'std::logic_error'
< bvr>
< bvr> I looked into the code for linear_regression_main.cpp, the source for cli tool mlpack_linear_regression, and found the following interesting part:
< bvr> if (!CLI::HasParam("training_responses"))
< bvr> {
< bvr> // The initial predictors for y, Nx1.
< bvr> responses = regressors.row(regressors.n_rows - 1);
< bvr> regressors.shed_row(regressors.n_rows - 1);
< bvr> }
< bvr>
< bvr> And later call to training:
< bvr> Timer::Start("regression");
< bvr> lr = LinearRegression(regressors, responses);
< bvr> Timer::Stop("regression");
< bvr>
< bvr> So effectively, I am doing the same thing, except for loading the data, which in case of cli comes from a file, and I hardcode it with a string. Do you see some inconsistencies between the two cases here:
< bvr> Case 1: Loading a row major data from csv
< bvr> regressors = std::move(CLI::GetParam<mat>("training"));
< bvr>
< bvr> Case 2: Initializing a matrix from string:
< bvr> arma::mat input(
< bvr> "1 2 -3 -1.5 8 7 4;"
< bvr> "1 2 -3 -1.5 8 7 4");
< bvr>
sumedhghaisas has joined #mlpack
kris1 has joined #mlpack
sumedhghaisas has quit [Ping timeout: 240 seconds]
kris1 has quit [Quit: kris1]
kris1 has joined #mlpack
kris1 has quit [Client Quit]
kris1 has joined #mlpack
< zoq> bvr: I'll take a look at the code once I get a chance, in the meantime the code here: https://github.com/mlpack/mlpack/blob/master/src/mlpack/tests/linear_regression_test.cpp#L92 might be helpful
kris1 has quit [Quit: kris1]
partobs-mdp has joined #mlpack
< partobs-mdp> zoq: I've also resolved the last compiler error - read-only "t++". (THe solution was to do this->t++) Now working on running all this stuff :)
kris1 has joined #mlpack
bvr has quit [Remote host closed the connection]
< partobs-mdp> zoq: By the way, could you explain the difference between Evaluate() and Forward()?
< partobs-mdp> And how do I test hamUnit.Forward(input, output);? The compiler crashes with the message: error: cannot bind ‘arma::mat {aka arma::Mat<double>}’ lvalue to ‘arma::mat&& {aka arma::Mat<double>&&}’
< partobs-mdp> (I made it temporarily public)
< zoq> The Evaluate function is bascially only used by the optimizer, which expects that each optimizee implements a function that takes the parameter and index of the current sample to be optimized; internally Evaluate will call the Forward function.
< zoq> Forward takes an r-value, so you should use hamUnit.Forward(std::move(input), std::move(output)).
< partobs-mdp> zoq: Then what's the difference between Forward and Predict?
< partobs-mdp> By the way, I've finally found the true reason for "t++" crash - it's not OK for Attention() to be a const method
< partobs-mdp> (At least, now everything compiles - now checking that I've got the attention mechanism right - that's where I need the "blind" SEARCH function (const 1/3)
< zoq> Right now Forward takes a single input and returns the output, Predict can work on more than one sample, it's basically a for loop around Forward; we are working on supporting "real" batches, which would eliminate the extra function.
< zoq> Ah, haven't looked into the fix yet, fixing such issues is often time consuming and frustrating ...
< partobs-mdp> Attention:
< partobs-mdp> 0.1111
< partobs-mdp> 0.2222
< partobs-mdp> 0.2222
< partobs-mdp> 0.4444
< partobs-mdp> At least this one is right :)
< zoq> :)
bvr has joined #mlpack
< partobs-mdp> zoq: Now the Predict phase gives some sensible values - I didn't check them yet, but at least they don't look flat-out crazy and inconsistent :)
< partobs-mdp> Now pushing
< partobs-mdp> zoq: Could you (independently from me - just to be 100% sure that we're doing forward pass correctly) check that the HAMUnit outputs correct values in the HAM test
vivekp has quit [Ping timeout: 255 seconds]
< partobs-mdp> (Starting from arma::eye(4, 4) sequence and SEARCH = 1 / 3, thus giving [1/9, 2/9, 2/9, 4/9] attention at every timestep)
< bvr> zoq: I was earlier using mlpack v2.2.2 But I downloaded and recompiled mlpack v2.2.4, and linked my program against mlpack v2.2.4. And it worked all fine. No more errors.
< bvr>
< bvr> The output is:
< bvr> -1.6842e-15
< bvr> 1.0000e+00
< bvr>
< bvr> Thanks all. esp zoq, rcurtin
vivekp has joined #mlpack
< zoq> bvr: Ah, great that you figured it out.
< zoq> partobs-mdp: Sure, but probably not before tomorrow.
< partobs-mdp> zoq: Ok, I'll need about the same amount of time - so thanks in advance :)
partobs-mdp has quit [Quit: Leaving]
kris1 has quit [Quit: kris1]
kris1 has joined #mlpack
kris1 has quit [Quit: kris1]
govg has quit [Ping timeout: 240 seconds]
govg has joined #mlpack
govg has quit [Ping timeout: 240 seconds]
kris1 has joined #mlpack
kris1 has quit [Quit: kris1]