示例#1
0
from sklearn.tree import DecisionTreeClassifier
from skmultiflow.trees import HoeffdingTree

# Select streams and methods
streams = h.realstreams()
print(len(streams))

ob = OnlineBagging(n_estimators=20,
                   base_estimator=HoeffdingTree(split_criterion='hellinger'))
oob = OOB(n_estimators=20,
          base_estimator=HoeffdingTree(split_criterion='hellinger'))
uob = UOB(n_estimators=20,
          base_estimator=HoeffdingTree(split_criterion='hellinger'))
ros_knorau2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42,
    oversampler="ROS"),
                  oversampled="ROS",
                  des="KNORAU2")
cnn_knorau2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42,
    oversampler="CNN"),
                  oversampled="CNN",
                  des="KNORAU2")
ros_knorae2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42,
    oversampler="ROS"),
                  oversampled="ROS",
                  des="KNORAE2")
cnn_knorae2 = SEA(base_estimator=StratifiedBagging(
示例#2
0
from skmultiflow.trees import HoeffdingTree

if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

sea = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                           random_state=42))
knorau1 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                               random_state=42),
              des="KNORAU1")
knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                               random_state=42),
              des="KNORAU2")
knorae1 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                               random_state=42),
              des="KNORAE1")
knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                               random_state=42),
              des="KNORAE2")

clfs = (sea, knorau1, knorau2, knorae1, knorae2)
# Select streams and methods
streams = h.moa_streams()

print(len(streams))

rea = REA(base_classifier=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42), number_of_classifiers=5)
cds = LearnppCDS(base_classifier=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42), number_of_classifiers=5)
nie = LearnppNIE(base_classifier=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42), number_of_classifiers=5)
ouse = OUSE(base_classifier=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42), number_of_classifiers=5)
kmc = KMeanClustering(base_classifier=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42), number_of_classifiers=5)
ros_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAU2")
cnn_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="CNN"), oversampled="CNN", des="KNORAU2")
ros_knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAE2")
cnn_knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(), random_state=42, oversampler = "CNN"), oversampled="CNN" ,des="KNORAE2")

clfs = (rea, ouse, kmc, cds, nie, ros_knorau2, cnn_knorau2, ros_knorae2, cnn_knorae2)

# Define worker
def worker(i, stream_n):
    stream = streams[stream_n]
    key = list(streams.keys())[i]
    cclfs = [clone(clf) for clf in clfs]

    print("Starting stream %i/%i" % (i + 1, len(streams)))
示例#4
0
if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

sea = SEA(base_estimator=StratifiedBagging(base_estimator=HoeffdingTree(
    split_criterion='hellinger'),
                                           random_state=42))
knorau1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42),
              des="KNORAU1")
knorau2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42),
              des="KNORAU2")
knorae1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
    random_state=42),
              des="KNORAE1")
knorae2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=HoeffdingTree(split_criterion='hellinger'),
from sklearn.svm import SVC

if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

none_knorau1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler="None"), oversampled="None", des="KNORAU1")
rus_knorau1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler="RUS"), oversampled="RUS", des="KNORAU1")
cnn_knorau1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler="CNN"), oversampled="CNN", des="KNORAU1")
none_knorae1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler="None"), oversampled="None", des="KNORAE1")
rus_knorae1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler="RUS"), oversampled="RUS", des="KNORAE1")
cnn_knorae1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42), random_state=42, oversampler = "CNN"), oversampled="CNN" ,des="KNORAE1")

clfs = (none_knorau1, rus_knorau1, cnn_knorau1, none_knorae1, rus_knorae1, cnn_knorae1)

# Define worker
def worker(i, stream_n):
示例#6
0
from sklearn.neural_network import MLPClassifier

if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

gnb = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(), random_state=42))
ht = SEA(base_estimator=StratifiedBagging(base_estimator=HoeffdingTree(), random_state=42))

clfs = (gnb, ht)

# Define worker
def worker(i, stream_n):
    stream = streams[stream_n]
    cclfs = [clone(clf) for clf in clfs]

    print("Starting stream %i/%i" % (i + 1, len(streams)))

    eval = TestThenTrain(metrics=(
        balanced_accuracy_score,
        geometric_mean_score_1,
        f1_score,
if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

none_knorau1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'),
    random_state=42,
    oversampler="None"),
                   oversampled="None",
                   des="KNORAU1")
ros_knorau1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'),
    random_state=42,
    oversampler="ROS"),
                  oversampled="ROS",
                  des="KNORAU1")
b2_knorau1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'),
    random_state=42,
    oversampler="B2"),
                 oversampled="B2",
                 des="KNORAU1")
none_knorae2 = SEA(base_estimator=StratifiedBagging(
示例#8
0
if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

none_knorau2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=GaussianNB(), random_state=42, oversampler="None"),
                   oversampled="None",
                   des="KNORAU2")
ros_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                                   random_state=42,
                                                   oversampler="ROS"),
                  oversampled="ROS",
                  des="KNORAU2")
b2_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                                  random_state=42,
                                                  oversampler="B2"),
                 oversampled="B2",
                 des="KNORAU2")
none_knorae2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=GaussianNB(), random_state=42, oversampler="None"),
                   oversampled="None",
                   des="KNORAE2")
示例#9
0
    recall,
    specificity
)
import sys
from sklearn.base import clone
from sklearn.tree import DecisionTreeClassifier
from skmultiflow.trees import HoeffdingTree
import time
import matplotlib.pyplot as plt

# Select streams and methods
streams = h.timestream(100)

print(len(streams))

ros_knorau2_3 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAU2", n_estimators=3)
ros_knorau2_5 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="CNN"), oversampled="CNN", des="KNORAU2", n_estimators=5)
ros_knorau2_10 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAU2", n_estimators=10)
ros_knorau2_15 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAU2", n_estimators=15)
ros_knorau2_30 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAU2", n_estimators=30)

# cnn_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
# ), random_state=42, oversampler="CNN"), oversampled="CNN", des="KNORAU2")
# ros_knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
# ), random_state=42, oversampler="ROS"), oversampled="ROS", des="KNORAE2")
# cnn_knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(
# ), random_state=42, oversampler="CNN"), oversampled="CNN", des="KNORAE2")
示例#10
0
from sklearn.neighbors import KNeighborsClassifier

if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

sea = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'), random_state=42))
knorau1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'), random_state=42),
              des="KNORAU1")
knorau2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'), random_state=42),
              des="KNORAU2")
knorae1 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'), random_state=42),
              des="KNORAE1")
knorae2 = SEA(base_estimator=StratifiedBagging(
    base_estimator=KNeighborsClassifier(weights='distance'), random_state=42),
              des="KNORAE2")
clfs = (sea, knorau1, knorau2, knorae1, knorae2)

# Define worker
示例#11
0
from sklearn.svm import SVC

if len(sys.argv) != 2:
    print("PODAJ RS")
    exit()
else:
    random_state = int(sys.argv[1])

print(random_state)

# Select streams and methods
streams = h.toystreams(random_state)

print(len(streams))

sea = SEA(base_estimator=StratifiedBagging(
    base_estimator=SVC(probability=True, random_state=42), random_state=42))
knorau1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42),
                                               random_state=42),
              des="KNORAU1")
knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42),
                                               random_state=42),
              des="KNORAU2")
knorae1 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42),
                                               random_state=42),
              des="KNORAE1")
knorae2 = SEA(base_estimator=StratifiedBagging(base_estimator=SVC(
    probability=True, random_state=42),
                                               random_state=42),
示例#12
0
cds = LearnppCDS(base_classifier=StratifiedBagging(base_estimator=GaussianNB(),
                                                   random_state=42),
                 number_of_classifiers=5)
nie = LearnppNIE(base_classifier=StratifiedBagging(base_estimator=GaussianNB(),
                                                   random_state=42),
                 number_of_classifiers=5)
ouse = OUSE(base_classifier=StratifiedBagging(base_estimator=GaussianNB(),
                                              random_state=42),
            number_of_classifiers=5)

kmc = KMeanClustering(base_classifier=StratifiedBagging(
    base_estimator=GaussianNB(), random_state=42),
                      number_of_classifiers=5)

sea = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                           random_state=42),
          n_estimators=5,
          metric=roc_auc_score)

ros_knorau2 = SEA(base_estimator=StratifiedBagging(base_estimator=GaussianNB(),
                                                   random_state=42,
                                                   oversampler="ROS"),
                  oversampled="ROS",
                  des="KNORAU2")

stream = StreamGenerator(n_chunks=250,
                         chunk_size=200,
                         random_state=1410,
                         n_drifts=1,
                         weights=[0.9, 0.1])
eval = TestThenTrain(metrics=(geometric_mean_score_1))