This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from spectre-team/develop
Master release with wavelet denoising finished
- Loading branch information
Showing
104 changed files
with
4,007 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* InsufficientDataException.cpp | ||
* Throws when data does not cover all classes. | ||
* | ||
Copyright 2018 Spectre Team | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include "InsufficientDataException.h" | ||
|
||
namespace spectre::supervised::exception | ||
{ | ||
InsufficientDataException::InsufficientDataException(Label missingClass): ExceptionBase("Dataset is missing " + std::to_string(missingClass) + " label") {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* InsufficientDataException.h | ||
* Throws when data does not cover all classes. | ||
* | ||
Copyright 2018 Spectre Team | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
#include "Spectre.libException/ExceptionBase.h" | ||
#include "NotABinaryLabelException.h" | ||
|
||
namespace spectre::supervised::exception | ||
{ | ||
/// <summary> | ||
/// Throws when data does not cover all classes. | ||
/// </summary> | ||
class InsufficientDataException final : public core::exception::ExceptionBase | ||
{ | ||
public: | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InsufficientDataException"/> class. | ||
/// </summary> | ||
/// <param name="actual">The missing class .</param> | ||
explicit InsufficientDataException(Label missingClass); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/Spectre.libGaClassifier.Tests/AllLabelTypesIncludedConditionTest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* AllLabelTypesIncludedConditionTest.cpp | ||
* Tests AllLabelTypesIncludedCondition class. | ||
* | ||
Copyright 2018 Spectre Team | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "Spectre.libGaClassifier/AllLabelTypesIncludedCondition.h" | ||
|
||
namespace | ||
{ | ||
using namespace spectre::supervised; | ||
|
||
TEST(AllLabelTypesIncludedConditionInitialization, initializes_with_one_parameter) | ||
{ | ||
const std::vector<spectre::supervised::Label> labels{ true, true, true, true, true }; | ||
EXPECT_NO_THROW(AllLabelTypesIncludedCondition condition(labels)); | ||
} | ||
|
||
class AllLabelTypesIncludedConditionTest : public ::testing::Test | ||
{ | ||
public: | ||
AllLabelTypesIncludedConditionTest() {} | ||
protected: | ||
const spectre::algorithm::genetic::Individual individual = spectre::algorithm::genetic::Individual({ true, true, true, true, false }); | ||
const std::vector<spectre::supervised::Label> allTrueLabels{ true, true, true, true, false }; | ||
const std::vector<spectre::supervised::Label> allFalseLabels{ false, false, false, false, true }; | ||
const std::vector<spectre::supervised::Label> trueFalseLabels{ true, false, true, true, false }; | ||
const std::vector<spectre::supervised::Label> nonBinalyLabels{ 0, 1, 2, 1, 1, 5, 3, 3, 9, 0, 0, 2, 1, 1, 5, 5, 1 }; | ||
const spectre::algorithm::genetic::Individual nonBinaryIndividualThree = | ||
spectre::algorithm::genetic::Individual({ true, false, true, false, false, false, true, true, false, false, false, true, false, false, false, false, false}); | ||
const spectre::algorithm::genetic::Individual nonBinaryIndividualSix = | ||
spectre::algorithm::genetic::Individual({ true, true, true, false, true, false, true, true, true, false, true, true, true, false, true, false, false }); | ||
}; | ||
|
||
TEST_F(AllLabelTypesIncludedConditionTest, return_true_for_correct_label) | ||
{ | ||
AllLabelTypesIncludedCondition condition(trueFalseLabels); | ||
auto result = condition.checkCurrentCondition(individual); | ||
EXPECT_TRUE(result); | ||
} | ||
|
||
TEST_F(AllLabelTypesIncludedConditionTest, return_false_for_only_true_label_individual) | ||
{ | ||
AllLabelTypesIncludedCondition condition(allTrueLabels); | ||
auto result = condition.checkCurrentCondition(individual); | ||
EXPECT_FALSE(result); | ||
} | ||
|
||
TEST_F(AllLabelTypesIncludedConditionTest, return_false_for_only_false_label_individual) | ||
{ | ||
AllLabelTypesIncludedCondition condition(allFalseLabels); | ||
auto result = condition.checkCurrentCondition(individual); | ||
EXPECT_FALSE(result); | ||
} | ||
|
||
TEST_F(AllLabelTypesIncludedConditionTest, return_true_for_non_binary_label) | ||
{ | ||
AllLabelTypesIncludedCondition condition(nonBinalyLabels); | ||
auto result = condition.checkCurrentCondition(nonBinaryIndividualSix); | ||
EXPECT_TRUE(result); | ||
} | ||
|
||
TEST_F(AllLabelTypesIncludedConditionTest, return_false_for_non_binary_label) | ||
{ | ||
AllLabelTypesIncludedCondition condition(nonBinalyLabels); | ||
auto result = condition.checkCurrentCondition(nonBinaryIndividualThree); | ||
EXPECT_FALSE(result); | ||
} | ||
} |
Oops, something went wrong.