Skip to content

Commit b083cf1

Browse files
authored
Update README.md
1 parent cb8226b commit b083cf1

1 file changed

Lines changed: 45 additions & 15 deletions

File tree

README.md

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,64 @@ Pipeline for building text classification **TF-IDF + LogReg** baselines using **
33

44
### Usage
55
Instead of writing custom code for specific text classification task, you just need:
6-
1) install pipeline:
6+
1. install pipeline:
77
```shell script
88
pip install text-classification-baseline
99
```
10-
2a) either run pipeline in **terminal**:
11-
```shell script
12-
text-clf --config config.yaml
13-
```
14-
2b) or run pipeline in **python**:
15-
```python3
16-
import text_clf
17-
text_clf.train(path_to_config="config.yaml")
18-
```
10+
2. run pipeline:
11+
12+
- either in **terminal**:
13+
```shell script
14+
text-clf --config config.yaml
15+
```
16+
17+
- or in **python**:
18+
```python3
19+
import text_clf
20+
21+
text_clf.train(path_to_config="config.yaml")
22+
```
1923

2024
No data preparation is needed, only a **csv** file with two raw columns (with arbitrary names):
21-
- text
22-
- target
25+
- `text`
26+
- `target`
2327

24-
**NOTE**: the target can be presented in any format, including text - not necessarily integers from *0* to *n_classes-1*.
28+
**NOTE**: the **target** can be presented in any format, including text - not necessarily integers from *0* to *n_classes-1*.
2529

2630
#### Config
2731
The user interface consists of only one file [**config.yaml**](https://github.com/dayyass/text-classification-baseline/blob/main/config.yaml).
2832

2933
Change **config.yaml** to create the desired configuration and train text classification model.
3034

3135
Default **config.yaml**:
32-
```{r engine='bash', comment=''}
33-
cat config.yaml
36+
```yaml
37+
seed: 42
38+
verbose: true
39+
path_to_save_folder: models
40+
41+
# data
42+
data:
43+
train_data_path: data/train.csv
44+
valid_data_path: data/valid.csv
45+
sep: ','
46+
text_column: text
47+
target_column: target_name_short
48+
49+
# tf-idf
50+
tf-idf:
51+
lowercase: true
52+
ngram_range: (1, 1)
53+
max_df: 1.0
54+
min_df: 0.0
55+
56+
# logreg
57+
logreg:
58+
penalty: l2
59+
C: 1.0
60+
class_weight: balanced
61+
solver: saga
62+
multi_class: auto
63+
n_jobs: -1
3464
```
3565

3666
#### Output

0 commit comments

Comments
 (0)