Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-103
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-103
2021-103
Commits
17b9c71c
Commit
17b9c71c
authored
Nov 25, 2021
by
Karunathilake K. K. H. - IT18152456
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
ee81de62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
FAMS/ROC/IROCBuilder.cs
FAMS/ROC/IROCBuilder.cs
+95
-0
No files found.
FAMS/ROC/IROCBuilder.cs
0 → 100644
View file @
17b9c71c
/*
* Created by: Miguel Angel Medina Prez (miguel.medina.perez@gmail.com)
* Created:
* Comments by: Miguel Angel Medina Prez (miguel.medina.perez@gmail.com)
*/
using
System.Collections.Generic
;
namespace
PatternRecognition.ROC
{
/// <summary>
/// Represents a point in the ROC curve.
/// </summary>
public
struct
ROCPoint
{
/// <summary>
/// The value of the point in the horizontal axis.
/// </summary>
public
double
x
;
/// <summary>
/// The value of the point in the vertical axis.
/// </summary>
public
double
y
;
public
double
matchingValue
;
/// <summary>
/// Initialize a point with the specified values of horizontal and vertical axis.
/// </summary>
/// <param name="x">
/// The value of the new point in the horizontal axis.
/// </param>
/// <param name="y">
/// The value of the new point in the vertical axis.
/// </param>
public
ROCPoint
(
double
x
,
double
y
,
double
matchingValue
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
matchingValue
=
matchingValue
;
}
}
/// <summary>
/// Represents an algorithm to build ROC curves.
/// </summary>
public
interface
IROCBuilder
{
/// <summary>
/// Build a ROC curve from the specified matching scores and score comparer.
/// </summary>
/// <param name="sameClassScores">
/// A collection containing the matching scores of objects in the same class.
/// </param>
/// <param name="diffClassScores">
/// A collection containing the matching scores of objects in different class.
/// </param>
/// <param name="scoreComparer">
/// A comparer for matching scores.
/// </param>
/// <returns>
/// The points that compose the ROC curve.
/// </returns>
List
<
ROCPoint
>
BuildROC
(
ICollection
<
double
>
sameClassScores
,
ICollection
<
double
>
diffClassScores
,
IComparer
<
double
>
scoreComparer
);
}
internal
enum
MatchingType
{
Positive
,
Negative
}
;
internal
struct
MatchingResult
{
internal
MatchingType
Type
;
internal
double
ComparissonValue
;
internal
MatchingResult
(
MatchingType
type
,
double
dissimilarity
)
{
Type
=
type
;
ComparissonValue
=
dissimilarity
;
}
}
internal
class
MatchingResultComparer
:
Comparer
<
MatchingResult
>
{
public
override
int
Compare
(
MatchingResult
x
,
MatchingResult
y
)
{
int
value
=
ValuesComparer
.
Compare
(
x
.
ComparissonValue
,
y
.
ComparissonValue
);
return
value
==
0
?
((
x
.
Type
==
MatchingType
.
Negative
)
?
-
1
:
1
)
:
value
;
}
internal
IComparer
<
double
>
ValuesComparer
{
set
;
get
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment