Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
java-roc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
java-roc
Commits
b63cf96a
Commit
b63cf96a
authored
6 years ago
by
a.croix
Browse files
Options
Downloads
Patches
Plain Diff
End fix SpotBugs issues
parent
8479d573
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1501
passed
6 years ago
Stage: leaks
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/be/cylab/java/roc/Point.java
+31
-1
31 additions, 1 deletion
src/main/java/be/cylab/java/roc/Point.java
src/main/java/be/cylab/java/roc/Roc.java
+15
-15
15 additions, 15 deletions
src/main/java/be/cylab/java/roc/Roc.java
with
46 additions
and
16 deletions
src/main/java/be/cylab/java/roc/Point.java
+
31
−
1
View file @
b63cf96a
package
be.cylab.java.roc
;
import
java.util.Objects
;
/**
* Class to represent element.
*/
...
...
@@ -10,7 +12,8 @@ public class Point implements Comparable<Point> {
/**
* Constructor for Point.
* @param score double
*
* @param score double
* @param true_alert boolean
*/
public
Point
(
final
double
score
,
final
boolean
true_alert
)
{
...
...
@@ -29,8 +32,32 @@ public class Point implements Comparable<Point> {
}
}
/**
* @param o
* @return
*/
public
final
boolean
equals
(
final
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(!(
o
instanceof
Point
))
{
return
false
;
}
Point
p
=
(
Point
)
o
;
return
score
==
p
.
score
;
}
/**
* @return
*/
public
final
int
hashCode
()
{
return
Objects
.
hash
(
score
,
true_alert
);
}
/**
* Setter for Score.
*
* @param score
*/
public
final
void
setScore
(
final
double
score
)
{
...
...
@@ -42,6 +69,7 @@ public class Point implements Comparable<Point> {
/**
* Setter for True Alert.
*
* @param true_alert
*/
public
final
void
setTrueAlert
(
final
boolean
true_alert
)
{
...
...
@@ -50,6 +78,7 @@ public class Point implements Comparable<Point> {
/**
* Getter for Score.
*
* @return
*/
public
final
double
getScore
()
{
...
...
@@ -58,6 +87,7 @@ public class Point implements Comparable<Point> {
/**
* Getter for True Alert.
*
* @return
*/
public
final
boolean
isTrueAlert
()
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/be/cylab/java/roc/Roc.java
+
15
−
15
View file @
b63cf96a
...
...
@@ -49,28 +49,28 @@ public class Roc {
*/
public
Roc
(
final
String
file_path
)
{
points
=
new
ArrayList
<>();
CSVReader
reader
=
null
;
CSVReader
reader
;
try
{
reader
=
new
CSVReader
(
new
InputStreamReader
(
new
FileInputStream
(
file_path
),
StandardCharsets
.
UTF_8
));
String
[]
next_record
=
null
;
while
(
true
)
{
try
{
next_record
=
reader
.
readNext
();
if
(!(
next_record
!=
null
))
{
break
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Point
point
=
new
Point
(
Double
.
parseDouble
(
next_record
[
0
]),
Boolean
.
parseBoolean
(
next_record
[
1
]));
points
.
add
(
point
);
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
String
[]
next_record
=
null
;
while
(
true
)
{
try
{
next_record
=
reader
.
readNext
();
if
(!(
next_record
!=
null
))
{
break
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
Point
point
=
new
Point
(
Double
.
parseDouble
(
next_record
[
0
]),
Boolean
.
parseBoolean
(
next_record
[
1
]));
points
.
add
(
point
);
}
Collections
.
sort
(
points
);
positive_examples_number
=
Utils
.
countPositiveExamples
(
this
.
points
);
negative_examples_number
=
Utils
.
countNegativeExamples
(
this
.
points
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment