Spaces:
Sleeping
Sleeping
Change the machine learning model from Logistic Regression to Random Forest Classifier.
Browse files- app/factory_predictor.py +6 -2
app/factory_predictor.py
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
-
from sklearn.linear_model import LogisticRegression
|
|
|
|
| 3 |
from sklearn.preprocessing import LabelEncoder
|
| 4 |
from sklearn.metrics import accuracy_score
|
| 5 |
|
| 6 |
class FactoryPredictor:
|
| 7 |
def __init__(self):
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
self.le_diagnosis = LabelEncoder()
|
| 10 |
self.temperature = 0
|
| 11 |
self.pressure = 0
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
+
#from sklearn.linear_model import LogisticRegression
|
| 3 |
+
from sklearn.ensemble import RandomForestClassifier
|
| 4 |
from sklearn.preprocessing import LabelEncoder
|
| 5 |
from sklearn.metrics import accuracy_score
|
| 6 |
|
| 7 |
class FactoryPredictor:
|
| 8 |
def __init__(self):
|
| 9 |
+
|
| 10 |
+
# Added random_state=42 for reproducibility. n_estimators = 100 is a default value.
|
| 11 |
+
self.model = RandomForestClassifier(n_estimators=100, random_state=42)
|
| 12 |
+
|
| 13 |
self.le_diagnosis = LabelEncoder()
|
| 14 |
self.temperature = 0
|
| 15 |
self.pressure = 0
|