Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis Nasr
macaon2
Commits
631434c5
Commit
631434c5
authored
7 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Improved the way we delete duplicates examples
parent
85818a96
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
maca_common/src/Fann_file.c
+4
-4
4 additions, 4 deletions
maca_common/src/Fann_file.c
maca_trans_parser/src/maca_tm_train.c
+2
-2
2 additions, 2 deletions
maca_trans_parser/src/maca_tm_train.c
with
6 additions
and
6 deletions
maca_common/src/Fann_file.c
+
4
−
4
View file @
631434c5
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
#include
"string.h"
#include
"string.h"
#include
<algorithm>
#include
<algorithm>
#include
<map>
#include
<map>
#include
<set>
Fann_file
::
Fann_file
(
const
char
*
filename
,
unsigned
int
classifier_id
)
Fann_file
::
Fann_file
(
const
char
*
filename
,
unsigned
int
classifier_id
)
{
{
...
@@ -166,7 +165,8 @@ void Fann_file::over_sample(float ratio)
...
@@ -166,7 +165,8 @@ void Fann_file::over_sample(float ratio)
void
Fann_file
::
delete_duplicates
()
void
Fann_file
::
delete_duplicates
()
{
{
std
::
vector
<
unsigned
int
>
new_order
;
std
::
vector
<
unsigned
int
>
new_order
;
std
::
set
<
std
::
string
>
examples
;
std
::
map
<
std
::
string
,
int
>
examples
;
int
max_distance
=
3
;
for
(
int
index
:
order
)
for
(
int
index
:
order
)
{
{
...
@@ -175,10 +175,10 @@ void Fann_file::delete_duplicates()
...
@@ -175,10 +175,10 @@ void Fann_file::delete_duplicates()
for
(
int
feat
:
features
[
index
])
for
(
int
feat
:
features
[
index
])
example
+=
","
+
std
::
to_string
(
feat
);
example
+=
","
+
std
::
to_string
(
feat
);
if
(
examples
.
count
(
example
))
if
(
examples
.
count
(
example
)
&&
(
index
-
examples
[
example
]
<
max_distance
)
)
continue
;
continue
;
examples
.
insert
(
example
)
;
examples
[
example
]
=
index
;
new_order
.
push_back
(
index
);
new_order
.
push_back
(
index
);
}
}
...
...
This diff is collapsed.
Click to expand it.
maca_trans_parser/src/maca_tm_train.c
+
2
−
2
View file @
631434c5
...
@@ -158,8 +158,8 @@ void train_nn(context * ctx)
...
@@ -158,8 +158,8 @@ void train_nn(context * ctx)
Fann_file
fann_train
(
ctx
->
fann_filename
,
classif_nb
);
Fann_file
fann_train
(
ctx
->
fann_filename
,
classif_nb
);
Fann_file
fann_dev
(
ctx
->
fann_dev_filename
,
classif_nb
);
Fann_file
fann_dev
(
ctx
->
fann_dev_filename
,
classif_nb
);
if
(
!
strcmp
(
"TAGGER"
,
classif
->
oracle_name
)
||!
strcmp
(
"PARSER"
,
classif
->
oracle_name
))
fann_train
.
delete_duplicates
();
fann_train
.
delete_duplicates
();
fann_dev
.
delete_duplicates
();
fann_train
.
over_sample
(
0
.
0
);
//The ratio between the nb of examples of the majority class and of the minority class will not be inferior to this value
fann_train
.
over_sample
(
0
.
0
);
//The ratio between the nb of examples of the majority class and of the minority class will not be inferior to this value
auto
first_example_batch
=
fann_train
.
get_batch
(
1
);
auto
first_example_batch
=
fann_train
.
get_batch
(
1
);
...
...
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