shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

Converting code from 6.1.4 to develop branch #5128

Closed spiovesan closed 3 years ago

spiovesan commented 4 years ago

I am using some example written for Shogun 6.1.4 with the develop branch and I am having some issues. I can handle class name changes, use of shared pointers but some functions look disappeared as SGMatrix<T>::transpose_matrix()and SGMatrix<T>::submatrix(). Is there some documentation how to port the code from 6.1.4 to current branch?

karlnapf commented 4 years ago

Hi Yes that’s gone. All languages that you can use shogun from have that functionality. Which one are you using? In c++ this can be done using e.g. eigen3 If you show some snippets we can give pointers There unfortunately is no guide for porting atm (7.0 not released yet)

spiovesan commented 4 years ago

Hi, this is the code sample I am trying to convert:

    auto csv_file = std::make_shared<CSVFile>(dataset_name.string().c_str());
    Matrix data;
    data.load(csv_file);

    // Exclude cluster and index info from data
    // Shogun csv loader loads matrixes in column major order
    Matrix::transpose_matrix(data.matrix, data.num_rows, data.num_cols);
    Matrix inputs = data.submatrix(1, data.num_cols - 1);  // make a view
    inputs = inputs.clone();                // copy exact data
    Matrix outputs = data.submatrix(3, 4);  // make a view
    outputs = outputs.clone();              // copy exact data

    // Transpose back because shogun algorithms expect that samples are in
    // colums
    Matrix::transpose_matrix(inputs.matrix, inputs.num_rows,
                             inputs.num_cols);

I am trying to use this booksample code. I think I will hit hard on something else...

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue is now being closed due to a lack of activity. Feel free to reopen it.