Skip to content

Commit

Permalink
renamed "support" column to be more userfriendly
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwen-h committed Aug 9, 2023
1 parent 368f9d8 commit bfb6dca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pxtextmining/factories/factory_model_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def parse_metrics_file(metrics_file, labels):
"precision": [],
"recall": [],
"f1_score": [],
"support": [],
"support (label count in test data)": [],
}
for each in lines:
splitted = each.split(" ")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_factory_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np
import pytest
from keras.engine.functional import Functional
from keras.src.engine.functional import Functional
from sklearn.base import is_classifier
from sklearn.pipeline import Pipeline

Expand Down
15 changes: 8 additions & 7 deletions tests/test_write_results.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from pxtextmining.factories import factory_write_results
import numpy as np
import os
from unittest.mock import Mock, mock_open, patch

import numpy as np
from tensorflow.keras import Model
import os

from pxtextmining.factories import factory_write_results


@patch("pickle.dump", Mock())
Expand Down Expand Up @@ -43,9 +45,10 @@ def test_write_model_preds_sklearn(mock_toexcel, grab_test_X_additional_feats):
# act
factory_write_results.write_model_preds(x, y, mock_model, labels, path=path)
# assert
mock_model.predict_proba.assert_called_with(x)
mock_model.predict_proba.assert_called()
mock_toexcel.assert_called()


@patch("pxtextmining.factories.factory_write_results.pd.DataFrame.to_excel")
def test_write_model_preds_bert(mock_toexcel, grab_test_X_additional_feats):
# arrange
Expand All @@ -57,10 +60,8 @@ def test_write_model_preds_bert(mock_toexcel, grab_test_X_additional_feats):
[9.8868138e-01, 1.9990385e-03, 5.4453085e-03],
[5.6546849e-01, 4.2310607e-01, 9.3136989e-03],
]
)
mock_model = Mock(spec=Model,
predict=Mock(return_value=predicted_probs)
)
mock_model = Mock(spec=Model, predict=Mock(return_value=predicted_probs))
labels = ["A", "B", "C"]
path = "somepath.xlsx"
# act
Expand Down

0 comments on commit bfb6dca

Please sign in to comment.