<jupyter_start><jupyter_text>Baselines: WDVD, ORES, FILTER  Preamble<jupyter_code>%load_ext autoreload
%autoreload 2

%matplotlib inline
import numpy as np
import pandas as pd
import warnings

from sklearn.base import clone
from sklearn.ensemble import BaggingClassifier
from sklearn.ensemble import RandomForestClassifier
import sys
sys.path.append('../src/')

import evaluation
import load_wdvd
import multipleinstance
import storage

from load_wdvd import transform
from transformers import EqualsTransformer
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = 'all'
pd.set_option('display.max_columns', 500)
pd.set_option('display.max_rows', 200)<jupyter_output><empty_output><jupyter_text>Loading<jupyter_code>PATH_FEATURES = '../../data/features/'
OUTPUT_DIR = '../../data/classification/'<jupyter_output><empty_output><jupyter_text>Load Dataframe<jupyter_code>fields = ['revisionId', 'isEditingTool']

dtype = {
    'revisionId': np.int,
    'isEditingTool': np.bool,
    'subject': np.int,
    'predicate': np.int,
    'object': np.int,
    'superSubject': np.int,
    'superObject': np.int,
}

with warnings.catch_warnings():
    warnings.simplefilter('ignore')
    df_train = pd.read_csv(PATH_FEATURES + '/training/features.csv.bz2', index_col=0, usecols=fields, dtype=dtype)
    df_val = pd.read_csv(PATH_FEATURES + '/validation/features.csv.bz2', index_col=0, usecols=fields, dtype=dtype)
    df_test = pd.read_csv(PATH_FEATURES + '/test/features.csv.bz2', index_col=0, usecols=fields, dtype=dtype)

len(df_train)
len(df_val)
len(df_test)<jupyter_output><empty_output><jupyter_text>Load WDVD Features<jupyter_code>df_wdvd = load_wdvd.load_df_wdvd(use_test_set=False)
df_wdvd.loc[df_train.index, 'isEditingTool'] = df_train['isEditingTool']
df_wdvd.loc[df_val.index, 'isEditingTool'] = df_val['isEditingTool']
df_wdvd.loc[df_test.index, 'isEditingTool'] = df_test['isEditingTool']
df_train = df_wdvd.loc[df_train.index]
df_val   = df_wdvd.loc[df_val.index]
df_test  = df_wdvd.loc[df_test.index]

mask_nosat_train = ~df_train['isEditingTool'].values.astype(np.bool)
mask_nosat_val   = ~df_val['isEditingTool'].values.astype(np.bool)
mask_nosat_test  = ~df_test['isEditingTool'].values.astype(np.bool)

df_train = df_train.loc[mask_nosat_train]
df_val = df_val.loc[mask_nosat_val]
df_test = df_test.loc[mask_nosat_test]
len(df_train)
len(df_val)
len(df_test)<jupyter_output><empty_output><jupyter_text>Utils<jupyter_code>def classify(columns, clf, use_weights=False):
    y_train = df_train['rollbackReverted'].values
    y_val   = df_val['rollbackReverted'].values
    y_test  = df_test['rollbackReverted'].values
    y_train_val = np.concatenate([y_train, y_val])

    X_train  = df_train[columns].values
    X_val    = df_val[columns].values
    X_test   = df_test[columns].values
    X_train_val = np.concatenate([X_train, X_val])

    if use_weights:
        weight_train = df_train['weight'].values
        weight_val = df_val['weight'].values
        weight_train_val = np.concatenate([weight_train, weight_val])
    else:
        weight_train = None
        weight_train_val = None

    protected_val   = ~df_val['isRegisteredUser'].values
    protected_test  = ~df_test['isRegisteredUser'].values

    clf_val  = clone(clf)
    clf_test = clone(clf)

    if (isinstance(clf, multipleinstance.BaseMultipleInstanceClassifier)):
        g_train = df_train['revisionSessionId'].values
        g_val = df_val['revisionSessionId'].values
        g_test = df_test['revisionSessionId'].values
        g_train_val = np.concatenate([g_train, g_val])

        clf_val.fit(g_train, X_train, y_train, sample_weight=weight_train)
        clf_test.fit(g_train_val, X_train_val, y_train_val, sample_weight=weight_train_val)
        proba_val  = clf_val.predict_proba(g_val, X_val)
        proba_test = clf_test.predict_proba(g_test, X_test)
    else:
        clf_val.fit(X_train, y_train, sample_weight=weight_train)
        clf_test.fit(X_train_val, y_train_val, sample_weight=weight_train_val)
        proba_val   = clf_val.predict_proba(X_val)[:, 1]
        proba_test  = clf_test.predict_proba(X_test)[:, 1]

    metrics = pd.DataFrame()
    metrics = metrics.append(evaluation.evaluate_proba_performance_bias(
        y_val, protected_val, proba_val, index='VAL'))
    metrics = metrics.append(evaluation.evaluate_proba_performance_bias(
        y_test, protected_test, proba_test, index='TEST'))

    display(metrics)

    return proba_val, proba_test<jupyter_output><empty_output><jupyter_text>Baselines on WDVC-2016-Links  WDVD<jupyter_code>FEATURES_WDVD_CHARACTER = [
    'lowerCaseRatio',
    'upperCaseRatio',
    'nonLatinRatio',
    'latinRatio',
    'alphanumericRatio',
    'digitRatio',
    'punctuationRatio',
    'whitespaceRatio',
    'longestCharacterSequence',
    'asciiRatio',
    'bracketRatio'
]
FEATURES_WDVD_WORD = [
    'languageWordRatio',
    'containsLanguageWord',
    'lowerCaseWordRatio',
    'longestWord',
    'containsURL',
    'badWordRatio',
    'proportionOfQidAdded',
    'upperCaseWordRatio',
    'proportionOfLinksAdded',
]
FEATURES_WDVD_SENTENCE = [
    'commentTailLength',
    'commentSitelinkSimilarity',
    'commentLabelSimilarity',
    'commentCommentSimilarity',
]
FEATURES_WDVD_STATEMENT = [
    'propertyFreq',
    'itemValueFreq',
    'literalValueFreq',
]
FEATURES_WDVD_USER = [
    'userCountryFreq',
    'userTimeZoneFreq',
    'userCityFreq',
    'userCountyFreq',
    'userRegionFreq',
    'cumUserUniqueItems',
    'userContinentFreq',
    'isRegisteredUser',
    'userFreq',
    'isPrivilegedUser',
]
FEATURES_WDVD_ITEM = [
    'logCumItemUniqueUsers',
    'logItemFreq',
]
FEATURES_WDVD_REVISION = [
    'revisionTagsFreq',
    'revisionLanguageFreq',
    'revisionActionFreq',
    'commentLength',
    'isLatinLanguage',
    'revisionPrevActionFreq',
    'revisionSubactionFreq',
    'positionWithinSession',
]
FEATURES_WDVD = FEATURES_WDVD_CHARACTER + FEATURES_WDVD_WORD + FEATURES_WDVD_SENTENCE + FEATURES_WDVD_STATEMENT + FEATURES_WDVD_USER + FEATURES_WDVD_ITEM + FEATURES_WDVD_REVISION

FEATURES_WDVD.sort()

len(FEATURES_WDVD)
columns = FEATURES_WDVD

clf = RandomForestClassifier(n_estimators=8, max_depth=32, max_features=2, random_state=1)
clf = BaggingClassifier(base_estimator=clf, n_estimators=16, max_samples=1/16, n_jobs=1, random_state=1)
clf1 = multipleinstance.SingleInstanceClassifier(base_estimator=clf, agg_func='cummean', window=1)

clf = RandomForestClassifier(n_estimators=8, max_depth=32, max_features=2, random_state=1)
clf = BaggingClassifier(base_estimator=clf, n_estimators=16, max_samples=1/16, n_jobs=1, random_state=1)
clf2 = multipleinstance.SimpleMultipleInstanceClassifier(base_estimator=clf, trans_func='cummin_cummax', window=1)

clf = multipleinstance.CombinedMultipleInstanceClassifier(base_estimator1=clf1, base_estimator2=clf2)
WDVD_VAL, WDVD_TEST = classify(columns=columns, clf=clf);
storage.dump_predictions(df_val, WDVD_VAL, OUTPUT_DIR + 'VALIDATION_WDVD.csv.bz2')
storage.dump_predictions(df_test, WDVD_TEST, OUTPUT_DIR + 'TEST_WDVD.csv.bz2')<jupyter_output><empty_output><jupyter_text>ORES<jupyter_code>FEATURES_ORES_GENERAL = [
    # Added/removed/changed sitelinks
    'wbsetsitelink_na',
    'wbsetsitelink_add',
    'wbsetsitelink_set',
    'wbsetsitelink_remove',

    # Added/removed/changed labels
    'wbsetlabel_add',
    'wbsetlabel_set',
    'wbsetlabel_remove',
    'special_setlabel-set',

    # Added/removed/changed descriptions
    'wbsetdescription_add',
    'wbsetdescription_set',
    'wbsetdescription_remove',

    # Added/removed/changed statements
    'wbcreateclaim_na',
    'wbcreateclaim_create',
    'wbsetclaim_create',
    'wbsetclaim_update',
    'wbremoveclaims_na',
    'wbremoveclaims_remove',
    'wbsetclaim_update-rank',
    'wbsetclaimvalue_na',

    # Added/removed/changed aliases
    'wbsetaliases_add',
    'wbsetaliases_add-remove',
    'wbsetaliases_set',
    'wbsetaliases_remove',

    # Added/removed badges
    'wbsetsitelink_set-badges',
    'wbsetsitelink_add-both',
    'wbsetsitelink_set-both',

    # Added/removed qualifiers
    'wbsetqualifier_na',
    'wbsetqualifier_add',
    'wbsetqualifier_update',
    'wbsetclaim_update-qualifiers',
    'wbremovequalifiers_remove',

     # Added/removed references
    'wbsetreference_na',
    'wbsetreference_add',
    'wbsetreference_set',
    'wbremovereferences_na',
    'wbremovereferences_remove',

    # Misc
    'wbsetlabeldescriptionaliases_na',
    'wbcreateredirect_na',
    'wblinktitles_connect',
    'wblinktitles_create',

    'numberOfSitelinks',
    'numberOfLabels',
    'numberOfDescriptions',
    'numberOfStatements',
    'numberOfAliases',
    'numberOfBadges',
    'numberOfQualifiers',
    'numberOfReferences',
    'numberOfProperties',

    'identifier_changed'
]

FEATURES_ORES_VANDALISM = [
    'proportionOfQidAdded',
    'proportionOfLinksAdded',
    'proportionOfLanguageAdded',

    # Has English label changed?
    'en_label_touched',

    # Changed properties (P21, P27, P54, P569, P18, P109, P373, P856)
    'P21',
    'P27',
    'P54',
    'P569',
    'P18',
    'P109',
    'P373',
    'P856',

    'isLivingPerson',
    'isHuman'
]

FEATURES_ORES_NON_VANDALISM = [
    # Is it a client edit?
    'clientsitelink_update',
    'clientsitelink_remove',

    # Is it a merge?
    'wbmergeitems_from',
    'wbmergeitems_to',

    # Revert, rollback, restore
    'undo_na',
    'rollback_na',
    'restore_na',

    # Is it creating a new item?
    'wbcreate_new',
    'pageCreation_na',
    'special_create-item',
    'wbsetentity_na',
    'wbeditentity_na',
    'wbeditentity_create',
    'wbeditentity_update',
    'wbeditentity_override'
]

FEATURES_ORES_EDITOR = [
    'isBotUser',
    'isAdvancedUser',
    'isAdminUser',
    'isCuratorUser',
    'isRegisteredUser',
    'userSecondsSinceFirstRevisionRegistered'
]

FEATURES_ORES = FEATURES_ORES_GENERAL + FEATURES_ORES_VANDALISM + FEATURES_ORES_NON_VANDALISM + FEATURES_ORES_EDITOR

FEATURES_ORES.sort()

assert len(FEATURES_ORES) == 85
def transform_ores(slice_fit, df):
    df = df.copy()
    df_action = df[['revisionAction', 'revisionSubaction']]

    # Added/removed/changed sitelinks
    df['wbsetsitelink_na']     = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', np.nan)))
    df['wbsetsitelink_add']    = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'add')))
    df['wbsetsitelink_set']    = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'set')))
    df['wbsetsitelink_remove'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'remove')))

    # Added/removed/changed labels
    df['wbsetlabel_add']       = transform(slice_fit, df_action, EqualsTransformer(('wbsetlabel', 'add')))
    df['wbsetlabel_set']       = transform(slice_fit, df_action, EqualsTransformer(('wbsetlabel', 'set')))
    df['wbsetlabel_remove']    = transform(slice_fit, df_action, EqualsTransformer(('wbsetlabel', 'remove')))
    df['special_setlabel-set'] = transform(slice_fit, df_action, EqualsTransformer(('special', 'setlabel-set')))

    # Added/removed/changed descriptions
    df['wbsetdescription_add']    = transform(slice_fit, df_action, EqualsTransformer(('wbsetdescription', 'add')))
    df['wbsetdescription_set']    = transform(slice_fit, df_action, EqualsTransformer(('wbsetdescription', 'set')))
    df['wbsetdescription_remove'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetdescription', 'remove')))

    # Added/removed/changed statements
    df['wbcreateclaim_na']       = transform(slice_fit, df_action, EqualsTransformer(('wbcreateclaim', np.nan)))
    df['wbcreateclaim_create']   = transform(slice_fit, df_action, EqualsTransformer(('wbcreateclaim', 'create')))
    df['wbsetclaim_create']      = transform(slice_fit, df_action, EqualsTransformer(('wbsetclaim', 'create')))
    df['wbsetclaim_update']      = transform(slice_fit, df_action, EqualsTransformer(('wbsetclaim', 'update')))
    df['wbremoveclaims_na']      = transform(slice_fit, df_action, EqualsTransformer(('wbremoveclaims', np.nan)))
    df['wbremoveclaims_remove']  = transform(slice_fit, df_action, EqualsTransformer(('wbremoveclaims', 'remove')))
    df['wbsetclaim_update-rank'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetclaim', 'update-rank')))
    df['wbsetclaimvalue_na']     = transform(slice_fit, df_action, EqualsTransformer(('wbsetclaimvalue', np.nan)))

    # Added/removed/changed aliases
    df['wbsetaliases_add']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetaliases', 'add')))
    df['wbsetaliases_add-remove'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetaliases', 'add-remove')))
    df['wbsetaliases_set']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetaliases', 'set')))
    df['wbsetaliases_remove']     = transform(slice_fit, df_action, EqualsTransformer(('wbsetaliases', 'remove')))

    # Added/removed badges
    df['wbsetsitelink_set-badges'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'set-badges')))
    df['wbsetsitelink_add-both']   = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'add-both')))
    df['wbsetsitelink_set-both']   = transform(slice_fit, df_action, EqualsTransformer(('wbsetsitelink', 'set-both')))

    # Added/removed qualifiers
    df['wbsetqualifier_na']            = transform(slice_fit, df_action, EqualsTransformer(('wbsetqualifier', np.nan)))
    df['wbsetqualifier_add']           = transform(slice_fit, df_action, EqualsTransformer(('wbsetqualifier', 'add')))
    df['wbsetqualifier_update']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetqualifier', 'update')))
    df['wbsetclaim_update-qualifiers'] = transform(slice_fit, df_action, EqualsTransformer(('wbsetclaim', 'update-qualifiers')))
    df['wbremovequalifiers_remove']    = transform(slice_fit, df_action, EqualsTransformer(('wbremovequalifiers', 'remove')))

    # Added/removed references
    df['wbsetreference_na']         = transform(slice_fit, df_action, EqualsTransformer(('wbsetreference', np.nan)))
    df['wbsetreference_add']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetreference', 'add')))
    df['wbsetreference_set']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetreference', 'set')))
    df['wbremovereferences_na']     = transform(slice_fit, df_action, EqualsTransformer(('wbremovereferences', np.nan)))
    df['wbremovereferences_remove'] = transform(slice_fit, df_action, EqualsTransformer(('wbremovereferences', 'remove')))

    # Misc
    df['wbsetlabeldescriptionaliases_na'] =\
                                 transform(slice_fit, df_action, EqualsTransformer(('wbsetlabeldescriptionaliases', np.nan)))
    df['wbcreateredirect_na']  = transform(slice_fit, df_action, EqualsTransformer(('wbcreateredirect', np.nan)))
    df['wblinktitles_connect'] = transform(slice_fit, df_action, EqualsTransformer(('wblinktitles', 'connect')))
    df['wblinktitles_create']  = transform(slice_fit, df_action, EqualsTransformer(('wblinktitles', 'create')))

    df['identifier_changed'] = transform(slice_fit, df[['dataType']], EqualsTransformer(('external-id',)))

    # Has English label changed?
    df['en_label_touched'] = transform(
        slice_fit, df[['revisionAction', 'revisionLanguage']], EqualsTransformer(('wbsetlabel', 'en')))

    # Changed properties (P21, P27, P54, P569, P18, P109, P373, P856)
    df['P21']  = transform(slice_fit, df[['property']], EqualsTransformer((21,)))   # sex or gender
    df['P27']  = transform(slice_fit, df[['property']], EqualsTransformer((27,)))   # country of citizenship
    df['P54']  = transform(slice_fit, df[['property']], EqualsTransformer((54,)))   # member of sports team
    df['P569'] = transform(slice_fit, df[['property']], EqualsTransformer((569,)))  # date of birth
    df['P18']  = transform(slice_fit, df[['property']], EqualsTransformer((18,)))   # image
    df['P109'] = transform(slice_fit, df[['property']], EqualsTransformer((109,)))  # signature
    df['P373'] = transform(slice_fit, df[['property']], EqualsTransformer((373,)))  # commons category
    df['P856'] = transform(slice_fit, df[['property']], EqualsTransformer((856,)))  # official website

    # Is it a client edit?
    df['clientsitelink_update'] = transform(slice_fit, df_action, EqualsTransformer(('clientsitelink', 'update')))
    df['clientsitelink_remove'] = transform(slice_fit, df_action, EqualsTransformer(('clientsitelink', 'remove')))

    # Is it a merge?
    df['wbmergeitems_from'] = transform(slice_fit, df_action, EqualsTransformer(('wbmergeitems', 'from')))
    df['wbmergeitems_to']   = transform(slice_fit, df_action, EqualsTransformer(('wbmergeitems', 'to')))

    # Revert, rollback, restore
    df['undo_na']     = transform(slice_fit, df_action, EqualsTransformer(('undo', np.nan)))
    df['rollback_na'] = transform(slice_fit, df_action, EqualsTransformer(('rollback', np.nan)))
    df['restore_na']= transform(slice_fit, df_action, EqualsTransformer(('restore', np.nan)))

    # Is it creating a new item?
    df['wbcreate_new']          = transform(slice_fit, df_action, EqualsTransformer(('wbcreate', 'new')))
    df['pageCreation_na']       = transform(slice_fit, df_action, EqualsTransformer(('pageCreation', np.nan)))
    df['special_create-item']   = transform(slice_fit, df_action, EqualsTransformer(('special', 'create-item')))
    df['wbsetentity_na']        = transform(slice_fit, df_action, EqualsTransformer(('wbsetentity', np.nan)))
    df['wbeditentity_na']       = transform(slice_fit, df_action, EqualsTransformer(('wbeditentity', np.nan)))
    df['wbeditentity_create']   = transform(slice_fit, df_action, EqualsTransformer(('wbeditentity', 'create')))
    df['wbeditentity_update']   = transform(slice_fit, df_action, EqualsTransformer(('wbeditentity', 'update')))
    df['wbeditentity_override'] = transform(slice_fit, df_action, EqualsTransformer(('wbeditentity', 'override')))

    return df
df_ores_test = transform_ores(slice(0, 0), df_test)

assert len(set(df_ores_test.loc[:, 'wbsetsitelink_na':].columns)) == len(df_ores_test.loc[:, 'wbsetsitelink_na':].columns)
assert set(df_ores_test.loc[:, 'wbsetsitelink_na':].columns).intersection(set(df_test.columns)) == set()
df_train = transform_ores(slice(0, 0), df_train)
df_val = transform_ores(slice(0, 0), df_val)
df_test = transform_ores(slice(0, 0), df_test)
columns = FEATURES_ORES
clf = RandomForestClassifier(
    n_estimators=80, criterion='entropy', min_samples_leaf=1, max_features='log2', n_jobs=1, random_state=1)
ORES_VAL, ORES_TEST = classify(columns=columns, clf=clf);
storage.dump_predictions(df_val, ORES_VAL, OUTPUT_DIR + 'VALIDATION_ORES.csv.bz2')
storage.dump_predictions(df_test, ORES_TEST, OUTPUT_DIR + 'TEST_ORES.csv.bz2')<jupyter_output><empty_output><jupyter_text>FILTER<jupyter_code>FEATURES_FILTER = ['revisionTagsFreq']
columns = FEATURES_FILTER
clf = RandomForestClassifier(n_estimators=10, max_depth=None, n_jobs=1, random_state=1)
FILTER_VAL, FILTER_TEST = classify(columns=columns, clf=clf);
storage.dump_predictions(df_val, FILTER_VAL, OUTPUT_DIR + 'VALIDATION_FILTER.csv.bz2')
storage.dump_predictions(df_test, FILTER_TEST, OUTPUT_DIR + 'TEST_FILTER.csv.bz2')<jupyter_output><empty_output><jupyter_text>Weighting WDVD Samples<jupyter_code>def wdvd_weighted(max_depth, weight):
    columns = FEATURES_WDVD

    df_weight = pd.concat([df_train, df_val])
    df_weight['weight'] = df_weight.reset_index().groupby(['rollbackReverted', 'isRegisteredUser'])['revisionId'].transform(lambda x: 1 / len(x)).values

    df_weight.loc[~df_weight['rollbackReverted'] & ~df_weight['isRegisteredUser'], 'weight'] *= weight
    df_weight.loc[ df_weight['rollbackReverted'] &  df_weight['isRegisteredUser'], 'weight'] *= weight

    df_train['weight'] = df_weight['weight']
    df_val['weight']   = df_weight['weight']

    clf = RandomForestClassifier(n_estimators=8, max_depth=max_depth, max_features=2, random_state=1)
    clf = BaggingClassifier(base_estimator=clf, n_estimators=16, max_samples=1/16, n_jobs=1, random_state=1)
    clf1 = multipleinstance.SingleInstanceClassifier(base_estimator=clf, agg_func='cummean', window=1)

    clf = RandomForestClassifier(n_estimators=8, max_depth=max_depth, max_features=2, random_state=1)
    clf = BaggingClassifier(base_estimator=clf, n_estimators=16, max_samples=1/16, n_jobs=1, random_state=1)
    clf2 = multipleinstance.SimpleMultipleInstanceClassifier(base_estimator=clf, trans_func='cummin_cummax', window=1)

    clf = multipleinstance.CombinedMultipleInstanceClassifier(base_estimator1=clf1, base_estimator2=clf2)

    return classify(columns=columns, clf=clf, use_weights=True);
WDVD_WEIGHTED1_VAL, WDVD_WEIGHTED1_TEST = wdvd_weighted(16, 8.1)
# storage.dump_predictions(df_val, WDVD_WEIGHTED1_VAL, OUTPUT_DIR + 'VALIDATION_WDVD_WEIGHTED1.csv.bz2')
storage.dump_predictions(df_test, WDVD_WEIGHTED1_TEST, OUTPUT_DIR + 'TEST_WDVD_WEIGHTED1.csv.bz2')
WDVD_WEIGHTED2_VAL, WDVD_WEIGHTED2_TEST = wdvd_weighted(16, 4.3)
# storage.dump_predictions(df_val, WDVD_WEIGHTED2_VAL, OUTPUT_DIR + 'VALIDATION_WDVD_WEIGHTED2.csv.bz2')
storage.dump_predictions(df_test, WDVD_WEIGHTED2_TEST, OUTPUT_DIR + 'TEST_WDVD_WEIGHTED2.csv.bz2')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13282492748198746, 'fraction_numerical': 0.010760737344437167, 'mean_word_length': 5.79002541296061, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '484160', 'license': 'MIT', 'n_tokens_mistral': 7812, 'n_tokens_neox': 7623, 'n_words': 1050, 'path': 'notebooks/03-baselines.ipynb', 'repo_name': 'heindorf/www19-fair-classification', 'size': '21374'}