Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
java-wowa-training
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-wowa-training
Commits
9e2abf97
Commit
9e2abf97
authored
5 years ago
by
a.croix
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring
parent
e0b848d6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/be/cylab/java/wowa/training/Example.java
+1
-3
1 addition, 3 deletions
src/main/java/be/cylab/java/wowa/training/Example.java
src/main/java/be/cylab/java/wowa/training/Utils.java
+8
-8
8 additions, 8 deletions
src/main/java/be/cylab/java/wowa/training/Utils.java
with
9 additions
and
11 deletions
src/main/java/be/cylab/java/wowa/training/Example.java
+
1
−
3
View file @
9e2abf97
package
be.cylab.java.wowa.training
;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.SimpleFormatter
;
...
...
@@ -20,9 +19,8 @@ public final class Example {
* Run algorithm with webshell dataset.
*
* @param args
* @throws IOException if input files cannot be read
*/
public
static
void
main
(
final
String
[]
args
)
throws
IOException
{
public
static
void
main
(
final
String
[]
args
)
{
int
population_size
=
Integer
.
parseInt
(
args
[
0
]);
int
crossover_rate
=
Integer
.
parseInt
(
args
[
1
]);
int
mutation_rate
=
Integer
.
parseInt
(
args
[
2
]);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/be/cylab/java/wowa/training/Utils.java
+
8
−
8
View file @
9e2abf97
...
...
@@ -33,7 +33,7 @@ final class Utils {
* @param weights
* @return
*/
public
static
List
<
Double
>
normalizeWeights
(
final
List
<
Double
>
weights
)
{
static
List
<
Double
>
normalizeWeights
(
final
List
<
Double
>
weights
)
{
Double
sum_weight
=
Utils
.
sumListElements
(
weights
);
List
<
Double
>
weights_normalized
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
weights
.
size
();
i
++)
{
...
...
@@ -48,7 +48,7 @@ final class Utils {
* @param solutions
* @return
*/
public
static
double
findMaxDistance
(
static
double
findMaxDistance
(
final
List
<
AbstractSolution
>
solutions
)
{
double
max
=
Double
.
NEGATIVE_INFINITY
;
for
(
AbstractSolution
solution
:
solutions
)
{
...
...
@@ -65,7 +65,7 @@ final class Utils {
* @param solutions
* @return
*/
public
static
double
findMinDistance
(
static
double
findMinDistance
(
final
List
<
AbstractSolution
>
solutions
)
{
double
min
=
Double
.
POSITIVE_INFINITY
;
for
(
AbstractSolution
solution
:
solutions
)
{
...
...
@@ -82,7 +82,7 @@ final class Utils {
* @param solutions
* @return
*/
public
static
double
sumTotalDistance
(
static
double
sumTotalDistance
(
final
List
<
AbstractSolution
>
solutions
)
{
double
sum
=
0
;
for
(
AbstractSolution
solution
:
solutions
)
{
...
...
@@ -97,7 +97,7 @@ final class Utils {
* @param array
* @return
*/
public
static
Double
sumListElements
(
final
List
<
Double
>
array
)
{
static
Double
sumListElements
(
final
List
<
Double
>
array
)
{
Double
sum
=
0.0
;
for
(
Double
weight
:
array
)
{
sum
+=
weight
;
...
...
@@ -112,7 +112,7 @@ final class Utils {
* @param max
* @return
*/
public
static
int
randomInteger
(
final
int
min
,
final
int
max
)
{
static
int
randomInteger
(
final
int
min
,
final
int
max
)
{
if
(
min
>=
max
)
{
throw
new
IllegalArgumentException
(
"Max must be greater then min"
);
}
...
...
@@ -126,7 +126,7 @@ final class Utils {
* @param filename
* @return
*/
public
static
List
<
List
<
Double
>>
convertJsonToDataForTrainer
(
static
List
<
List
<
Double
>>
convertJsonToDataForTrainer
(
final
String
filename
)
{
Genson
genson
=
new
Genson
();
String
data_json
=
Utils
.
readFileToString
(
filename
);
...
...
@@ -143,7 +143,7 @@ final class Utils {
* @param filename
* @return
*/
public
static
List
<
Double
>
convertJsonToExpectedForTrainer
(
static
List
<
Double
>
convertJsonToExpectedForTrainer
(
final
String
filename
)
{
Genson
genson
=
new
Genson
();
...
...
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