Kaggle competition: NFL Big Data Bowl
<SOS> metric: CRPS Kaggle data source: nfl-big-data-bowl<save_to_csv>
pd.set_option('display.max_columns', 50)
 pd.set_option('display.max_rows', 150 )
submission = pd.DataFrame.from_dict({
'id': test['id'],
'prediction': np.mean(all_test_preds, axis=0)[:, 0]})
 submission.to_csv('submission.csv', index=False )<define_variables>
from keras.layers import Dense
from keras.models import Sequential
from keras.callbacks import Callback, EarlyStopping
from keras.layers import Dropout, PReLU, BatchNormalization, ELU, GaussianNoise, Activation
from keras.optimizers import Adam
package_dir = ".. /input/ppbert/pytorch-pretrained-bert/pytorch-pretrained-BERT"
sys.path.append(package_dir )<set_options>
train = pd.read_csv('/kaggle/input/nfl-big-data-bowl-2020/train.csv', usecols=['GameId', 'PlayId', 'Team', 'X', 'Y', 'S', 'A', 'Dis',
'Orientation', 'Dir', 'NflId', 'DisplayName', 'YardLine',
'Quarter', 'GameClock', 'PossessionTeam', 'Down', 'Distance',
'FieldPosition', 'NflIdRusher', 'OffenseFormation',
'OffensePersonnel', 'DefendersInTheBox', 'DefensePersonnel',
'PlayDirection', 'TimeHandoff', 'TimeSnap', 'Yards',
'WindSpeed', 'Temperature', 'Humidity'] )
warnings.filterwarnings(action='once')
 device = torch.device('cuda' )<define_variables>
outcomes = train[['GameId','PlayId','Yards']].drop_duplicates()
TARGET_COL = 'target'
TEXT_COL = 'comment_text'
DF_TRAIN_PATH = '.. /input/jigsaw-unintended-bias-in-toxicity-classification/train.csv'
DF_TEST_PATH = '.. /input/jigsaw-unintended-bias-in-toxicity-classification/test.csv'
UNCASED_BERT_CONFIG = BertConfig('.. /input/bert-pretrained-models/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12/bert_config.json')
 FIRST_MODEL_PATH = '.. /input/bert-accumulate-500-weighted/bert_accumulate_500_weighted.bin'
SECOND_MODEL_PATH = '.. /input/bert-accumulate-250/bert_accumulate_250.bin'
UNCASED_DIR_PATH = '.. /input/bert-pretrained-models/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12/'
uncased_tokenizer = BertTokenizer.from_pretrained(UNCASED_DIR_PATH, cache_dir=None, do_lower_case=True )<define_variables>
def create_features(df, deploy=False):
def new_X(x_coordinate, play_direction):
if play_direction == 'left':
return 120.0 - x_coordinate
else:
return x_coordinate
def new_line(rush_team, field_position, yardline):
if rush_team == field_position:
return 10.0 + yardline
else:
return 60.0 +(50 - yardline)
 def new_orientation(angle, play_direction):
if play_direction == 'left':
new_angle = 360.0 - angle
if new_angle == 360.0:
new_angle = 0.0
return new_angle
else:
return angle
def euclidean_distance(x1,y1,x2,y2):
x_diff =(x1-x2)**2
y_diff =(y1-y2)**2
return np.sqrt(x_diff + y_diff)
 def back_direction(orientation):
if orientation > 180.0:
return 1
else:
return 0
def update_yardline(df):
new_yardline = df[df['NflId'] == df['NflIdRusher']]
new_yardline['YardLine'] = new_yardline[['PossessionTeam','FieldPosition','YardLine']].apply(lambda x: new_line(x[0],x[1],x[2]), axis=1)
 new_yardline = new_yardline[['GameId','PlayId','YardLine']]
return new_yardline
def update_orientation(df, yardline):
df['X'] = df[['X','PlayDirection']].apply(lambda x: new_X(x[0],x[1]), axis=1)
 df['Orientation'] = df[['Orientation','PlayDirection']].apply(lambda x: new_orientation(x[0],x[1]), axis=1)
 df['Dir'] = df[['Dir','PlayDirection']].apply(lambda x: new_orientation(x[0],x[1]), axis=1)
 df = df.drop('YardLine', axis=1)
 df = pd.merge(df, yardline, on=['GameId','PlayId'], how='inner')
 return df
def projection_features(df):
rad = 2 * np.pi *(90 - df[['Orientation']])/ 360
v_0 = df['S'].values * np.cos(rad ).values.reshape(-1)
 v_1 = np.sin(rad ).values.reshape(-1)
 a_0 = df['A'].values * np.cos(rad ).values.reshape(-1)
 a_1 = np.sin(rad)
 df['v_0'] = v_0
df['v_1'] = v_1
df['a_0'] = a_0
df['a_1'] = a_1
return df
def back_features(df):
carriers = df[df['NflId'] == df['NflIdRusher']][['GameId','PlayId','NflIdRusher','X','Y','Orientation','Dir','YardLine']]
carriers['back_from_scrimmage'] = carriers['YardLine'] - carriers['X']
carriers['back_oriented_down_field'] = carriers['Orientation'].apply(lambda x: back_direction(x))
carriers['back_moving_down_field'] = carriers['Dir'].apply(lambda x: back_direction(x))
carriers = carriers.rename(columns={'X':'back_X',
'Y':'back_Y'})
 carriers = carriers[['GameId','PlayId','NflIdRusher','back_X','back_Y','back_from_scrimmage','back_oriented_down_field','back_moving_down_field']]
return carriers
def features_relative_to_back(df, carriers):
player_distance = df[['GameId','PlayId','NflId','X','Y']]
player_distance = pd.merge(player_distance, carriers, on=['GameId','PlayId'], how='inner')
 player_distance = player_distance[player_distance['NflId'] != player_distance['NflIdRusher']]
player_distance['dist_to_back'] = player_distance[['X','Y','back_X','back_Y']].apply(lambda x: euclidean_distance(x[0],x[1],x[2],x[3]), axis=1)
 player_distance = player_distance.groupby(['GameId','PlayId','back_from_scrimmage','back_oriented_down_field','back_moving_down_field'])\ 
.agg({'dist_to_back':['min','max','mean','std']})\ 
.reset_index()
player_distance.columns = ['GameId','PlayId','back_from_scrimmage','back_oriented_down_field','back_moving_down_field',
'min_dist','max_dist','mean_dist','std_dist']
return player_distance
def defense_features(df):
rusher = df[df['NflId'] == df['NflIdRusher']][['GameId','PlayId','Team','X','Y']]
rusher.columns = ['GameId','PlayId','RusherTeam','RusherX','RusherY']
defense = pd.merge(df,rusher,on=['GameId','PlayId'],how='inner')
 defense = defense[defense['Team'] != defense['RusherTeam']][['GameId','PlayId','X','Y','RusherX','RusherY']]
defense['def_dist_to_back'] = defense[['X','Y','RusherX','RusherY']].apply(lambda x: euclidean_distance(x[0],x[1],x[2],x[3]), axis=1)
 defense = defense.groupby(['GameId','PlayId'])\ 
.agg({'def_dist_to_back':['min','max','mean','std']})\ 
.reset_index()
defense.columns = ['GameId','PlayId','def_min_dist','def_max_dist','def_mean_dist','def_std_dist']
return defense
def static_features(df):
static_features = df[df['NflId'] == df['NflIdRusher']][['GameId','PlayId','X','Y','S','A','Dis','Orientation','Dir',
'YardLine','Quarter','Down','Distance','DefendersInTheBox']].drop_duplicates()
static_features['DefendersInTheBox'] = static_features['DefendersInTheBox'].fillna(np.mean(static_features['DefendersInTheBox']))
return static_features
def combine_features(relative_to_back, defense, static, speed_frame, deploy=deploy):
df = pd.merge(relative_to_back,defense,on=['GameId','PlayId'],how='inner')
 df = pd.merge(df,static,on=['GameId','PlayId'],how='inner')
 df = pd.merge(df, speed_frame, on=['GameId','PlayId'],how='inner')
 if not deploy:
df = pd.merge(df, outcomes, on=['GameId','PlayId'], how='inner')
 return df
df = projection_features(df)
 speed_frame= df[['GameId','PlayId',
'a_0','a_1','v_0','v_1', 'Temperature', 'Humidity']]
yardline = update_yardline(df)
 df = update_orientation(df, yardline)
 back_feats = back_features(df)
 rel_back = features_relative_to_back(df, back_feats)
 def_feats = defense_features(df)
 static_feats = static_features(df)
 basetable = combine_features(rel_back, def_feats, static_feats, speed_frame, deploy=deploy)
 basetable[['a_0','a_1','v_0','v_1']] = basetable[['a_0','a_1','v_0','v_1']].fillna(0)
 basetable['Temperature'] = basetable['Temperature'].fillna(60.436442)
 basetable['Humidity'] = basetable['Humidity'].fillna(59.0)
 return basetable
replacings = [ 
('tRump', 'Trump'), 
("gov't", 'goverment'), 
('Brexit', 'Britain leaving EU'), 
('theglobeandmail', 'the globe and mail'), 
('Drumpf', 'Donald Trump'), 
('SB91', 'Senate Bill 91'), 
("Gov't", 'goverment'), 
('Trumpcare', 'AHCA'), 
('Trumpism', 'the policies advocated by Donald Trump'), 
('bigly', 'on a large scale'), 
("y'all", 'you all'), 
('Auwe', 'darn'), 
('Trumpian', 'bombast egotism lies'), 
('Trumpsters', 'Trump ideas'), 
('Vinis', 'vinis'), 
('Saullie', 'Evans'), 
('Koncerned', 'concerned'), 
('SJWs', 'SJW'), 
('TFWs', 'TFW'), 
('RangerMC', 'Ranger MC'), 
('civilbeat', 'civil beat'), 
('BCLibs', 'BC Libraries'), 
('garycrum', 'Gary Crum'), 
('Trudope', 'prime minister of Canada'), 
('Daesh', 'Islamic State'), 
("Qur'an", 'Quran'), 
('wiliki', 'wiki'), 
('OBAMAcare', 'Obamacare'), 
('cashapp24', 'cash app'), 
('Finicum', 'LaVoy'), 
('Donkel', 'dark'), 
('Trumpkins', 'Donald Trump meme'), 
('Cheetolini', 'Trump'), 
('brotherIn', 'brother in'), 
('Trudeaus', 'Trudeau'), 
('Beyak', 'Lynn'), 
('dailycaller', 'daily caller'), 
('Layla4', 'Layla'), 
('Tridentinus', 'mushroom'), 
('Ontariowe', 'Ontario WE'), 
('washingtontimes', 'Washington Times')
 ]
symbols_to_isolate = '.,?!-;*"…:—() %
symbols_to_delete = '
🍕\r🐵😑\xa0\ue014\t\uf818\uf04a\xad😢🐶️\uf0e0😜😎👊\u200b\u200e😁عدويهصقأناخلىبمغر😍💖💵Е👎😀😂\u202a\u202c🔥😄🏻💥ᴍʏʀᴇɴᴅᴏᴀᴋʜᴜʟᴛᴄᴘʙғᴊᴡɢ😋👏שלוםבי😱‼\x81エンジ故障\u2009🚌ᴵ͞🌟😊😳😧🙀😐😕\u200f👍😮😃😘אעכח💩💯⛽🚄🏼ஜ😖ᴠ🚲‐😟😈💪🙏🎯🌹😇💔😡\x7f👌ἐὶήιὲκἀίῃἴξ🙄Ｈ😠\ufeff\u2028😉😤⛺🙂\u3000تحكسة👮💙فزط😏🍾🎉😞\u2008🏾😅😭👻😥😔😓🏽🎆🍻🍽🎶🌺🤔😪\x08‑🐰🐇🐱🙆😨🙃💕𝘊𝘦𝘳𝘢𝘵𝘰𝘤𝘺𝘴𝘪𝘧𝘮𝘣💗💚地獄谷улкнПоАН🐾🐕😆ה🔗🚽歌舞伎🙈😴🏿🤗🇺🇸мυтѕ⤵🏆🎃😩\u200a🌠🐟💫💰💎эпрд\x95🖐🙅⛲🍰🤐👆🙌\u2002💛🙁👀🙊🙉\u2004ˢᵒʳʸᴼᴷᴺʷᵗʰᵉᵘ\x13🚬🤓\ue602😵άοόςέὸתמדףנרךצט😒͝🆕👅👥👄🔄🔤👉👤👶👲🔛🎓\uf0b7\uf04c\x9f\x10成都😣⏺😌🤑🌏😯ех😲Ἰᾶὁ💞🚓🔔📚🏀👐\u202d💤🍇\ue613小土豆🏡❔⁉\u202f👠》कर्मा🇹🇼🌸蔡英文🌞🎲レクサス😛外国人关系Сб💋💀🎄💜🤢َِьыгя不是\x9c\x9d🗑\u2005💃📣👿༼つ༽😰ḷЗз▱ц￼🤣卖温哥华议会下降你失去所有的钱加拿大坏税骗子🐝ツ🎅\x85🍺آإشء🎵🌎͟ἔ油别克🤡🤥😬🤧й\u2003🚀🤴ʲшчИОРФДЯМюж😝🖑ὐύύ特殊作戦群щ💨圆明园קℐ🏈😺🌍⏏ệ🍔🐮🍁🍆🍑🌮🌯🤦\u200d𝓒𝓲𝓿𝓵안영하세요ЖљКћ🍀😫🤤ῦ我出生在了可以说普通话汉语好极🎼🕺🍸🥂🗽🎇🎊🆘🤠👩🖒🚪天一家⚲\u2006⚭⚆⬭⬯⏖新✀╌🇫🇷🇩🇪🇮🇬🇧😷🇨🇦ХШ🌐\x1f杀鸡给猴看ʁ𝗪𝗵𝗲𝗻𝘆𝗼𝘂𝗿𝗮𝗹𝗶𝘇𝗯𝘁𝗰𝘀𝘅𝗽𝘄𝗱📺ϖ\u2000үսᴦᎥһͺ\u2007հ\u2001ɩｙｅ൦ｌƽｈ𝐓𝐡𝐞𝐫𝐮𝐝𝐚𝐃𝐜𝐩𝐭𝐢𝐨𝐧Ƅᴨןᑯ໐ΤᏧ௦Іᴑ܁𝐬𝐰𝐲𝐛𝐦𝐯𝐑𝐙𝐣𝐇𝐂𝐘𝟎ԜТᗞ౦〔Ꭻ𝐳𝐔𝐱𝟔𝟓𝐅🐋ﬃ💘💓ё𝘥𝘯𝘶💐🌋🌄🌅𝙬𝙖𝙨𝙤𝙣𝙡𝙮𝙘𝙠𝙚𝙙𝙜𝙧𝙥𝙩𝙪𝙗𝙞𝙝𝙛👺🐷ℋ𝐀𝐥𝐪🚶𝙢Ἱ🤘ͦ💸ج패티Ｗ𝙇ᵻ👂👃ɜ🎫\uf0a7БУі🚢🚂ગુજરાતીῆ🏃𝓬𝓻𝓴𝓮𝓽𝓼☘﴾̯﴿₽\ue807𝑻𝒆𝒍𝒕𝒉𝒓𝒖𝒂𝒏𝒅𝒔𝒎𝒗𝒊👽😙\u200cЛ‒🎾👹⎌🏒⛸公寓养宠物吗🏄🐀🚑🤷操美𝒑𝒚𝒐𝑴🤙🐒欢迎来到阿拉斯ספ𝙫🐈𝒌𝙊𝙭𝙆𝙋𝙍𝘼𝙅ﷻ🦄巨收赢得白鬼愤怒要买额ẽ🚗🐳𝟏𝐟𝟖𝟑𝟕𝒄𝟗𝐠𝙄𝙃👇锟斤拷𝗢𝟳𝟱𝟬⦁マルハニチロ株式社⛷한국어ㄸㅓ니͜ʖ𝘿𝙔₵𝒩ℯ𝒾𝓁𝒶𝓉𝓇𝓊𝓃𝓈𝓅ℴ𝒻𝒽𝓀𝓌𝒸𝓎𝙏ζ𝙟𝘃𝗺𝟮𝟭𝟯𝟲👋🦊多伦🐽🎻🎹⛓🏹🍷🦆为和中友谊祝贺与其想象对法如直接问用自己猜本传教士没积唯认识基督徒曾经让相信耶稣复活死怪他但当们聊些政治题时候战胜因圣把全堂结婚孩恐惧且栗谓这样还♾🎸🤕🤒⛑🎁批判检讨🏝🦁🙋😶쥐스탱트뤼도석유가격인상이경제황을렵게만들지않록잘관리해야합다캐나에서대마초와화약금의품런성분갈때는반드시허된사용🔫👁凸ὰ💲🗯𝙈Ἄ𝒇𝒈𝒘𝒃𝑬𝑶𝕾𝖙𝖗𝖆𝖎𝖌𝖍𝖕𝖊𝖔𝖑𝖉𝖓𝖐𝖜𝖞𝖚𝖇𝕿𝖘𝖄𝖛𝖒𝖋𝖂𝕴𝖟𝖈𝕸👑🚿💡知彼百\uf005𝙀𝒛𝑲𝑳𝑾𝒋𝟒😦𝙒𝘾𝘽🏐𝘩𝘨ὼṑ𝑱𝑹𝑫𝑵𝑪🇰🇵👾ᓇᒧᔭᐃᐧᐦᑳᐨᓃᓂᑲᐸᑭᑎᓀᐣ🐄🎈🔨🐎🤞🐸💟🎰🌝🛳点击查版🍭𝑥𝑦𝑧ＮＧ👣\uf020っ🏉ф💭🎥Ξ🐴👨🤳🦍\x0b🍩𝑯𝒒😗𝟐🏂👳🍗🕉🐲چی𝑮𝗕𝗴🍒ꜥⲣⲏ🐑⏰鉄リ事件ї💊「」\uf203\uf09a\uf222\ue608\uf202\uf099\uf469\ue607\uf410\ue600燻製シ虚偽屁理屈Г𝑩𝑰𝒀𝑺🌤𝗳𝗜𝗙𝗦𝗧🍊ὺἈἡχῖΛ⤏🇳𝒙ψՁմեռայինրւդձ冬至ὀ𝒁🔹🤚🍎𝑷🐂💅𝘬𝘱𝘸𝘷𝘐𝘭𝘓𝘖𝘹𝘲𝘫کΒώ💢ΜΟΝΑΕ🇱♲𝝈↴💒⊘Ȼ🚴🖕🖤🥘📍👈➕🚫🎨🌑🐻𝐎𝐍𝐊𝑭🤖🎎😼🕷ｇｒｎｔｉｄｕｆｂｋ𝟰🇴🇭🇻🇲𝗞𝗭𝗘𝗤👼📉🍟🍦🌈🔭《🐊🐍\uf10aლڡ🐦\U0001f92f\U0001f92a🐡💳ἱ🙇𝗸𝗟𝗠𝗷🥜さようなら🔼'
tree_tokenizer = TreebankWordTokenizer()
isolate_dict = {ord(c):f' {c} ' for c in symbols_to_isolate}
remove_dict = {ord(c):f'' for c in symbols_to_delete}
def handle_punctuation(x):
x = x.translate(remove_dict)
 x = x.translate(isolate_dict)
 return x
def handle_contractions(x):
x = tree_tokenizer.tokenize(x)
 return x
def fix_quote(x):
x = [x_[1:] if x_.startswith("'")else x_ for x_ in x]
x = ' '.join(x)
 return x
def preprocess(x):
x = handle_punctuation(x)
 x = handle_contractions(x)
 x = fix_quote(x)
 for was, became in replacings:
x = x.replace(was, became)
 return x 
<categorify>
%time train_basetable = create_features(train, False )
class Collator(object):
def __init__(self, device='cpu', maxlen=500):
self.maxlen = maxlen
self.device = device
def __call__(self, batch):
xs = batch
maxlen = min(max(map(len, xs)) , self.maxlen)
 x = np.zeros([len(xs), maxlen], dtype=np.int64)
 mask = np.zeros([len(xs), maxlen], dtype=np.int64)
 for i in range(len(xs)) :
if len(xs[i])> 500:
xs[i] = xs[i][:100] + xs[i][-400:]
x[i, :len(xs[i])] = xs[i]
mask[i, :len(xs[i])] = 1
return {
'input_ids': torch.LongTensor(x ).to(self.device),
'attention_mask': torch.LongTensor(mask ).to(self.device),
}
class TextsDataset(Dataset):
def __init__(self, df, tokenizer):
self.df = df
self.tokenizer = tokenizer
def __len__(self):
return len(self.df)
 def __getitem__(self, idx):
return self.tokenizer.convert_tokens_to_ids(['[CLS]'] + self.tokenizer.tokenize(self.df.iloc[idx][TEXT_COL])+ ['[SEP]'])
 class BertClassifier(nn.Module):
def __init__(self, config, n_labels):
super(BertClassifier, self ).__init__()
self.bert = BertModel(config)
 self.out = nn.Linear(config.hidden_size, n_labels)
 self.criterion = nn.BCEWithLogitsLoss(reduction='none')
 def forward(self, input_ids, token_type_ids=None, attention_mask=None,
output_all_encoded_layers=True, increase_weight=None, labels=None):
_, pooled_output = self.bert(input_ids, token_type_ids, attention_mask,
output_all_encoded_layers=False)
 logits = self.out(pooled_output)
 if labels is None or increase_weight is None:
return logits
def get_dataloader(df, tokenizer, collator, batch_size):
return DataLoader(TextsDataset(df, tokenizer), batch_size, shuffle=False, collate_fn=collator)
 def get_preds(model, dl):
model.eval()
with torch.no_grad() :
preds = np.zeros([len(test_dl.dataset)], dtype=np.float32)
 idx = 0
for batch in tqdm(test_dl):
pr = torch.sigmoid(model(input_ids=batch['input_ids'], attention_mask=batch['attention_mask'], increase_weight=None)).cpu().numpy() [:, 0]
preds[idx: idx + len(pr)] = pr
idx += len(pr)
 return preds<load_from_csv>
X = train_basetable.copy()
yards = X.Yards
y = np.zeros(( yards.shape[0], 1))
_y = np.zeros(( yards.shape[0], 199))
for idx, target in enumerate(list(yards)) :
y[idx] = target
_y[idx][99 + target] = 1
X.drop(['GameId','PlayId','Yards'], axis=1, inplace=True)
 scaler = StandardScaler()
X = scaler.fit_transform(X )
test_df = pd.read_csv(DF_TEST_PATH)
 test_df[TEXT_COL] = test_df[TEXT_COL].apply(preprocess)
 device = torch.device('cuda')
 collator = Collator(device)
 test_dl = get_dataloader(test_df, uncased_tokenizer, collator, 32 )<define_variables>
def get_model(size=X.shape[1]):
model = Sequential()
model.add(GaussianNoise(0.05))
model.add(BatchNormalization())
 model.add(Dense(256, input_dim=size, activation=None))
model.add(ELU())
 model.add(GaussianNoise(0.05))
model.add(Dropout(0.5))
model.add(BatchNormalization())
 model.add(Dense(256, activation=None))
model.add(ELU())
 model.add(GaussianNoise(0.05))
model.add(BatchNormalization())
 model.add(Dense(1, activation=None))
model.compile(optimizer=Adam(lr=0.001), loss='mae')
 return model
def get_model_v2(size=X.shape[1]):
model = Sequential()
model.add(Dense(256, input_dim=size, activation=None))
model.add(BatchNormalization())
 model.add(PReLU())
 model.add(Dropout(0.5))
model.add(Dense(256, activation=None))
model.add(BatchNormalization())
 model.add(PReLU())
 model.add(BatchNormalization())
 model.add(Dense(199, activation='softmax'))
model.compile(optimizer=Adam(lr=0.0005), loss='categorical_crossentropy', metrics=[])
 return model
model_path2n_out = {
FIRST_MODEL_PATH: 6,
SECOND_MODEL_PATH: 6
}<load_pretrained>
from sklearn.model_selection import KFold, GroupKFold
preds = []
for i, p in enumerate([FIRST_MODEL_PATH, SECOND_MODEL_PATH]):
model = BertClassifier(UNCASED_BERT_CONFIG, model_path2n_out[p] ).to(device)
 model.load_state_dict(torch.load(p, map_location=device))
preds.append(get_preds(model, test_dl)) 
<save_to_csv>
models = []
oof_predictions = np.zeros(shape=(X.shape[0]))
rkf = GroupKFold(11)
 FOLD_LIST = list(rkf.split(train_basetable['GameId'],train_basetable['GameId'],train_basetable['GameId']))
for fold_id,(tr_idx, vl_idx)in enumerate(FOLD_LIST):
print(fold_id)
 x_tr, y_tr = X[tr_idx], y[tr_idx]
x_vl, y_vl = X[vl_idx], y[vl_idx]
model= get_model(X.shape[1])
 es = EarlyStopping(monitor='val_loss',
mode='min',
restore_best_weights=True,
verbose=1,
patience=5)
 model.fit(x_tr, y_tr, epochs=200, batch_size=1024, validation_data=[x_vl, y_vl], callbacks=[es])
 oof_predictions[vl_idx] += model.predict(x_vl ).reshape(-1)
 models.append(model)
submission = pd.DataFrame.from_dict({
'id': test_df['id'],
'prediction': np.average(preds, axis=0)
 })
 submission.to_csv('submission.csv', index=False )<define_variables>
from scipy.stats import spearmanr, pearsonr
package_dir = ".. /input/privatepytorchpretrainedbert/ppbert/pytorch-pretrained-bert/pytorch-pretrained-BERT"
sys.path.append(package_dir )<set_options>
print(
 pearsonr(y.reshape(-1), oof_predictions.reshape(-1)) ,
spearmanr(y.reshape(-1), oof_predictions.reshape(-1))
)
warnings.filterwarnings(action='once')
 device = torch.device('cuda' )<string_transform>
_X = np.hstack([X, oof_predictions.reshape(-1,1)] )
def convert_lines(example, max_seq_length,tokenizer):
max_seq_length -=2
all_tokens = []
longer = 0
for text in tqdm(example):
tokens_a = tokenizer.tokenize(text)
 if len(tokens_a)>max_seq_length:
first = int(math.ceil(max_seq_length * 0.25))
last = max_seq_length - first
print(first)
 print(last)
 tokens_first = tokens_a[:first]
tokens_last = tokens_a[-last:]
tokens_a = tokens_first + tokens_last
longer += 1
one_token = tokenizer.convert_tokens_to_ids(["[CLS]"]+tokens_a+["[SEP]"])+[0] *(max_seq_length - len(tokens_a))
all_tokens.append(one_token)
 print("Number of sequences longer: ", longer)
 return np.array(all_tokens )<define_variables>
class Metric(Callback):
def __init__(self, model, callbacks, data):
super().__init__()
self.model = model
self.callbacks = callbacks
self.data = data
def on_train_begin(self, logs=None):
for callback in self.callbacks:
callback.on_train_begin(logs)
 def on_train_end(self, logs=None):
for callback in self.callbacks:
callback.on_train_end(logs)
 def on_epoch_end(self, batch, logs=None):
logs['tr_CRPS'] = 0
X_valid, y_valid = self.data[1][0], self.data[1][1]
y_pred = self.model.predict(X_valid)
 y_true = np.clip(np.cumsum(y_valid, axis=1), 0, 1)
 y_pred = np.clip(np.cumsum(y_pred, axis=1), 0, 1)
 val_s =(( y_true - y_pred)** 2 ).sum(axis=1 ).sum(axis=0)/(199 * X_valid.shape[0])
 val_s = np.round(val_s, 6)
 logs['val_CRPS'] = val_s
print('tr CRPS', 'Grr', 'val CRPS', val_s)
 for callback in self.callbacks:
callback.on_epoch_end(batch, logs )
all_preds = []
model_weights = [".. /input/bestbert-360-e1/bestbert_360_len1.bin",
".. /input/bestbert-360-m2-e1/bestbert_360_2_len1.bin",
".. /input/bert-360-lin-inc-lr-m2-e1/bestbert_360_lin_dec_m2_1.bin",
".. /input/bert360-lin-dec-e1-m1/bert360_lin_dec_pytorch1.bin",
".. /input/bert-2-epoch/bert_pytorch_2_epoch/bert_pytorch.bin"]
model_paths = [".. /input/bertpretraineduncasedmodel/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12",
".. /input/bertpretraineduncasedmodel/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12",
".. /input/bertpretraineduncasedmodel/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12",
".. /input/bertpretraineduncasedmodel/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12",
".. /input/bertpretraineduncasedmodel/uncased_l-12_h-768_a-12/uncased_L-12_H-768_A-12"]
model_configs = ['.. /input/cicero-bert-config/cicero_bert_config.json',
'.. /input/cicero-bert-config/cicero_bert_config.json',
'.. /input/cicero-bert-config/cicero_bert_config.json',
'.. /input/cicero-bert-config/cicero_bert_config.json',
'.. /input/cicero-bert-config/cicero_bert_config.json']
max_seq_lengths = [360, 360, 360, 360, 220]
test_df = pd.read_csv(".. /input/jigsaw-unintended-bias-in-toxicity-classification/test.csv")
 test_df['comment_text'] = test_df['comment_text'].astype(str)
 for idx in range(len(model_weights)) :
MAX_SEQUENCE_LENGTH = max_seq_lengths[idx]
BATCH_SIZE = 32
BERT_MODEL_PATH = model_paths[idx]
bert_config = BertConfig(model_configs[idx])
 tokenizer = BertTokenizer.from_pretrained(BERT_MODEL_PATH, cache_dir=None,do_lower_case=True)
 X_test = convert_lines(test_df["comment_text"].fillna("DUMMY_VALUE"), MAX_SEQUENCE_LENGTH, tokenizer)
 model = BertForSequenceClassification(bert_config, num_labels=7)
 model.load_state_dict(torch.load(model_weights[idx]))
model.to(device)
 for param in model.parameters() :
param.requires_grad = False
model.eval()
test_preds = np.zeros(( len(X_test)))
 test = torch.utils.data.TensorDataset(torch.tensor(X_test, dtype=torch.long))
test_loader = torch.utils.data.DataLoader(test, batch_size=32, shuffle=False)
 tk0 = tqdm(test_loader)
 for i,(x_batch,)in enumerate(tk0):
pred = model(x_batch.to(device), attention_mask=(x_batch > 0 ).to(device), labels=None)
 test_preds[i * 32:(i + 1)* 32] = pred[:, 0].detach().cpu().squeeze().numpy()
all_preds.append(torch.sigmoid(torch.tensor(test_preds)).numpy().ravel())
 del model
gc.collect()<save_to_csv>
_models = []
oof_predictions = np.zeros(shape=(_X.shape[0]))
for fold_id,(tr_idx, vl_idx)in enumerate(FOLD_LIST):
print(fold_id)
 x_tr, y_tr = _X[tr_idx], _y[tr_idx]
x_vl, y_vl = _X[vl_idx], _y[vl_idx]
model= get_model_v2(_X.shape[1])
 es = EarlyStopping(monitor='val_CRPS',
mode='min',
restore_best_weights=True,
verbose=1,
patience=3)
 es.set_model(model)
 metric = Metric(model, [es], [(x_tr, y_tr),(x_vl, y_vl)])
 model.fit(x_tr, y_tr, callbacks=[metric], epochs=5, batch_size=1024, validation_data=[x_vl, y_vl])
 _models.append(model)
<set_options><EOS> 
class GP:
def __init__(self):
self.classes = 20
self.class_names = [ 'class_0',
'class_1',
'class_2',
'class_3',
'class_4',
'class_5',
'class_6',
'class_7',
'class_8',
'class_9',
'class_10',
'class_11',
'class_12',
'class_13',
'class_14',
'class_15',
'class_16',
'class_17',
'class_18',
'class_19',
]
def GrabPredictions(self, data):
oof_preds = np.zeros(( len(data), len(self.class_names)))
 oof_preds[:,0] = self.GP_class_0(data)
 oof_preds[:,1] = self.GP_class_1(data)
 oof_preds[:,2] = self.GP_class_2(data)
 oof_preds[:,3] = self.GP_class_3(data)
 oof_preds[:,4] = self.GP_class_4(data)
 oof_preds[:,5] = self.GP_class_5(data)
 oof_preds[:,6] = self.GP_class_6(data)
 oof_preds[:,7] = self.GP_class_7(data)
 oof_preds[:,8] = self.GP_class_8(data)
 oof_preds[:,9] = self.GP_class_9(data)
 oof_preds[:,10] = self.GP_class_10(data)
 oof_preds[:,11] = self.GP_class_11(data)
 oof_preds[:,12] = self.GP_class_12(data)
 oof_preds[:,13] = self.GP_class_13(data)
 oof_preds[:,14] = self.GP_class_14(data)
 oof_preds[:,15] = self.GP_class_15(data)
 oof_preds[:,16] = self.GP_class_16(data)
 oof_preds[:,17] = self.GP_class_17(data)
 oof_preds[:,18] = self.GP_class_18(data)
 oof_preds[:,19] = self.GP_class_19(data)
 oof_df = pd.DataFrame(np.exp(oof_preds), columns=self.class_names)
 oof_df =oof_df.div(oof_df.sum(axis=1), axis=0)
 return oof_df.values
def GP_class_0(self,data):
return(0.250000*np.tanh(((((((data[:,0])-(((data[:,0])+(data[:,0])))))+(data[:,0])))+(((((data[:,0])* 2.0)) * 2.0)))) +
0.250000*np.tanh(((((((((((((data[:,2])-(data[:,7])))* 2.0)) +(data[:,7])))* 2.0)) +(data[:,0])))+(((((data[:,2])+(data[:,0])))-(data[:,7])))))+
0.250000*np.tanh(((((((((((((((((((data[:,3])-(data[:,7])))-(((data[:,0])/ 2.0)))) +(data[:,0])))-(data[:,7])))+(data[:,2])))+(((data[:,7])+(data[:,2])))))+(data[:,7])))-(data[:,7])))+(data[:,0])))+
0.250000*np.tanh(((((((((data[:,0])-(data[:,7])))-(data[:,14])))+(((data[:,17])-(data[:,14])))))+(((((((data[:,0])-(( 1.0)))) -(data[:,0])))+(data[:,20])))))+
0.250000*np.tanh(((((data[:,18])+(((((((data[:,0])-(data[:,7])))+(data[:,2])))+(data[:,0])))))-(((data[:,7])+(data[:,2])))))+
0.250000*np.tanh(((((((( data[:,8])+(((((((( data[:,13])+(data[:,3])))+(data[:,0])) /2.0)) +(((((((( data[:,0])+(((((data[:,0])-(data[:,0])))/ 2.0)))) +(data[:,17])) /2.0)) +(data[:,11])))))) /2.0)) +(data[:,0])))-(data[:,13])))+
0.250000*np.tanh(((((data[:,0])* 2.0)) +(((((((((data[:,2])+(data[:,2])))* 2.0)) -(((data[:,14])-(((np.tanh(( data[:,2])))* 2.0)))))) -(data[:,7])))))+
0.250000*np.tanh(((((((((((((data[:,17])-(((data[:,17])*(((((data[:,17])*(data[:,17])))* 2.0)))))) +(((((((data[:,17])* 2.0)) * 2.0)) * 2.0)))/2.0)) / 2.0)) +(((data[:,17])-(( 7.76236486434936523)))))/2.0)) +(((((((data[:,17])*(data[:,17])))* 2.0)) * 2.0)))) +
0.250000*np.tanh(((((((((((data[:,17])+(data[:,17])) /2.0)) +(((( data[:,17])+(((( data[:,17])+(data[:,17])) /2.0)))/2.0)))/2.0)) *(data[:,17])))-(data[:,13])))+
0.250000*np.tanh(((((( data[:,19])+(((((((((data[:,19])* 2.0)) +(data[:,19])))-(( 1.07645297050476074)))) +(((data[:,22])+(data[:,22])))))) /2.0)) +(((data[:,22])+(data[:,4]))))))
def GP_class_1(self,data):
return(0.250000*np.tanh(((((((((((((data[:,3])+(((np.tanh(( data[:,2])))-(data[:,14])))))-(( 10.0)))) -(( 4.88989353179931641)))) -(( 13.92175483703613281)))) / 2.0)) -(data[:,6])))+
0.250000*np.tanh(data[:,3])+
0.250000*np.tanh(((data[:,2])+(((((np.tanh(((( data[:,14])* 2.0)))) -(((((((data[:,7])* 2.0)) -(((((data[:,0])-(data[:,14])))-(data[:,7])))))-(data[:,0])))))+(data[:,0])))))+
0.250000*np.tanh(((((((data[:,0])-(( -1.0*(( data[:,14])))))) +(((((((((( data[:,0])-(data[:,7])))-(((( data[:,14])+(data[:,14])) /2.0)))) +(((data[:,2])-(((data[:,0])*(data[:,14])))))) /2.0)) -(data[:,14])))))-(data[:,7])))+
0.250000*np.tanh(((((data[:,0])/ 2.0)) +(data[:,0])))+
0.250000*np.tanh(((((data[:,19])-(data[:,19])))/ 2.0)) +
0.250000*np.tanh(((((np.tanh(((( np.tanh(( data[:,5])))-(((( 1.69341480731964111)) +(((((( np.tanh(( data[:,14])))-(data[:,14])))+(data[:,14])) /2.0)))))))) -(data[:,2])))-(((data[:,14])* 2.0)))) +
0.250000*np.tanh(((((( data[:,22])+(((data[:,0])+(((((((( data[:,22])/ 2.0)) +(( -1.0*(( data[:,13])))))/2.0)) +(data[:,19])))))) /2.0)) -(data[:,13])))+
0.250000*np.tanh(((((((data[:,17])/ 2.0)) *(data[:,17])))*(((data[:,17])+(((data[:,17])*(((((((((data[:,17])+(data[:,17])))*(data[:,17])))*(data[:,17])))+(((np.tanh(( data[:,17])))/ 2.0)))))))))) +
0.250000*np.tanh(((((( data[:,14])*(((data[:,13])+(data[:,3])))))+(((data[:,14])*(((data[:,14])-(( -1.0*(( data[:,3])))))))))/2.0)))
 def GP_class_2(self,data):
return(0.250000*np.tanh(((data[:,0])+(np.tanh(((((((((( data[:,2])+(((data[:,2])/ 2.0)))/2.0)) +(data[:,0])) /2.0)) *(data[:,7])))))))+
0.250000*np.tanh(((( data[:,22])+(data[:,22])) /2.0)) +
0.250000*np.tanh(((((( data[:,14])+(( -1.0*(((((( 4.73206138610839844)) +(((((((((((np.tanh(( data[:,7])))+(data[:,1])) /2.0)) -(np.tanh(((((( data[:,0])-(data[:,20])))-(data[:,14])))))))*(( 7.0)))) +(data[:,14])) /2.0)))/2.0)))))) /2.0)) -(data[:,14])))+
0.250000*np.tanh(((((data[:,1])+(( 4.15603733062744141)))) / 2.0)) +
0.250000*np.tanh(((((((((((((data[:,0])-(data[:,7])))-(data[:,7])))+(((( data[:,0])+(data[:,0])) /2.0)))) * 2.0)) +(data[:,0])))* 2.0)) +
0.250000*np.tanh(((((data[:,11])/ 2.0)) / 2.0)) +
0.250000*np.tanh(((((((((((((((((((((((data[:,2])/ 2.0)) +(((data[:,2])/ 2.0)))/2.0)) / 2.0)) / 2.0)) / 2.0)) +(((( -1.0*(((( data[:,0])/ 2.0)))))*(((data[:,0])/ 2.0)))))/2.0)) +(data[:,0])) /2.0)) +(np.tanh(( data[:,0])))) /2.0)) / 2.0)) +
0.250000*np.tanh(((((data[:,0])+(((data[:,0])+(((((((data[:,14])*(data[:,14])))+(data[:,14])))-(data[:,0])))))))-(data[:,14])))+
0.250000*np.tanh(((((( np.tanh(( np.tanh(((0.0)))))) *(data[:,15])))+(data[:,20])) /2.0)) +
0.250000*np.tanh(((data[:,14])*(((( data[:,13])+(((( data[:,13])+(((( data[:,14])+(((((( data[:,14])+(((( data[:,14])+(((data[:,13])-(((( -1.0*(((((data[:,14])+(data[:,14])) /2.0)))))* 2.0)))))/2.0)))) +(data[:,14])) /2.0)))/2.0)))/2.0)))/2.0)))))
 def GP_class_3(self,data):
return(0.250000*np.tanh(((((((((8.0)) +(((((((5.33416414260864258)) +(( 9.0)))/2.0)) +(((( 8.0)) * 2.0)))))) * 2.0)) +(( 5.33416414260864258)))/2.0)) +
0.250000*np.tanh(((( 9.48088836669921875)) +(((((10.56953334808349609)) +(((( 4.48959350585937500)) +(np.tanh(((((3.0)) +(( 9.0)))))))))/2.0)))) +
0.250000*np.tanh(((((((((( data[:,22])/ 2.0)) +(data[:,22])) /2.0)) * 2.0)) / 2.0)) +
0.250000*np.tanh(( 10.44883441925048828)) +
0.250000*np.tanh(((((data[:,0])+(((data[:,0])+(( -1.0*(( data[:,9])))))))) +(((((data[:,0])-(data[:,7])))-(data[:,9])))))+
0.250000*np.tanh(((np.tanh(( data[:,6])))-(data[:,21])))+
0.250000*np.tanh(((data[:,0])-(((((data[:,14])+(((((data[:,14])+(((data[:,14])+(((data[:,14])-(data[:,0])))))))-(((((data[:,0])-(data[:,14])))+(data[:,14])))))))-(((((data[:,14])*(data[:,14])))+(data[:,18])))))))+
0.250000*np.tanh(((data[:,14])*(((( data[:,13])+(data[:,14])) /2.0)))) +
0.250000*np.tanh(((((( data[:,8])*(((data[:,8])/ 2.0)))) +(((((( data[:,9])*(data[:,8])))+(data[:,8])) /2.0)))/2.0)) +
0.250000*np.tanh(((( data[:,2])+(((((((data[:,2])+(data[:,20])) /2.0)) +(((((((( data[:,2])+(data[:,8])) /2.0)) / 2.0)) -(data[:,8])))) /2.0)))/2.0)))
 def GP_class_4(self,data):
return(0.250000*np.tanh(((( 12.98819637298583984)) / 2.0)) +
0.250000*np.tanh(((((4.75780344009399414)) +(((((((8.66014671325683594)) +(( 4.18107128143310547)))/2.0)) *(( 8.97841739654541016)))))/2.0)) +
0.250000*np.tanh(((( 9.0)) / 2.0)) +
0.250000*np.tanh(((((((((((10.0)) +(np.tanh(((((( 6.0)) +(((( 13.80149555206298828)) +(( 7.0)))))/2.0)))))) +(( 10.0)))) +(((((((data[:,0])+(( 8.0)))) / 2.0)) / 2.0)))/2.0)) +(((( -1.0*(((( data[:,2])*(data[:,9])))))) * 2.0)))) +
0.250000*np.tanh(((((data[:,0])+(((((((data[:,22])+(data[:,22])) /2.0)) +(data[:,22])) /2.0)))) +(((((( data[:,22])+(((((( data[:,22])* 2.0)) +(data[:,22])) /2.0)))) +(data[:,18])) /2.0)))) +
0.250000*np.tanh(((((((((((((np.tanh(( data[:,18])))+(((( data[:,1])+(data[:,18])) /2.0)))/2.0)) *(data[:,18])))*(data[:,18])))+(((data[:,18])*(data[:,18])))) /2.0)) -(((((((np.tanh(( data[:,18])))+(((data[:,18])*(data[:,18])))) /2.0)) +(data[:,17])) /2.0)))) +
0.250000*np.tanh(((np.tanh(((((((np.tanh(( data[:,6])))-(((np.tanh(( data[:,6])))-(data[:,6])))))+(np.tanh(( data[:,6])))) /2.0)))) -(((( data[:,10])+(((( data[:,2])+(((np.tanh(( data[:,6])))-(((np.tanh(( np.tanh(( data[:,6])))))-(data[:,10])))))) /2.0)))/2.0)))) +
0.250000*np.tanh(((((((((((( data[:,10])+(data[:,4])))+(((data[:,10])+(((data[:,0])*(data[:,10])))))) /2.0)) +(((data[:,4])*(((data[:,10])+(data[:,4])))))) /2.0)) +(data[:,7])) /2.0)) +
0.250000*np.tanh(((((( data[:,11])+(((((data[:,18])/ 2.0)) *(((data[:,11])*(data[:,18])))))) /2.0)) *(((data[:,18])*(((((((((data[:,18])*(((((((data[:,11])/ 2.0)) / 2.0)) *(data[:,18])))))/ 2.0)) / 2.0)) *(( -1.0*(( data[:,21])))))))))) +
0.250000*np.tanh(((( -1.0*(((((((((((( data[:,2])-(data[:,2])))*(np.tanh(( data[:,2])))))+(np.tanh(((( data[:,14])* 2.0)))))/2.0)) +(data[:,2])) /2.0)))))-(data[:,2]))))
def GP_class_5(self,data):
return(0.250000*np.tanh(((((((((((3.46574378013610840)) +(((( np.tanh(((3.46574378013610840)))) +(( 8.46705245971679688)))/2.0)))/2.0)) * 2.0)) +(((( 3.46574378013610840)) +(( 4.0)))))) +(((( 4.0)) * 2.0)))) +
0.250000*np.tanh(((( 10.55856513977050781)) / 2.0)) +
0.250000*np.tanh(((( 3.76695251464843750)) / 2.0)) +
0.250000*np.tanh(((((( 6.0)) / 2.0)) +(((( 8.57984828948974609)) * 2.0)))) +
0.250000*np.tanh(((((((((((( 3.42168045043945312)) +(data[:,7])))+(np.tanh(( data[:,7])))))+(np.tanh(( np.tanh(( np.tanh(((3.42168045043945312)))))))))/2.0)) +(data[:,7])) /2.0)) +
0.250000*np.tanh(((((((((((data[:,6])-(data[:,9])))+(data[:,7])) /2.0)) * 2.0)) +(((((( data[:,7])+(data[:,9])) /2.0)) -(data[:,9])))) /2.0)) +
0.250000*np.tanh(((((((((((data[:,22])+(data[:,22])))+(data[:,11])) /2.0)) +(data[:,22])) /2.0)) / 2.0)) +
0.250000*np.tanh(((((((((( 0.76044219732284546)) / 2.0)) +(( 0.76044219732284546)))/2.0)) +(np.tanh(( np.tanh(((((((( 0.76043862104415894)) / 2.0)) +(( 1.0)))/2.0)))))))/2.0)) +
0.250000*np.tanh(((((((data[:,12])+(np.tanh(( data[:,9])))) /2.0)) +(((((((((((data[:,12])+(((((0.0)) +(np.tanh(((((((( data[:,7])+(data[:,6])) /2.0)) +(data[:,7])) /2.0)))))/2.0)))/2.0)) / 2.0)) / 2.0)) +(data[:,7])) /2.0)))/2.0)) +
0.250000*np.tanh(((((((((data[:,20])/ 2.0)) / 2.0)) *(((np.tanh(( data[:,20])))*(((data[:,20])/ 2.0)))))) *(((((( data[:,20])/ 2.0)) +(((data[:,20])/ 2.0)))/2.0)))))
 def GP_class_6(self,data):
return(0.250000*np.tanh(((((((11.68076229095458984)) +(((((11.68075847625732422)) +(((( 11.47270107269287109)) +(((((11.47269725799560547)) +(( 11.68076229095458984)))/2.0)))))/2.0)))/2.0)) +(((( 4.0)) * 2.0)))) +
0.250000*np.tanh(((( 8.0)) +(((( 10.0)) +(( 6.59042119979858398)))))) +
0.250000*np.tanh(((((((((((13.33760547637939453)) +(((((3.86388397216796875)) +(((((((8.18321037292480469)) +(data[:,4])))+(((((((5.95386552810668945)) +(( 12.93883609771728516)))) +(((((10.73907089233398438)) +(( 4.0)))/2.0)))/2.0)))/2.0)))/2.0)))/2.0)) +(np.tanh(((3.0)))))) -(( 2.0)))) +(((((10.61559963226318359)) +(data[:,1])) /2.0)))) +
0.250000*np.tanh(((np.tanh(((((((((((7.13513946533203125)) +(( 12.48778533935546875)))/2.0)) +(((((((7.13513565063476562)) -(( 8.12031841278076172)))) +(((((((((7.13513565063476562)) +(((( 10.69830417633056641)) +(( 10.69830799102783203)))))) +(( 10.69830799102783203)))) +(( 7.83078956604003906)))/2.0)))/2.0)))/2.0)) * 2.0)))) +(( 3.0)))) +
0.250000*np.tanh(((((((((((data[:,7])-(data[:,0])))* 2.0)) -(data[:,7])))+(data[:,7])))+(data[:,0])))+
0.250000*np.tanh(((((data[:,7])/ 2.0)) / 2.0)) +
0.250000*np.tanh(((((((((((((((( 1.0)) +(((((((data[:,2])+(((((((1.0)) *(data[:,2])))+(data[:,14])) /2.0)))/2.0)) +(( 1.0)))/2.0)))) +(((( 1.0)) -(((data[:,2])*(data[:,14])))))) /2.0)) -(data[:,2])))* 2.0)) +(data[:,14])) /2.0)) +(data[:,14])))+
0.250000*np.tanh(((np.tanh(( np.tanh(((((((data[:,19])*(( 0.0)))) +(( 0.0)))/2.0)))))) / 2.0)) +
0.250000*np.tanh(((((((( 0.0)) / 2.0)) / 2.0)) *(((((((((data[:,15])/ 2.0)) *(( 0.0)))) / 2.0)) *(((( -1.0*(((0.0)))))/ 2.0)))))) +
0.250000*np.tanh(((((data[:,15])*(((((((((((((np.tanh(((((0.09032609313726425)) / 2.0)))) / 2.0)) / 2.0)) / 2.0)) / 2.0)) / 2.0)) / 2.0)))) / 2.0)))
 def GP_class_7(self,data):
return(0.250000*np.tanh(( 10.27210903167724609)) +
0.250000*np.tanh(((((((((( 10.0)) +(((((((((8.26972770690917969)) +(( 11.06334972381591797)))/2.0)) * 2.0)) / 2.0)))) +(((((( 5.0)) +(((( 5.0)) +(( 7.92727756500244141)))))) * 2.0)))) *(( 7.92728137969970703)))) +(( 10.0)))) +
0.250000*np.tanh(( 8.42519950866699219)) +
0.250000*np.tanh(((((((data[:,14])+(data[:,14])))+(((((( 1.59392631053924561)) +(data[:,14])))+(data[:,14])))))+(np.tanh(((((( data[:,14])+(((((((3.0)) +(((data[:,14])* 2.0)))/2.0)) +(( 1.59391915798187256)))))) +(( 1.59392631053924561)))))))) +
0.250000*np.tanh(((( data[:,7])+(((data[:,0])+(((((((data[:,7])+(data[:,4])) /2.0)) +(((data[:,7])* 2.0)))/2.0)))))/2.0)) +
0.250000*np.tanh(((((((((((((( data[:,9])-(((data[:,0])-(data[:,0])))))-(((data[:,0])/ 2.0)))) / 2.0)) -(((data[:,21])-(data[:,7])))))+(data[:,21])) /2.0)) -(data[:,0])))+
0.250000*np.tanh(((((((((( 2.0)) +(((((( data[:,21])+(((( data[:,13])+(((((((((((data[:,13])* 2.0)) +(data[:,21])) /2.0)) +(data[:,13])) /2.0)) * 2.0)))/2.0)))/2.0)) -(np.tanh(((((0.0)) -(data[:,21])))))))))+(( 1.0)))/2.0)) +(data[:,13])) /2.0)) +
0.250000*np.tanh(((((data[:,14])/ 2.0)) / 2.0)) +
0.250000*np.tanh(((((((((((((((( -1.0*(((((((data[:,21])/ 2.0)) +(data[:,8])) /2.0)))))/ 2.0)) / 2.0)) / 2.0)) +(data[:,9])) /2.0)) / 2.0)) +(((((((((((( data[:,7])/ 2.0)) / 2.0)) / 2.0)) / 2.0)) +(data[:,7])) /2.0)))/2.0)) +
0.250000*np.tanh(((((((np.tanh(((1.0)))) / 2.0)) / 2.0)) / 2.0)))
 def GP_class_8(self,data):
return(0.250000*np.tanh(((((((data[:,0])+(((((6.71804094314575195)) +(data[:,15])) /2.0)))) +(((((( 11.56385326385498047)) * 2.0)) *(((( 10.48986148834228516)) +(( 11.56385326385498047)))))))) / 2.0)) +
0.250000*np.tanh(((((((((( data[:,14])/ 2.0)) +(( 2.83755254745483398)))/2.0)) +(((((( data[:,12])+(data[:,14])) /2.0)) +(data[:,14])))))+(((( data[:,9])+(((data[:,12])+(data[:,14])))) /2.0)))) +
0.250000*np.tanh(((((((((data[:,6])+(((((((3.50821948051452637)) +(((( data[:,21])+(( 11.92932796478271484)))/2.0)))) +(( 1.0)))/2.0)))) +(data[:,10])) /2.0)) +(data[:,21])) /2.0)) +
0.250000*np.tanh(((data[:,14])+(np.tanh(( np.tanh(((-1.0*(((( data[:,22])-(data[:,13])))))))))))) +
0.250000*np.tanh(((((1.0)) +(((( data[:,7])+(data[:,7])) /2.0)))/2.0)) +
0.250000*np.tanh(((((((((data[:,21])/ 2.0)) / 2.0)) *(((((((np.tanh(((( np.tanh(( data[:,13])))/ 2.0)))) / 2.0)) +(((((((np.tanh(((((data[:,21])+(data[:,21])) /2.0)))) / 2.0)) -(data[:,12])))/ 2.0)))) / 2.0)))) -(data[:,12])))+
0.250000*np.tanh(((( data[:,7])+(np.tanh(((((data[:,12])+(((data[:,7])*(((( data[:,13])+(data[:,13])) /2.0)))))/2.0)))))/2.0)) +
0.250000*np.tanh(((((((data[:,13])/ 2.0)) / 2.0)) / 2.0)) +
0.250000*np.tanh(((((((((( np.tanh(( data[:,9])))+(data[:,13])) /2.0)) +(((((((( data[:,21])/ 2.0)) * 2.0)) +(((( 3.94983267784118652)) / 2.0)))/2.0)))/2.0)) +(((( np.tanh(((3.94983267784118652)))) +(data[:,9])) /2.0)))/2.0)) +
0.250000*np.tanh(((((((((((((((data[:,14])*(((((((((data[:,19])/ 2.0)) *(np.tanh(((( data[:,2])/ 2.0)))))) / 2.0)) / 2.0)))) / 2.0)) / 2.0)) / 2.0)) / 2.0)) / 2.0)) *(((((data[:,11])/ 2.0)) / 2.0)))))
 def GP_class_9(self,data):
return(0.250000*np.tanh(((((((data[:,14])* 2.0)) / 2.0)) +(((((data[:,14])+(np.tanh(((( data[:,14])* 2.0)))))) +(data[:,14])))))+
0.250000*np.tanh(((data[:,9])-(((((-1.0*(( data[:,11])))) +(data[:,9])) /2.0)))) +
0.250000*np.tanh(((data[:,21])* 2.0)) +
0.250000*np.tanh(((((( data[:,14])+(data[:,14])) /2.0)) +(((( data[:,13])+(((( np.tanh(((( data[:,9])+(( 6.0)))))) +(data[:,9])) /2.0)))/2.0)))) +
0.250000*np.tanh(np.tanh(((1.0)))) +
0.250000*np.tanh(((np.tanh(( np.tanh(((((np.tanh(((( data[:,20])*(((((((np.tanh(((( data[:,20])/ 2.0)))) +(data[:,12])) /2.0)) +(((( data[:,15])+(((( data[:,17])+(data[:,9])) /2.0)))/2.0)))/2.0)))))) +(data[:,9])) /2.0)))))) / 2.0)) +
0.250000*np.tanh(((((data[:,2])-(data[:,11])))/ 2.0)) +
0.250000*np.tanh(((((((( data[:,13])/ 2.0)) +(((data[:,7])+(data[:,7])))) /2.0)) -(((((data[:,22])+(((((data[:,14])*(((((data[:,7])*(((data[:,13])-(((( data[:,7])+(((((data[:,13])/ 2.0)) +(data[:,7])))) /2.0)))))) / 2.0)))) * 2.0)))) / 2.0)))) +
0.250000*np.tanh(((((((((((((((data[:,1])/ 2.0)) +(( 1.0)))/2.0)) +(( 1.0)))/2.0)) +(((((((((( 1.0)) / 2.0)) +(np.tanh(((1.0)))))/2.0)) +(np.tanh(((((( 1.0)) +(( 1.0)))/2.0)))))/2.0)))/2.0)) +(((( data[:,20])+(( 1.0)))/2.0)))/2.0)) +
0.250000*np.tanh(((data[:,1])*(((( data[:,14])+(np.tanh(((((0.0)) / 2.0)))))/2.0)))))
 def GP_class_10(self,data):
return(0.250000*np.tanh(((((((((( data[:,2])+(((data[:,9])*(np.tanh(( data[:,14])))))) /2.0)) +(((((( data[:,14])+(data[:,20])) /2.0)) +(data[:,0])))) /2.0)) +(data[:,14])) /2.0)) +
0.250000*np.tanh(((((( data[:,9])+(( -1.0*(((((((( 2.04309988021850586)) +(((data[:,11])+(((np.tanh(( data[:,0])))/ 2.0)))))/2.0)) * 2.0)))))) /2.0)) +(data[:,2])))+
0.250000*np.tanh(data[:,21])+
0.250000*np.tanh(((((((( data[:,14])+(np.tanh(((( data[:,6])/ 2.0)))))/2.0)) +(data[:,14])))+(((((data[:,14])* 2.0)) +(((( data[:,13])+(data[:,14])) /2.0)))))) +
0.250000*np.tanh(data[:,9])+
0.250000*np.tanh(((((((data[:,15])* 2.0)) / 2.0)) / 2.0)) +
0.250000*np.tanh(((((((( 2.72836518287658691)) *(((( 1.0)) / 2.0)))) / 2.0)) / 2.0)) +
0.250000*np.tanh(((((np.tanh(((( data[:,7])+(np.tanh(((((((((((0.0)) / 2.0)) / 2.0)) / 2.0)) / 2.0)))))))) / 2.0)) / 2.0)) +
0.250000*np.tanh(np.tanh(((( np.tanh(((11.43236827850341797)))) / 2.0)))) +
0.250000*np.tanh(np.tanh(((( data[:,7])/ 2.0)))))
 def GP_class_11(self,data):
return(0.250000*np.tanh(( -1.0*(((((((((((((( data[:,5])-(((data[:,9])-(((( -1.0*(((11.40053558349609375)))))/ 2.0)))))) +(((( 11.40053558349609375)) +(((( 11.40053558349609375)) * 2.0)))))) / 2.0)) -(data[:,7])))-(( -1.0*(((11.40053939819335938)))))))* 2.0)))))+
0.250000*np.tanh(((((data[:,14])* 2.0)) +(data[:,14])))+
0.250000*np.tanh(((data[:,2])+(((((data[:,5])+(data[:,3])))+(((( data[:,2])+(((data[:,3])* 2.0)))/2.0)))))) +
0.250000*np.tanh(((((((((((data[:,21])+(data[:,21])))+(( -1.0*(((((np.tanh(( np.tanh(((( data[:,14])/ 2.0)))))) +(data[:,21])) /2.0)))))) /2.0)) * 2.0)) +(((( data[:,14])+(data[:,3])) /2.0)))/2.0)) +
0.250000*np.tanh(((((((data[:,0])+(((( data[:,9])+(((( data[:,9])+(((((((((((((((data[:,9])/ 2.0)) -(data[:,10])))+(data[:,5])) /2.0)) -(data[:,9])))+(data[:,9])) /2.0)) / 2.0)))/2.0)))/2.0)))/2.0)) +(data[:,9])) /2.0)) +
0.250000*np.tanh(((((((( data[:,13])+(((( data[:,13])+(data[:,13])) /2.0)))) +(data[:,1])) /2.0)) / 2.0)) +
0.250000*np.tanh(data[:,14])+
0.250000*np.tanh(((((data[:,2])/ 2.0)) / 2.0)) +
0.250000*np.tanh(((( data[:,9])+(data[:,9])) /2.0)) +
0.250000*np.tanh(data[:,2]))
def GP_class_12(self,data):
return(0.250000*np.tanh(((((((( -1.0*(( data[:,18])))) -(np.tanh(( data[:,9])))))+(( 8.0)))) -(( 14.74865913391113281)))) +
0.250000*np.tanh(((((( data[:,21])+(np.tanh(( data[:,9])))))+(((((((( data[:,5])/ 2.0)) * 2.0)) +(data[:,5])) /2.0)))/2.0)) +
0.250000*np.tanh(((((data[:,14])+(data[:,14])))+(((data[:,14])* 2.0)))) +
0.250000*np.tanh(((data[:,2])+(((((((data[:,14])+(((( np.tanh(( data[:,10])))+(data[:,17])) /2.0)))/2.0)) +(data[:,21])) /2.0)))) +
0.250000*np.tanh(((( data[:,9])+(((((((((((( data[:,9])+(((((( data[:,9])/ 2.0)) +(((data[:,9])* 2.0)))/2.0)))/2.0)) +(( -1.0*(( data[:,21])))))/2.0)) *(data[:,9])))+(((((np.tanh(((( data[:,21])/ 2.0)))) / 2.0)) / 2.0)))/2.0)))/2.0)) +
0.250000*np.tanh(((((0.0)) +(data[:,13])) /2.0)) +
0.250000*np.tanh(((((((( data[:,2])/ 2.0)) * 2.0)) +(data[:,7])) /2.0)) +
0.250000*np.tanh(((((( data[:,14])* 2.0)) +(np.tanh(( data[:,14])))) /2.0)) +
0.250000*np.tanh(np.tanh(((((((((( -1.0*(((( np.tanh(( data[:,9])))/ 2.0)))))/ 2.0)) / 2.0)) +(((data[:,3])*(data[:,13])))) /2.0)))) +
0.250000*np.tanh(( -1.0*(((((((( -1.0*(((((((-1.0*(( data[:,18])))) -(((( 0.0)) / 2.0)))) / 2.0)))))+(np.tanh(((((-1.0*(((-1.0*(( data[:,22])))))))/ 2.0)))))/2.0)) / 2.0))))))
def GP_class_13(self,data):
return(0.250000*np.tanh(((((np.tanh(( np.tanh(( data[:,2])))))-(( 10.0)))) -(np.tanh(((((( data[:,7])-(((((( 6.0)) -(( 4.87243366241455078)))) -(( 9.0)))))) -(( 14.80352973937988281)))))))) +
0.250000*np.tanh(((np.tanh(((((( 3.0)) +(data[:,1])) /2.0)))) -(( 7.0)))) +
0.250000*np.tanh(((((np.tanh(( np.tanh(( np.tanh(( data[:,6])))))))* 2.0)) -(( 6.10337877273559570)))) +
0.250000*np.tanh(((((((data[:,9])+(data[:,14])))+(data[:,14])))+(data[:,14])))+
0.250000*np.tanh(((((((np.tanh(((((-1.0*(((((((data[:,2])+(( 10.0)))/2.0)) / 2.0)))))-(( 13.28130435943603516)))))) +(( 10.0)))) -(( 13.28130435943603516)))) +(( -1.0*(( data[:,5])))))) +
0.250000*np.tanh(((((((((((data[:,20])+(((((((((data[:,20])* 2.0)) * 2.0)) * 2.0)) +(data[:,13])))) /2.0)) +(((data[:,9])+(((data[:,9])+(((data[:,6])+(data[:,9])))))))) /2.0)) +(data[:,20])))+(data[:,15])))+
0.250000*np.tanh(((((((((data[:,14])/ 2.0)) +(((( data[:,9])+(((data[:,15])+(((data[:,5])+(((((( data[:,9])+(((data[:,5])+(data[:,14])))))+(data[:,9])) /2.0)))))))/2.0)))) * 2.0)) +(data[:,14])))+
0.250000*np.tanh(((( data[:,13])+(data[:,7])) /2.0)) +
0.250000*np.tanh(((data[:,9])+(((( data[:,3])+(((( data[:,21])+(data[:,3])) /2.0)))/2.0)))) +
0.250000*np.tanh(((( data[:,2])+(((((((((((((((data[:,20])+(data[:,1])))+(((data[:,2])+(data[:,14])))))+(data[:,2])))+(np.tanh(( data[:,2])))) /2.0)) +(((data[:,14])+(data[:,2])))))+(data[:,14])) /2.0)))/2.0)))
 def GP_class_14(self,data):
return(0.250000*np.tanh(((((((((((( 5.54024744033813477)) -(((((( 9.0)) * 2.0)) * 2.0)))) -(data[:,0])))-(((( 7.0)) +(( 4.74105215072631836)))))) -(((((7.0)) +(((data[:,5])* 2.0)))/2.0)))) -(( 9.0)))) +
0.250000*np.tanh(((((((((9.0)) -(( 14.27298927307128906)))) -(data[:,0])))+(np.tanh(((((12.77708148956298828)) -(( 14.80560111999511719)))))))/2.0)) +
0.250000*np.tanh(((((((0.0)) +(( -1.0*(((( data[:,22])+(((((((((13.30077362060546875)) -(np.tanh(( data[:,4])))))+(((data[:,22])/ 2.0)))/2.0)) / 2.0)))))))) /2.0)) -(((np.tanh(((( data[:,7])-(data[:,7])))))/ 2.0)))) +
0.250000*np.tanh(((((((data[:,6])+(data[:,14])) /2.0)) +(((np.tanh(((((( data[:,14])+(data[:,14])))+(((data[:,6])-(((data[:,5])+(((np.tanh(( data[:,21])))+(((( data[:,14])+(((( data[:,14])+(data[:,14])) /2.0)))/2.0)))))))))))) +(data[:,5])))) /2.0)) +
0.250000*np.tanh(((((((((((((((((( data[:,2])+(data[:,16])))+(((((( data[:,2])/ 2.0)) +(data[:,9])) /2.0)))/2.0)) +(np.tanh(( data[:,10])))) /2.0)) +(data[:,9])))+(data[:,9])) /2.0)) +(data[:,21])))+(data[:,3])))+
0.250000*np.tanh(((( data[:,13])+(((((((((((data[:,3])/ 2.0)) / 2.0)) / 2.0)) *(data[:,3])))/ 2.0)))/2.0)) +
0.250000*np.tanh(((data[:,14])+(((((((data[:,14])/ 2.0)) +(data[:,14])))* 2.0)))) +
0.250000*np.tanh(data[:,9])+
0.250000*np.tanh(((data[:,1])/ 2.0)) +
0.250000*np.tanh(((((( data[:,2])+(((((( data[:,13])+(data[:,14])))+(data[:,13])) /2.0)))) +(np.tanh(( data[:,2])))) /2.0)))
 def GP_class_15(self,data):
return(0.250000*np.tanh(((((((( 4.0)) +(((( 8.0)) / 2.0)))) -(( 9.56193733215332031)))) -(((((np.tanh(((13.93556308746337891)))) -(data[:,18])))+(( 13.93556308746337891)))))) +
0.250000*np.tanh(((data[:,4])-(((( 12.76094818115234375)) -(data[:,8])))))+
0.250000*np.tanh(((( -1.0*(((12.35446166992187500)))))-(((((12.35446166992187500)) +(((((( 12.35446166992187500)) -(( -1.0*(((0.0)))))))-(data[:,0])))) /2.0)))) +
0.250000*np.tanh(((data[:,21])-(( 14.46367263793945312)))) +
0.250000*np.tanh(((((data[:,2])+(((( data[:,9])+(( -1.0*(((-1.0*(((-1.0*(((( data[:,7])*(((data[:,21])* 2.0)))))))))))))) /2.0)))) +(data[:,9])))+
0.250000*np.tanh(((((((((((data[:,7])+(data[:,3])) /2.0)) +(data[:,20])) /2.0)) -(((( 2.33354020118713379)) / 2.0)))) -(((( 2.0)) +(( 8.78930377960205078)))))) +
0.250000*np.tanh(((((((data[:,14])+(((((((data[:,14])+(((data[:,15])+(data[:,14])))))+(((data[:,15])+(data[:,14])))))+(((data[:,14])/ 2.0)))))) +(data[:,14])))+(data[:,14])))+
0.250000*np.tanh(((((((((data[:,13])+(data[:,13])))+(((data[:,13])+(data[:,12])))))+(data[:,9])))+(((((( data[:,9])+(((data[:,13])+(((( data[:,9])+(((((data[:,13])* 2.0)) / 2.0)))/2.0)))))/2.0)) * 2.0)))) +
0.250000*np.tanh(((( data[:,9])+(((((( data[:,9])+(data[:,9])) /2.0)) / 2.0)))/2.0)) +
0.250000*np.tanh(((((( data[:,14])+(data[:,8])))+(data[:,14])) /2.0)))
 def GP_class_16(self,data):
return(0.250000*np.tanh(((((((((((((9.37592792510986328)) -(( 13.36316204071044922)))) +(( 11.89122962951660156)))/2.0)) -(((( 9.0)) -(((((((data[:,13])/ 2.0)) / 2.0)) +(((( -1.0*(((( data[:,4])/ 2.0)))))* 2.0)))))))) -(( 12.24639320373535156)))) -(( 11.89122581481933594)))) +
0.250000*np.tanh(((((np.tanh(((4.51821422576904297)))) -(( 13.23712635040283203)))) -(((((( 13.23712635040283203)) +(((data[:,22])-(((( 11.40539550781250000)) -(((((9.0)) +(((((((( data[:,7])+(((data[:,17])/ 2.0)))/2.0)) * 2.0)) / 2.0)))/2.0)))))))) -(data[:,5])))))+
0.250000*np.tanh(((data[:,14])-(((( 4.0)) +(((((13.41770648956298828)) +(( 12.42538261413574219)))/2.0)))))) +
0.250000*np.tanh(((( 5.0)) -(( 9.27778816223144531)))) +
0.250000*np.tanh(((((data[:,16])-(((((((data[:,1])-(((np.tanh(((((((( 9.29507255554199219)) -(((((((14.34461498260498047)) * 2.0)) +(((((7.0)) +(( 9.10683441162109375)))/2.0)))/2.0)))) +(( 4.21145153045654297)))/2.0)))) * 2.0)))) -(( 9.10683441162109375)))) * 2.0)))) -(((( 14.34461498260498047)) * 2.0)))) +
0.250000*np.tanh(((((((((( data[:,17])/ 2.0)) +(((data[:,13])+(data[:,9])))) /2.0)) +(((data[:,17])+(data[:,9])))))+(data[:,0])))+
0.250000*np.tanh(((data[:,13])+(((data[:,14])-(data[:,21])))))+
0.250000*np.tanh(((((( data[:,14])+(data[:,5])) /2.0)) +(((((((data[:,9])/ 2.0)) +(data[:,14])))/ 2.0)))) +
0.250000*np.tanh(((((( data[:,17])+(data[:,9])))+(((((data[:,17])/ 2.0)) +(((((((((( data[:,9])+(data[:,9])))-(( 3.0)))) +(data[:,7])))+(data[:,9])) /2.0)))))/2.0)) +
0.250000*np.tanh(np.tanh(((((((((((((((data[:,2])+(((((((((((data[:,22])+(data[:,21])) /2.0)) +(data[:,2])) /2.0)) * 2.0)) +(((((( data[:,21])* 2.0)) +(data[:,21])) /2.0)))))) +(data[:,2])) /2.0)) +(data[:,17])) /2.0)) +(np.tanh(( data[:,8])))) /2.0)) +(data[:,2]))))))
def GP_class_17(self,data):
return(0.250000*np.tanh(((((data[:,14])-(((( data[:,5])+(((((14.43326377868652344)) +(( 6.0)))/2.0)))/2.0)))) -(((((((10.0)) +(( 14.84462165832519531)))/2.0)) -(((( 7.0)) +(data[:,13])))))))+
0.250000*np.tanh(((((((((( data[:,14])+(((((((((data[:,11])-(( 9.71331787109375000)))) / 2.0)) +(( 9.0)))) -(( 3.0)))))/2.0)) -(( 10.0)))) -(((( 10.0)) +(((( 9.0)) -(((((( 10.0)) -(( 9.0)))) / 2.0)))))))) -(( 10.0)))) +
0.250000*np.tanh(((((((((( 8.0)) -(( 12.78277492523193359)))) -(data[:,10])))-(np.tanh(((((((7.0)) -(( 14.95321178436279297)))) -(( 8.0)))))))) -(( 14.95321178436279297)))) +
0.250000*np.tanh(((( 7.45682907104492188)) -(( 14.98023796081542969)))) +
0.250000*np.tanh(((((((((((7.0)) +(((((np.tanh(((((((( 8.0)) *(data[:,8])))+(data[:,11])) /2.0)))) / 2.0)) -(( 8.0)))))/2.0)) -(data[:,20])))-(((( 8.0)) * 2.0)))) +(( 8.0)))) +
0.250000*np.tanh(((data[:,8])+(((data[:,4])+(((np.tanh(( data[:,4])))+(((data[:,13])+(data[:,13])))))))))+
0.250000*np.tanh(data[:,14])+
0.250000*np.tanh(((((((((((data[:,14])+(np.tanh(((( data[:,3])*(data[:,13])))))))+(data[:,14])))+(data[:,0])))+(data[:,8])))/ 2.0)) +
0.250000*np.tanh(((((( data[:,9])+(np.tanh(((((((data[:,19])*(((((((data[:,1])+(((((((data[:,21])+(data[:,9])) /2.0)) +(data[:,6])) /2.0)))/2.0)) +(data[:,17])) /2.0)))) +(((data[:,15])/ 2.0)))/2.0)))))/2.0)) * 2.0)) +
0.250000*np.tanh(((data[:,1])+(((((data[:,3])+(data[:,15])))+(np.tanh(((((data[:,20])+(((data[:,1])* 2.0)))/2.0)))))))))
 def GP_class_18(self,data):
return(0.250000*np.tanh(((((((((( 12.59485149383544922)) -(( 12.59485149383544922)))) -(( 12.59485149383544922)))) -(((( 11.47756862640380859)) / 2.0)))) -(( 12.59485149383544922)))) +
0.250000*np.tanh(((((( -1.0*(((11.26121807098388672)))))-(((((((((11.33140659332275391)) -(( -1.0*(((9.76293182373046875)))))))-(((((11.33140659332275391)) +(( 8.0)))/2.0)))) +(( 9.76293182373046875)))/2.0)))) -(data[:,11])))+
0.250000*np.tanh(((((((((((3.40250444412231445)) -(np.tanh(((14.86789989471435547)))))) -(( 14.86789989471435547)))) +(((((( data[:,5])+(( -1.0*(((((14.86789989471435547)) * 2.0)))))) /2.0)) -(( 14.86789989471435547)))))/2.0)) -(((((14.86789989471435547)) +(((((7.0)) +(( -1.0*(( data[:,16])))))/2.0)))/2.0)))) +
0.250000*np.tanh(((data[:,18])-(( 11.84332561492919922)))) +
0.250000*np.tanh(((((np.tanh(((((8.96548557281494141)) *(data[:,12])))))-(( -1.0*(((( data[:,2])*(((((data[:,4])-(( -1.0*(( data[:,9])))))) -(( 9.0)))))))))))-(( 8.96548557281494141)))) +
0.250000*np.tanh(((((((10.0)) -(data[:,12])))+(((((((((data[:,13])-(( 12.43707370758056641)))) -(((( 12.43707370758056641)) -(((data[:,12])/ 2.0)))))) -(((( 12.43707370758056641)) -(((( data[:,13])+(( 12.43707370758056641)))/2.0)))))) -(( 12.43707370758056641)))))/2.0)) +
0.250000*np.tanh(((((((np.tanh(((( np.tanh(( data[:,14])))+(data[:,13])))))* 2.0)) +(data[:,14])))+(data[:,13])))+
0.250000*np.tanh(((np.tanh(( data[:,14])))+(data[:,14])))+
0.250000*np.tanh(((((data[:,9])+(((((data[:,13])+(data[:,4])))+(data[:,13])))))/ 2.0)) +
0.250000*np.tanh(((data[:,15])-(((( data[:,3])+(( 5.0)))/2.0)))))
 def GP_class_19(self,data):
return(0.250000*np.tanh(((((( data[:,13])+(data[:,13])) /2.0)) +(((((( data[:,8])+(((( data[:,14])+(data[:,14])) /2.0)))/2.0)) * 2.0)))) +
0.250000*np.tanh(((( data[:,3])+(((data[:,8])+(np.tanh(((((((-1.0*(((((( 9.05535793304443359)) +(((( data[:,14])+(((((((data[:,1])-(((data[:,12])* 2.0)))) *(( -1.0*(( data[:,17])))))) / 2.0)))/2.0)))/2.0)))))+(data[:,2])))* 2.0)))))))/2.0)) +
0.250000*np.tanh(((((((((data[:,3])+(((((data[:,14])+(data[:,14])))* 2.0)))) +(((( data[:,14])+(np.tanh(((( data[:,14])+(np.tanh(( data[:,14])))))))) /2.0)))) * 2.0)) +(((( data[:,14])+(data[:,2])) /2.0)))) +
0.250000*np.tanh(((((data[:,8])+(((data[:,4])+(((data[:,13])+(data[:,10])))))))+(((((data[:,13])+(((((data[:,13])/ 2.0)) +(data[:,9])))))+(np.tanh(((((data[:,8])+(data[:,8])) /2.0)))))))) +
0.250000*np.tanh(((((( data[:,19])+(((((data[:,10])+(((( data[:,11])+(data[:,19])) /2.0)))) +(data[:,10])))) /2.0)) +(data[:,2])))+
0.250000*np.tanh(((((( data[:,0])+(((((((((data[:,0])+(((((data[:,0])-(data[:,11])))/ 2.0)))/2.0)) * 2.0)) +(((((( np.tanh(( data[:,13])))+(((data[:,0])/ 2.0)))/2.0)) / 2.0)))/2.0)))/2.0)) * 2.0)) +
0.250000*np.tanh(((((-1.0*(( data[:,15])))) +(((data[:,14])+(data[:,14])))) /2.0)) +
0.250000*np.tanh(((((((((data[:,0])+(data[:,15])) /2.0)) +(((data[:,15])*(data[:,15])))) /2.0)) -(data[:,11])))+
0.250000*np.tanh(data[:,13])+
0.250000*np.tanh(((((((((data[:,18])+(((( data[:,4])+(data[:,18])) /2.0)))) / 2.0)) +(((( data[:,18])+(data[:,4])) /2.0)))) *(data[:,4]))))