File size: 2,266 Bytes
5511aad
7c15afe
5511aad
 
 
64da85e
5511aad
 
7c15afe
5511aad
 
 
 
 
 
 
 
 
61a5785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: NoCodeTextClassifier
emoji: 🚀
colorFrom: red
colorTo: red
sdk: streamlit
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Streamlit template space
---

# Welcome to Streamlit!

Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:

If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
forums](https://discuss.streamlit.io).
# No Code Text Classifier Tool

This tool will help you to perform training, evaluation & prediction of Text Classification task without knowing any kind of code. You have to define the dataset directory and create your model and perform predictions without any issue. In the backend, this will automatically perform text preprocessing, model training etc. You can also perform hyperparameter techniques to get the best model through experiments. Let's get started.

Install the pakage
```python
pip install NoCodeTextClassifier
```

### Training the Text Classification

Define the datapath
```python
data_path = "dataset.csv"
```
Clean the Text dataset and transform the label into number
```python
# It will take datapath, text feature and target feature
process = process(data_path,'email','class')
df = process.processing()
print(df.head())
```
Convert the text feature into numerical vector. You can apply multiple vectorization such as TfIdfVectorizer, CountVectorizer.
```python
Vectorization = Vectorization(df,'clean_text')
TfidfVectorizer = Vectorization.TfidfVectorizer(max_features= 10000)
print(TfidfVectorizer.toarray())
```
Split the dataset into training and testing
```python
X_train, X_test, y_train, y_test = process.split_data(TfidfVectorizer.toarray(), df['labeled_target'])
print(X_train.shape, X_test.shape, y_train.shape, y_test.shape)
```
Perform training with various models such as Naive Bayers, Decision Tree, Logistic Regression, and others. After training, you will see the evalution of the trained model.
```python
models = Models(X_train=X_train,X_test = X_test, y_train = y_train, y_test = y_test)
models.DecisionTree()
```

### For Inferencing with text data

For prediction of the text data with the trained model, try this.
```python
text = input("Enter your text:\n")
inference.prediction(text)
```