In [1]:
Copied!
from river import metrics, evaluate
from river.datasets import Phishing
from EvOAutoML.classification import EvolutionaryBaggingClassifier
from tqdm import tqdm
from river import metrics, evaluate
from river.datasets import Phishing
from EvOAutoML.classification import EvolutionaryBaggingClassifier
from tqdm import tqdm
In [2]:
Copied!
n_samples = 10000
dataset = Phishing()
metric = metrics.Accuracy()
model = EvolutionaryBaggingClassifier()
n_samples = 10000
dataset = Phishing()
metric = metrics.Accuracy()
model = EvolutionaryBaggingClassifier()
In [3]:
Copied!
for x,y in tqdm(dataset):
y_pred = model.predict_one(x) # make a prediction
metric = metric.update(y, y_pred) # update the metric
model = model.learn_one(x, y) # make the model learn
print(f'Accuracy: {metric.get()}')
for x,y in tqdm(dataset):
y_pred = model.predict_one(x) # make a prediction
metric = metric.update(y, y_pred) # update the metric
model = model.learn_one(x, y) # make the model learn
print(f'Accuracy: {metric.get()}')
1250it [00:13, 92.91it/s]
Accuracy: 0.8928
Evolutionary Oldest Bagging Classifier¶
This classifier removes the oldest ML pipeline from the ensemble.
In [4]:
Copied!
from river import metrics, evaluate
from river.datasets import Phishing
from EvOAutoML.classification import EvolutionaryOldestBaggingClassifier
from tqdm import tqdm
from river import metrics, evaluate
from river.datasets import Phishing
from EvOAutoML.classification import EvolutionaryOldestBaggingClassifier
from tqdm import tqdm
In [5]:
Copied!
n_samples = 10000
dataset = Phishing()
metric = metrics.Accuracy()
model = EvolutionaryOldestBaggingClassifier()
n_samples = 10000
dataset = Phishing()
metric = metrics.Accuracy()
model = EvolutionaryOldestBaggingClassifier()
In [6]:
Copied!
for x, y in tqdm(dataset):
y_pred = model.predict_one(x) # make a prediction
metric = metric.update(y, y_pred) # update the metric
model = model.learn_one(x, y) # make the model learn
print(f'Accuracy: {metric.get()}')
for x, y in tqdm(dataset):
y_pred = model.predict_one(x) # make a prediction
metric = metric.update(y, y_pred) # update the metric
model = model.learn_one(x, y) # make the model learn
print(f'Accuracy: {metric.get()}')
1250it [00:13, 91.51it/s]
Accuracy: 0.8944