Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qbe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
A
Anaïs Halftermeyer
queryByExample
qbe
Commits
484728ec
Commit
484728ec
authored
Jun 30, 2025
by
Elias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Number of words by Bin
parent
0e22dcc6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
TrainValTest8_Random.py
TrainValTest8_Random.py
+39
-0
No files found.
TrainValTest8_Random.py
0 → 100755
View file @
484728ec
import
csv
from
collections
import
defaultdict
import
matplotlib.pyplot
as
plt
input_file
=
"res7_Random.csv"
# Dictionnaire pour compter les lignes par Bin
bin_counts
=
defaultdict
(
int
)
with
open
(
input_file
,
mode
=
"r"
,
newline
=
""
)
as
f
:
reader
=
csv
.
reader
(
f
)
next
(
reader
)
for
row
in
reader
:
bin_value
=
int
(
row
[
4
])
# colonne 'Bin'
bin_counts
[
bin_value
]
+=
1
# Trier les bins
bins
=
sorted
(
bin_counts
.
keys
())
counts
=
[
bin_counts
[
b
]
for
b
in
bins
]
# Création du bar chart
plt
.
figure
(
figsize
=
(
10
,
6
))
bars
=
plt
.
bar
([
str
(
b
)
for
b
in
bins
],
counts
,
color
=
'skyblue'
)
# Ajouter les nombres au-dessus des barres
for
bar
in
bars
:
height
=
bar
.
get_height
()
plt
.
text
(
bar
.
get_x
()
+
bar
.
get_width
()
/
2
,
height
+
0.5
,
str
(
height
),
ha
=
'center'
,
va
=
'bottom'
,
fontsize
=
10
)
plt
.
title
(
"Number of words by Bin"
)
plt
.
xlabel
(
"Bin"
)
plt
.
ylabel
(
"Number of words"
)
plt
.
grid
(
axis
=
'y'
,
linestyle
=
'--'
,
alpha
=
0.7
)
plt
.
tight_layout
()
plt
.
show
()
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