Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP-IA-Syntax-Error
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
VIGEOLAS-CHOURY Paul
TP-IA-Syntax-Error
Commits
61bdf118
Commit
61bdf118
authored
4 months ago
by
titouan
Browse files
Options
Downloads
Patches
Plain Diff
Méthode computePredictionFile corrigée avec les +1
parent
1b1c5360
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
TP.py
+6
-3
6 additions, 3 deletions
TP.py
with
6 additions
and
3 deletions
TP.py
+
6
−
3
View file @
61bdf118
...
...
@@ -5,7 +5,6 @@ import pandas as pd
import
numpy
as
np
from
sklearn.metrics
import
accuracy_score
from
sklearn.model_selection
import
train_test_split
from
sklearn.naive_bayes
import
GaussianNB
def
buildSampleFromPath
(
path1
,
path2
,
size
=
0
):
...
...
@@ -151,7 +150,11 @@ def computePredictionFile(classifier):
for
image
in
S
:
image_name
=
os
.
path
.
split
(
image
[
"
name_path
"
])[
1
]
file
.
write
(
image_name
+
"
"
+
str
(
image
[
"
y_predicted_class
"
])
+
"
\n
"
)
if
image
[
"
y_predicted_class
"
]
==
1
:
image_predicted_class
=
"
+1
"
else
:
image_predicted_class
=
"
-1
"
file
.
write
(
image_name
+
"
"
+
image_predicted_class
+
"
\n
"
)
file
.
write
(
"
# EE =
"
+
str
(
computeError
(
S_train
))
+
"
\n
"
)
file
.
write
(
"
# ER =
"
+
str
(
computeError
(
S_test
))
+
"
\n
"
)
...
...
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