Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Topic_modeling
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAFTOUH Mohammed Amine
Topic_modeling
Commits
d2a918bc
Commit
d2a918bc
authored
1 month ago
by
MAFTOUH Mohammed Amine
Browse files
Options
Downloads
Patches
Plain Diff
Update 3 files
- /projet_imt.py - /clustering/mesures_clustering.py - /clustering/agg_clustering.py
parent
a6c44be2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
clustering/agg_clustering.py
+1
-0
1 addition, 0 deletions
clustering/agg_clustering.py
clustering/mesures_clustering.py
+1
-0
1 addition, 0 deletions
clustering/mesures_clustering.py
projet_imt.py
+5
-6
5 additions, 6 deletions
projet_imt.py
with
7 additions
and
6 deletions
clustering/agg_clustering.py
+
1
−
0
View file @
d2a918bc
from
sklearn.cluster
import
AgglomerativeClustering
def
agglomerative_clustering
(
reduced_embeddings
,
n_clusters
):
"""
Applique l
'
Agglomerative Clustering avec un nombre fixe de clusters.
...
...
This diff is collapsed.
Click to expand it.
clustering/mesures_clustering.py
+
1
−
0
View file @
d2a918bc
from
sklearn.metrics
import
silhouette_score
def
compute_silhouette_scores
(
reduced_embeddings
,
labels
):
"""
Calcule les scores de silhouette pour différents nombres de clusters.
...
...
This diff is collapsed.
Click to expand it.
projet_imt.py
+
5
−
6
View file @
d2a918bc
...
...
@@ -8,18 +8,14 @@ from utils.reduction_dimesion import *
import
pandas
as
pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
ast
import
umap
from
sklearn.cluster
import
KMeans
from
sklearn.metrics
import
silhouette_score
from
sklearn.cluster
import
AgglomerativeClustering
from
sklearn.metrics
import
silhouette_score
def
main
():
# lecture du fichier csv
df
=
load
..
...
df
=
pd
.
read_csv
(
"
/Users/mac/Desktop/topic_modeling/df_user_messages_new.csv
"
)
# reduction des dimensions
reduced_embeddings
=
reduce_embeddings
(
df
,
n_components
=
50
,
random_state
=
42
)
# clustering
...
...
@@ -29,6 +25,9 @@ def main():
# afficher les resultats
messages_par_cluster
=
afficher_messages_par_cluster
(
df
,
labels
)
return
messages_par_cluster
if
__name__
==
"
__main__
"
:
main
()
messages_par_cluster
=
main
()
print
(
messages_par_cluster
)
\ No newline at end of file
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