yitingliii
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -61,6 +61,39 @@ print(classification_report(y_test, y_pred))
|
|
61 |
```
|
62 |
|
63 |
4. Training a new dataset with pre-trained model
|
64 |
-
<br>To test a new dataset,
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
|
|
61 |
```
|
62 |
|
63 |
4. Training a new dataset with pre-trained model
|
64 |
+
<br>To test a new dataset, follow the steps below:
|
65 |
+
|
66 |
+
- Clean the Dataset
|
67 |
+
```python
|
68 |
+
from data_cleaning import clean
|
69 |
+
|
70 |
+
# Load your dataset
|
71 |
+
df = pd.read_csv('test_data_random_subset.csv')
|
72 |
+
|
73 |
+
# Clean the data
|
74 |
+
cleaned_df = clean(df)
|
75 |
+
|
76 |
+
```
|
77 |
+
|
78 |
+
- Extract TF-IDF Features
|
79 |
+
```python
|
80 |
+
from tfidf import tfidf
|
81 |
+
|
82 |
+
# Transform the cleaned dataset
|
83 |
+
X_new_tfidf = tfidf.transform(cleaned_df['title'])
|
84 |
+
|
85 |
+
```
|
86 |
+
|
87 |
+
- Make Predictions
|
88 |
+
```python
|
89 |
+
from svm import svm_model
|
90 |
+
|
91 |
+
# Make predictions
|
92 |
+
predictions = svm_model.predict(X_new_tfidf)
|
93 |
+
|
94 |
+
# Add predictions to the dataset
|
95 |
+
cleaned_df['predictions'] = predictions
|
96 |
+
print(cleaned_df[['title', 'predictions']])
|
97 |
+
|
98 |
+
```
|
99 |
|