github-actions commited on
Commit
5c4388c
·
1 Parent(s): 9ccd218

Update model + app from GitHub Actions

Browse files
model/vectorizer.joblib CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bbcc0212d7ffb1b250a2b12940ffd1a8be6bdcdd9ff96bb061065471e2ce75f0
3
  size 6956
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c3bc32b8b1748519f68b771a6236026f16e6f0f2b4810129e36f777c99ff5fe
3
  size 6956
src/__pycache__/__init__.cpython-39.pyc CHANGED
Binary files a/src/__pycache__/__init__.cpython-39.pyc and b/src/__pycache__/__init__.cpython-39.pyc differ
 
src/__pycache__/preprocessing.cpython-39.pyc CHANGED
Binary files a/src/__pycache__/preprocessing.cpython-39.pyc and b/src/__pycache__/preprocessing.cpython-39.pyc differ
 
src/evaluate.py CHANGED
@@ -35,7 +35,6 @@ def evaluate():
35
  with open("model/eval_report.json", "w") as f:
36
  json.dump({"report": report, "confusion_matrix": cm}, f, indent=2)
37
 
38
- # pilih label target dinamis
39
  target_label = "judi" if "judi" in report else list(report.keys())[0]
40
  summary = {
41
  "accuracy": report["accuracy"],
 
35
  with open("model/eval_report.json", "w") as f:
36
  json.dump({"report": report, "confusion_matrix": cm}, f, indent=2)
37
 
 
38
  target_label = "judi" if "judi" in report else list(report.keys())[0]
39
  summary = {
40
  "accuracy": report["accuracy"],
src/preprocessing.py CHANGED
@@ -7,8 +7,8 @@ import joblib
7
 
8
  def clean_text(text: str) -> str:
9
  text = text.lower()
10
- text = re.sub(r"http\S+|www\S+|https\S+", "", text) # remove urls
11
- text = re.sub(r"\d+", " ", text) # remove digits
12
  text = text.translate(str.maketrans("", "", string.punctuation))
13
  text = re.sub(r"\s+", " ", text).strip()
14
  return text
 
7
 
8
  def clean_text(text: str) -> str:
9
  text = text.lower()
10
+ text = re.sub(r"http\S+|www\S+|https\S+", "", text)
11
+ text = re.sub(r"\d+", " ", text)
12
  text = text.translate(str.maketrans("", "", string.punctuation))
13
  text = re.sub(r"\s+", " ", text).strip()
14
  return text
src/train.py CHANGED
@@ -41,10 +41,8 @@ def train():
41
  with mlflow.start_run():
42
  model.fit(X_train, y_train)
43
 
44
- # predictions
45
  y_pred = model.predict(X_test)
46
 
47
- # metrics
48
  precision, recall, f1, _ = precision_recall_fscore_support(y_test, y_pred, average="binary", pos_label="judi")
49
  acc = accuracy_score(y_test, y_pred)
50
 
@@ -53,7 +51,6 @@ def train():
53
  mlflow.log_metric("f1_score", float(f1))
54
  mlflow.log_metric("accuracy", float(acc))
55
 
56
- # save model
57
  model_path = os.path.join(MODEL_DIR, "saved_model.joblib")
58
  joblib.dump(model, model_path)
59
  mlflow.log_artifact(model_path, artifact_path="models")
 
41
  with mlflow.start_run():
42
  model.fit(X_train, y_train)
43
 
 
44
  y_pred = model.predict(X_test)
45
 
 
46
  precision, recall, f1, _ = precision_recall_fscore_support(y_test, y_pred, average="binary", pos_label="judi")
47
  acc = accuracy_score(y_test, y_pred)
48
 
 
51
  mlflow.log_metric("f1_score", float(f1))
52
  mlflow.log_metric("accuracy", float(acc))
53
 
 
54
  model_path = os.path.join(MODEL_DIR, "saved_model.joblib")
55
  joblib.dump(model, model_path)
56
  mlflow.log_artifact(model_path, artifact_path="models")