Spaces:
Sleeping
Sleeping
bintangyosua
commited on
Upload 25 files
Browse files- app.py +28 -20
- history/history_model_8719.pkl +3 -0
- history/history_model_8781.pkl +2 -2
- history/history_model_8812.pkl +3 -0
- models/model_8719.keras +0 -0
- models/model_8781.keras +0 -0
- models/model_8812.keras +0 -0
- requirements.txt +22 -22
app.py
CHANGED
@@ -31,9 +31,12 @@ def __(form, mo, try_predict):
|
|
31 |
|
32 |
@app.cell(hide_code=True)
|
33 |
def __():
|
|
|
|
|
34 |
import marimo as mo
|
35 |
import pandas as pd
|
36 |
import numpy as np
|
|
|
37 |
|
38 |
import matplotlib.pyplot as plt
|
39 |
import seaborn as sns
|
@@ -60,6 +63,8 @@ def __():
|
|
60 |
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
61 |
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping
|
62 |
from sklearn.model_selection import train_test_split
|
|
|
|
|
63 |
|
64 |
import nltk
|
65 |
|
@@ -84,13 +89,18 @@ def __():
|
|
84 |
Word2Vec,
|
85 |
WordCloud,
|
86 |
WordNetLemmatizer,
|
|
|
87 |
alt,
|
|
|
|
|
88 |
mo,
|
89 |
nltk,
|
90 |
np,
|
|
|
91 |
pad_sequences,
|
92 |
pd,
|
93 |
plt,
|
|
|
94 |
re,
|
95 |
sns,
|
96 |
stopwords,
|
@@ -162,7 +172,7 @@ def __():
|
|
162 |
return issue_type_mapping, label_mapping
|
163 |
|
164 |
|
165 |
-
@app.cell
|
166 |
def __(issue_type_mapping, label_mapping):
|
167 |
label_mapping_reversed = {v: k for k, v in label_mapping.items()}
|
168 |
issue_type_mapping_reversed = {v: k for k, v in issue_type_mapping.items()}
|
@@ -193,7 +203,7 @@ def __(df, issue_type_mapping_reversed, label_mapping_reversed, mo):
|
|
193 |
return issue_types_grouped, labels_grouped
|
194 |
|
195 |
|
196 |
-
@app.cell
|
197 |
def __(df):
|
198 |
df.iloc[:, :6].head(7)
|
199 |
return
|
@@ -336,8 +346,8 @@ def __(np):
|
|
336 |
@app.cell(hide_code=True)
|
337 |
def __(FastText, Word2Vec, processed_statement):
|
338 |
embedding_models = {
|
339 |
-
'fasttext': FastText(sentences=processed_statement, vector_size=100, window=3, min_count=1, seed=0),
|
340 |
-
'word2vec': Word2Vec(sentences=processed_statement, vector_size=100, window=3, min_count=1, seed=0)
|
341 |
}
|
342 |
return (embedding_models,)
|
343 |
|
@@ -444,8 +454,8 @@ def __(fasttext_plot, mo):
|
|
444 |
|
445 |
|
446 |
@app.cell(hide_code=True)
|
447 |
-
def __(
|
448 |
-
word2vec_table =
|
449 |
word2vec_chart = mo.vstack([
|
450 |
word2vec_plot,
|
451 |
word2vec_table
|
@@ -532,6 +542,11 @@ def __():
|
|
532 |
|
533 |
@app.cell(hide_code=True)
|
534 |
def __():
|
|
|
|
|
|
|
|
|
|
|
535 |
# clf_model = Sequential()
|
536 |
# clf_model.add(Bidirectional(tf.keras.layers.GRU(64,
|
537 |
# activation='relu',
|
@@ -558,18 +573,18 @@ def __():
|
|
558 |
|
559 |
@app.cell(hide_code=True)
|
560 |
def __():
|
561 |
-
# clf_model.save('models/
|
562 |
-
# joblib.dump(model_history, 'history/
|
563 |
return
|
564 |
|
565 |
|
566 |
@app.cell(hide_code=True)
|
567 |
-
def __(
|
568 |
-
loaded_model = tf.keras.models.load_model('models/model_8781.keras')
|
569 |
-
model_history_loaded = joblib.load('history/history_model_8781.pkl')
|
570 |
|
571 |
-
|
572 |
-
|
573 |
return loaded_model, model_history_loaded
|
574 |
|
575 |
|
@@ -620,13 +635,6 @@ def __(X_test, loaded_model, np):
|
|
620 |
return (y_pred,)
|
621 |
|
622 |
|
623 |
-
@app.cell(hide_code=True)
|
624 |
-
def __():
|
625 |
-
from sklearn.metrics import accuracy_score, classification_report
|
626 |
-
import joblib
|
627 |
-
return accuracy_score, classification_report, joblib
|
628 |
-
|
629 |
-
|
630 |
@app.cell(hide_code=True)
|
631 |
def __(accuracy_score, mo, y_pred, y_test):
|
632 |
mo.md(f"Accuracy score: **{round(accuracy_score(y_test, y_pred) * 100, 2)}**%")
|
|
|
31 |
|
32 |
@app.cell(hide_code=True)
|
33 |
def __():
|
34 |
+
import os
|
35 |
+
|
36 |
import marimo as mo
|
37 |
import pandas as pd
|
38 |
import numpy as np
|
39 |
+
import random
|
40 |
|
41 |
import matplotlib.pyplot as plt
|
42 |
import seaborn as sns
|
|
|
63 |
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
64 |
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping
|
65 |
from sklearn.model_selection import train_test_split
|
66 |
+
from sklearn.metrics import accuracy_score, classification_report
|
67 |
+
import joblib
|
68 |
|
69 |
import nltk
|
70 |
|
|
|
89 |
Word2Vec,
|
90 |
WordCloud,
|
91 |
WordNetLemmatizer,
|
92 |
+
accuracy_score,
|
93 |
alt,
|
94 |
+
classification_report,
|
95 |
+
joblib,
|
96 |
mo,
|
97 |
nltk,
|
98 |
np,
|
99 |
+
os,
|
100 |
pad_sequences,
|
101 |
pd,
|
102 |
plt,
|
103 |
+
random,
|
104 |
re,
|
105 |
sns,
|
106 |
stopwords,
|
|
|
172 |
return issue_type_mapping, label_mapping
|
173 |
|
174 |
|
175 |
+
@app.cell(hide_code=True)
|
176 |
def __(issue_type_mapping, label_mapping):
|
177 |
label_mapping_reversed = {v: k for k, v in label_mapping.items()}
|
178 |
issue_type_mapping_reversed = {v: k for k, v in issue_type_mapping.items()}
|
|
|
203 |
return issue_types_grouped, labels_grouped
|
204 |
|
205 |
|
206 |
+
@app.cell(hide_code=True)
|
207 |
def __(df):
|
208 |
df.iloc[:, :6].head(7)
|
209 |
return
|
|
|
346 |
@app.cell(hide_code=True)
|
347 |
def __(FastText, Word2Vec, processed_statement):
|
348 |
embedding_models = {
|
349 |
+
'fasttext': FastText(sentences=processed_statement, vector_size=100, window=3, min_count=1, seed=0, workers=1),
|
350 |
+
'word2vec': Word2Vec(sentences=processed_statement, vector_size=100, window=3, min_count=1, seed=0, workers=1)
|
351 |
}
|
352 |
return (embedding_models,)
|
353 |
|
|
|
454 |
|
455 |
|
456 |
@app.cell(hide_code=True)
|
457 |
+
def __(mo, word2vec_plot):
|
458 |
+
word2vec_table = word2vec_plot.value[['statement', 'label_text', 'issue_type_text']]
|
459 |
word2vec_chart = mo.vstack([
|
460 |
word2vec_plot,
|
461 |
word2vec_table
|
|
|
542 |
|
543 |
@app.cell(hide_code=True)
|
544 |
def __():
|
545 |
+
# seed_value = 345
|
546 |
+
# np.random.seed(seed_value)
|
547 |
+
# random.seed(seed_value)
|
548 |
+
# tf.random.set_seed(seed_value)
|
549 |
+
|
550 |
# clf_model = Sequential()
|
551 |
# clf_model.add(Bidirectional(tf.keras.layers.GRU(64,
|
552 |
# activation='relu',
|
|
|
573 |
|
574 |
@app.cell(hide_code=True)
|
575 |
def __():
|
576 |
+
# clf_model.save('models/model_8719.keras')
|
577 |
+
# joblib.dump(model_history, 'history/history_model_8719.pkl')
|
578 |
return
|
579 |
|
580 |
|
581 |
@app.cell(hide_code=True)
|
582 |
+
def __(clf_model, model_history):
|
583 |
+
# loaded_model = tf.keras.models.load_model('models/model_8781.keras')
|
584 |
+
# model_history_loaded = joblib.load('history/history_model_8781.pkl')
|
585 |
|
586 |
+
loaded_model = clf_model
|
587 |
+
model_history_loaded = model_history
|
588 |
return loaded_model, model_history_loaded
|
589 |
|
590 |
|
|
|
635 |
return (y_pred,)
|
636 |
|
637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
@app.cell(hide_code=True)
|
639 |
def __(accuracy_score, mo, y_pred, y_test):
|
640 |
mo.md(f"Accuracy score: **{round(accuracy_score(y_test, y_pred) * 100, 2)}**%")
|
history/history_model_8719.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d3daad10fd31b82222443095e07d377da35c03b5bbd91bf83555c2f9d1a775b
|
3 |
+
size 804041
|
history/history_model_8781.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a9e877861152f54a2c5a1372a3d00c53d50e4ea24153ccc0d366a7fee3af6a79
|
3 |
+
size 804041
|
history/history_model_8812.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a12c4820211896df8afa2345f2f122fec1dfd8b86f309f59634623ee0d69f546
|
3 |
+
size 804027
|
models/model_8719.keras
ADDED
Binary file (799 kB). View file
|
|
models/model_8781.keras
CHANGED
Binary files a/models/model_8781.keras and b/models/model_8781.keras differ
|
|
models/model_8812.keras
ADDED
Binary file (799 kB). View file
|
|
requirements.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
marimo==0.9.15
|
2 |
-
pandas==1.5.3
|
3 |
-
numpy==1.24.2
|
4 |
-
scipy==1.10.1
|
5 |
-
pyarrow==16.1.0
|
6 |
-
|
7 |
-
matplotlib==3.7.1
|
8 |
-
seaborn==0.12.2
|
9 |
-
altair==5.3.0
|
10 |
-
|
11 |
-
umap-learn==0.5.7
|
12 |
-
|
13 |
-
gensim==4.3.3
|
14 |
-
scikit-learn>=0.22
|
15 |
-
tensorflow==2.16.1
|
16 |
-
wordcloud==1.9.3
|
17 |
-
nltk==3.8.1
|
18 |
-
|
19 |
-
# Or a specific version
|
20 |
-
# marimo>=0.9.0
|
21 |
-
|
22 |
-
# Add other dependencies as needed
|
|
|
1 |
+
marimo==0.9.15
|
2 |
+
pandas==1.5.3
|
3 |
+
numpy==1.24.2
|
4 |
+
scipy==1.10.1
|
5 |
+
pyarrow==16.1.0
|
6 |
+
|
7 |
+
matplotlib==3.7.1
|
8 |
+
seaborn==0.12.2
|
9 |
+
altair==5.3.0
|
10 |
+
|
11 |
+
umap-learn==0.5.7
|
12 |
+
|
13 |
+
gensim==4.3.3
|
14 |
+
scikit-learn>=0.22
|
15 |
+
tensorflow==2.16.1
|
16 |
+
wordcloud==1.9.3
|
17 |
+
nltk==3.8.1
|
18 |
+
|
19 |
+
# Or a specific version
|
20 |
+
# marimo>=0.9.0
|
21 |
+
|
22 |
+
# Add other dependencies as needed
|