From 89006354f6da4cb3cdd606fbdee6b7506394e9a5 Mon Sep 17 00:00:00 2001 From: lambday Date: Mon, 21 Mar 2016 04:06:45 +0530 Subject: [PATCH] documentation and code-style changes --- .../internals/BlockwiseDetails.cpp | 41 +++++++---- .../experimental/internals/BlockwiseDetails.h | 69 ++++++++++++++---- .../experimental/internals/DataFetcher.h | 36 ++++++--- .../experimental/internals/Features.h | 56 -------------- .../experimental/internals/TestTypes.h | 73 ++++++++++++------- 5 files changed, 154 insertions(+), 121 deletions(-) delete mode 100644 src/shogun/statistics/experimental/internals/Features.h diff --git a/src/shogun/statistics/experimental/internals/BlockwiseDetails.cpp b/src/shogun/statistics/experimental/internals/BlockwiseDetails.cpp index 64f061a201d..7efe828385f 100644 --- a/src/shogun/statistics/experimental/internals/BlockwiseDetails.cpp +++ b/src/shogun/statistics/experimental/internals/BlockwiseDetails.cpp @@ -1,19 +1,31 @@ /* - * Restructuring Shogun's statistical hypothesis testing framework. - * Copyright (C) 2016 Soumyajit De + * Copyright (c) The Shogun Machine Learning Toolbox + * Written (w) 2016 Soumyajit De + * All rights reserved. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of the Shogun Development Team. */ #include @@ -21,9 +33,8 @@ using namespace shogun; using namespace internal; -BlockwiseDetails::BlockwiseDetails() -: m_blocksize(0), m_num_blocks_per_burst(1), m_max_num_samples_per_burst(0), - m_next_block_index(0), m_total_num_blocks(0) +BlockwiseDetails::BlockwiseDetails() : m_blocksize(0), m_num_blocks_per_burst(1), + m_max_num_samples_per_burst(0), m_next_block_index(0), m_total_num_blocks(0) { } diff --git a/src/shogun/statistics/experimental/internals/BlockwiseDetails.h b/src/shogun/statistics/experimental/internals/BlockwiseDetails.h index 546eaa1f1b2..8f742028974 100644 --- a/src/shogun/statistics/experimental/internals/BlockwiseDetails.h +++ b/src/shogun/statistics/experimental/internals/BlockwiseDetails.h @@ -1,19 +1,31 @@ /* - * Restructuring Shogun's statistical hypothesis testing framework. - * Copyright (C) 2016 Soumyajit De + * Copyright (c) The Shogun Machine Learning Toolbox + * Written (w) 2016 Soumyajit De + * All rights reserved. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of the Shogun Development Team. */ #include @@ -27,21 +39,52 @@ namespace shogun namespace internal { +/** + * @brief Class that holds block-details for the data-fetchers. + * There are one instance of this class per fetcher. + */ class BlockwiseDetails { friend class DataFetcher; friend class StreamingDataFetcher; friend class DataManager; + public: + + /** + * Default constructor. + */ BlockwiseDetails(); + + /** + * Method that sets the blocksize for current fetcher. + * @param blocksize the size of the block + * @return an instance of the current object + */ BlockwiseDetails& with_blocksize(index_t blocksize); + + /** + * Method that sets the number of blocks to be fetched per burst for current fetcher. + * @param num_blocks_per_burst the number of blocks to be fetched per burst + * @return an instance of the current object + */ BlockwiseDetails& with_num_blocks_per_burst(index_t num_blocks_per_burst); + private: + + /** The size of the blocks */ index_t m_blocksize; + + /** The number of blocks fetched per burst */ index_t m_num_blocks_per_burst; + + /** The maximum number of samples fetched per burst */ index_t m_max_num_samples_per_burst; - // the following will be set by data fetchers + + /** Index for the next block to be fetched. Set by data fetchers */ index_t m_next_block_index; + + /** Total number of blocks to be fetched. Set by data fetchers */ index_t m_total_num_blocks; }; diff --git a/src/shogun/statistics/experimental/internals/DataFetcher.h b/src/shogun/statistics/experimental/internals/DataFetcher.h index 7019c795400..9b2996fbde5 100644 --- a/src/shogun/statistics/experimental/internals/DataFetcher.h +++ b/src/shogun/statistics/experimental/internals/DataFetcher.h @@ -1,19 +1,31 @@ /* - * Restructuring Shogun's statistical hypothesis testing framework. - * Copyright (C) 2016 Soumyajit De + * Copyright (c) The Shogun Machine Learning Toolbox + * Written (w) 2016 Soumyajit De + * All rights reserved. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of the Shogun Development Team. */ #include diff --git a/src/shogun/statistics/experimental/internals/Features.h b/src/shogun/statistics/experimental/internals/Features.h deleted file mode 100644 index c85c1713d35..00000000000 --- a/src/shogun/statistics/experimental/internals/Features.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Restructuring Shogun's statistical hypothesis testing framework. - * Copyright (C) 2014 Soumyajit De - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __FEATURES_H_ -#define __FEATURES_H_ - -#include -#include -#include -#include - -namespace shogun -{ - -namespace internal -{ - -// feat traits - required for proper typecasting -template -struct feats_traits -{ - using type = CFeatures; -}; - -template <> -struct feats_traits -{ - using type = CDenseFeatures; -}; - -template <> -struct feats_traits -{ - using type = CStreamingDenseFeatures; -}; - -} - -} - -#endif // __FEATURES_H_ diff --git a/src/shogun/statistics/experimental/internals/TestTypes.h b/src/shogun/statistics/experimental/internals/TestTypes.h index a3bb282c181..7981002098e 100644 --- a/src/shogun/statistics/experimental/internals/TestTypes.h +++ b/src/shogun/statistics/experimental/internals/TestTypes.h @@ -1,71 +1,94 @@ /* - * Restructuring Shogun's statistical hypothesis testing framework. - * Copyright (C) 2016 Soumyajit De + * Copyright (c) The Shogun Machine Learning Toolbox + * Written (w) 2016 Soumyajit De + * All rights reserved. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of the Shogun Development Team. */ #ifndef TEST_TYPES_H__ #define TEST_TYPES_H__ -#include -#include - namespace shogun { -class CFeatures; - namespace internal { -struct TwoSampleTestPermutationPolicy; -struct IndependenceTestPermutationPolicy; - +/** + * @brief Meta test-type for 1-distribution statistical tests. + */ struct OneDistributionTest { + /** defines the number of feature objects required */ enum { num_feats = 1 }; }; +/** + * @brief Meta test-type for 2-distribution statistical tests. + */ struct TwoDistributionTest { + /** defines the number of feature objects required */ enum { num_feats = 2 }; }; +/** + * @brief Meta test-type for 3-distribution statistical tests. + */ struct ThreeDistributionTest { + /** defines the number of feature objects required */ enum { num_feats = 3 }; }; +/** + * @brief Meta test-type for goodness-of-fit test. + */ struct GoodnessOfFitTest : OneDistributionTest { + /** defines the number of kernel objects required */ enum { num_kernels = 1 }; - using return_type = std::shared_ptr; }; +/** + * @brief Meta test-type for two-sample test. + */ struct TwoSampleTest : TwoDistributionTest { + /** defines the number of kernel objects required */ enum { num_kernels = 1 }; - using permutation_policy = TwoSampleTestPermutationPolicy; - using return_type = std::shared_ptr; }; +/** + * @brief Meta test-type for independence test. + */ struct IndependenceTest : TwoDistributionTest { + /** defines the number of kernel objects required */ enum { num_kernels = 2 }; - using permutation_policy = IndependenceTestPermutationPolicy; - using return_type = std::vector>; }; }