src/FitnessFunctions.cpp
MatrixBO EchoBay::Comparator::get_targetMatrix(const Eigen::Ref<const MatrixBO> label, const Eigen::Ref<const ArrayI8> sampleState)
{
    if (_problemType == "Classification")
    {
        // realOut equals label in classification
        // Count classes
        get_nClasses(label);

        // Resize targetMatrix
        _targetMatrix.resize(label.rows(), _nClasses);

        // Assign labels
        one_hot_encoding(_targetMatrix, label);
    }
    else // Regression and Memory Capacity
    {
        // Count columns of output
        _outCols = label.cols();

        // Copy data in realOut
        MatrixBO realOut(sampleState.count(), _outCols);
        int outRows = 0;
        for (int s = 0; s < sampleState.rows(); s++)
        {
            if (sampleState(s) != 0)
            {
                realOut.row(outRows) = label.row(s);
                outRows++;
            }
        }

        // Resize targetMatrix
        _targetMatrix.resize(realOut.rows(), _outCols);
        _targetMatrix.setZero(); // TODO Is this necessary
        // Assign label
        _targetMatrix = realOut;
    }

    return _targetMatrix;
}
/**
 * @brief Transform the training targetMatrix according to the problemType
 * 
 * Classification problems use the same label and then perform one-hot encoding
 * Regression and MemoryCapacity problems resize targetLabel and manage washout samples
 * 
 * @param label Eigen Matrix containing the desired target label
 * @param sampleState Eigen Array containing the sampling index to manage ESN washout
 * see also EchoBay::DataStorage::set_sampleArray(Eigen::Ref<MatrixBO> samplingData, int nWashout, bool init_flag, const std::string &problemType, const std::string type)
 * @return MatrixBO Problem dependent target matrix used for readout calculation
 * see also MatrixBO EchoBay::Wout_ridge(int rows, int cols, double lambda, Eigen::Ref<MatrixBO> biasedState, Eigen::Ref<MatrixBO> target)
 */
@brief Transform the training targetMatrix according to the problemType

Classification problems use the same label and then perform one-hot encoding
Regression and MemoryCapacity problems resize targetLabel and manage washout samples


@brief Transform the training targetMatrix according to the problemType Classification problems use the same label and then perform one - hot encoding Regression and MemoryCapacity problems resize targetLabel and manage washout samples
MatrixBO EchoBay::Comparator::get_targetMatrix(const Eigen::Ref<const MatrixBO> label, const Eigen::Ref<const ArrayI8> sampleState)
{
    if (_problemType == "Classification")
    {
        get_nClasses(label);
        _targetMatrix.resize(label.rows(), _nClasses);
        one_hot_encoding(_targetMatrix, label);
    }
    else 
    {
        _outCols = label.cols();
        MatrixBO realOut(sampleState.count(), _outCols);
        int outRows = 0;
        for (int s = 0; s < sampleState.rows(); s++)
        {
            if (sampleState(s) != 0)
            {
                realOut.row(outRows) = label.row(s);
                outRows++;
            }
        }
        _targetMatrix.resize(realOut.rows(), _outCols);
        _targetMatrix.setZero(); 
        _targetMatrix = realOut;
    }
    return _targetMatrix;
}
MatrixBO EchoBay :: Comparator :: get_targetMatrix ( const Eigen :: Ref < const MatrixBO > label , const Eigen :: Ref < const ArrayI8 > sampleState ) { if ( _problemType == " " ) { get_nClasses ( label ) ; _targetMatrix . resize ( label . rows ( ) , _nClasses ) ; one_hot_encoding ( _targetMatrix , label ) ; } else { _outCols = label . cols ( ) ; MatrixBO realOut ( sampleState . count ( ) , _outCols ) ; int outRows = 0 ; for ( int s = 0 ; s < sampleState . rows ( ) ; s ++ ) { if ( sampleState ( s ) != 0 ) { realOut . row ( outRows ) = label . row ( s ) ; outRows ++ ; } } _targetMatrix . resize ( realOut . rows ( ) , _outCols ) ; _targetMatrix . setZero ( ) ; _targetMatrix = realOut ; } return _targetMatrix ; }
@brief Transform the training targetMatrix according to the problemType
@brief Transform the training targetMatrix according to the problemType
// realOut equals label in classification // Count classes // Resize targetMatrix // Assign labels // Regression and Memory Capacity // Count columns of output // Copy data in realOut // Resize targetMatrix // TODO Is this necessary // Assign label