Объект Get 'Multinomial' не имеет атрибута 'keys' при обучении классификатора случайного леса creme

Я использую библиотеку creme python и модель RandomForestClassifier и получаю эту ошибку:

AttributeError: 'Multinomial' object has no attribute 'keys'

может кто-нибудь помочь?

Пример набора данных (первые 5 строк)

      {'AppVersion': {0: 4843453, 1: 423691, 2: 4843453, 3: 423691, 4: 4843453}, 'AvSigVersion': {0: 3518586, 1: 3463588, 2: 3463588, 3: 112979, 4: 3463588}, 'IsSxsPassiveMode': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'AVProductsInstalled': {0: 1.0, 1: 2.0, 2: 1.0, 3: 2.0, 4: 2.0}, 'CountryIdentifier': {0: 11, 1: 68, 2: 162, 3: 171, 4: 205}, 'LocaleEnglishNameIdentifier': {0: 102, 1: 74, 2: 75, 3: -74, 4: 75}, 'Platform': {0: 7995923.0, 1: 7995923.0, 2: 7995923.0, 3: 7995923.0, 4: 7995923.0}, 'Processor': {0: 7389456.0, 1: 7389456.0, 2: 7389456.0, 3: 7389456.0, 4: 743828.0}, 'OsBuild': {0: 17134, 1: 17134, 2: 17134, 3: 17134, 4: 17134}, 'OsSuite': {0: 256, 1: 768, 2: 256, 3: 768, 4: 768}, 'OsPlatformSubRelease': {0: 3649704.0, 1: 3649704.0, 2: 3649704.0, 3: 3649704.0, 4: 3649704.0}, 'SkuEdition': {0: 2893659, 1: 5139677, 2: 2893659, 3: 5139677, 4: 5139677}, 'IsProtected': {0: 1.0, 1: 1.0, 2: 1.0, 3: 1.0, 4: 1.0}, 'SmartScreen': {0: 4053938, 1: 4053938, 2: 3753236, 3: 4053938, 4: 3753236}, 'Firewall': {0: 1.0, 1: 1.0, 2: 1.0, 3: 1.0, 4: 1.0}, 'Census_MDC2FormFactor': {0: 1725107, 1: 1725107, 2: 1725107, 3: 5282912, 4: 1725107}, 'Census_ProcessorCoreCount': {0: 8.0, 1: 4.0, 2: 4.0, 3: 4.0, 4: 2.0}, 'Census_PrimaryDiskTotalCapacity': {0: 1907729.0, 1: 953869.0, 2: 953869.0, 3: 953869.0, 4: 953869.0}, 'Census_PrimaryDiskTypeName': {0: 5380399, 1: 5380399, 2: 5380399, 3: 5380399, 4: 501980}, 'Census_SystemVolumeTotalCapacity': {0: 1906331.0, 1: 947867.0, 2: 924450.0, 3: 907476.0, 4: 253319.0}, 'Census_HasOpticalDiskDrive': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'Census_TotalPhysicalRAM': {0: 8192.0, 1: 16384.0, 2: 8192.0, 3: 8192.0, 4: 2048.0}, 'Census_ChassisTypeName': {0: 1657734, 1: 1657734, 2: 1657734, 3: 4867689, 4: 1657734}, 'Census_InternalPrimaryDiagonalDisplaySizeInInches': {0: 23.5, 1: 49.7, 2: 23.0, 3: 15.5, 4: 20.0}, 'Census_InternalPrimaryDisplayResolutionHorizontal': {0: 1600.0, 1: 3840.0, 2: 1920.0, 3: 1366.0, 4: 1600.0}, 'Census_InternalPrimaryDisplayResolutionVertical': {0: 900.0, 1: 2160.0, 2: 1080.0, 3: 768.0, 4: 900.0}, 'Census_PowerPlatformRoleName': {0: 5709661, 1: 1813475, 2: 1813475, 3: 5709661, 4: 1813475}, 'Census_InternalBatteryNumberOfCharges': {0: 4294967300.0, 1: 4294967300.0, 2: 4294967300.0, 3: 0.0, 4: 4294967300.0}, 'Census_OSVersion': {0: 8133579, 1: 8133579, 2: 8133579, 3: 8133579, 4: 8133579}, 'Census_OSBranch': {0: 3731311, 1: 3731311, 2: 3731311, 3: 3731311, 4: 3731311}, 'Census_OSBuildNumber': {0: 17134, 1: 17134, 2: 17134, 3: 17134, 4: 17134}, 'Census_OSBuildRevision': {0: 228, 1: 165, 2: 254, 3: 228, 4: 228}, 'Census_OSEdition': {0: 2807371, 1: 3205241, 2: 45174, 3: 1802252, 4: 3205241}, 'Census_OSWUAutoUpdateOptionsName': {0: 3623902, 1: 3623902, 2: 3623902, 3: 3623902, 4: 3623902}, 'Census_GenuineStateName': {0: 7299559, 1: 7299559, 2: 7299559, 3: 7299559, 4: 695236}, 'Census_ActivationChannel': {0: 3173972, 1: 4259314, 2: 4259314, 3: 3173972, 4: 4259314}, 'Census_IsSecureBootEnabled': {0: 0, 1: 0, 2: 0, 3: 1, 4: 0}, 'Census_IsTouchEnabled': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'Census_IsPenCapable': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'Wdft_IsGamer': {0: 0.0, 1: 1.0, 2: 0.0, 3: 1.0, 4: 1.0}, 'HasDetections': {0: 1, 1: 0, 2: 0, 3: 0, 4: 1}, 'Lag1': {0: 4.0, 1: 2.0, 2: -3.0, 3: -24.0, 4: 0.0}, 'Lag2': {0: 0.0, 1: 0.0, 2: 0.0, 3: 146.0, 4: 0.0}, 'driveA': {0: 0.9992672, 1: 0.9937077, 2: 0.96915823, 3: 0.9513633, 4: 0.26557}, 'driveB': {0: 1398.0, 1: 6002.0, 2: 29419.0, 3: 46393.0, 4: 700550.0}, 'CoreCountMDiagonal': {0: 188.0, 1: 198.8, 2: 92.0, 3: 62.0, 4: 40.0}, 'CoreCountMRAM': {0: 65536.0, 1: 65536.0, 2: 32768.0, 3: 32768.0, 4: 4096.0}}

Мой код:

          from creme import stream
    from creme.metrics import Accuracy
    from creme.tree import RandomForestClassifier

    dataset = stream.iter_csv('data/data2.csv', target='HasDetections')

    model = RandomForestClassifier()
    metric = Accuracy()

    for (i, (x, y)) in enumerate(dataset):
        preds = model.predict_one(x)
        model = model.fit_one(x, y)
        metric = metric.update(y, preds)
        print("INFO] update {} - {}".format(i, metric))

    print("[INFO] final - {}".format(metric))```

0 ответов

Другие вопросы по тегам