Kaggle competition: NFL Big Data Bowl
<SOS> metric: CRPS Kaggle data source: nfl-big-data-bowl<import_modules>
pd.set_option('display.max_columns', 50)
 pd.set_option('display.max_rows', 150 )
from dsqol.tf import imgaug
from dsqol.tf.data import balance
from dsqol.tf.utils import average
from dsqol.tf import losses<init_hyperparams>
from keras.layers import Dense
from keras.models import Sequential
from keras.callbacks import Callback, EarlyStopping
SEED = 42
tf.random.set_seed(SEED)
 np.random.seed(SEED)
 TIME_BUDGET = 2.5 * 3600
FOLDS = 5
INCLUDE_2019 = 0
INCLUDE_2018 = 1
INCLUDE_MALIGNANT = 0
IMG_READ_SIZE = 384
IMG_SIZE = 384
BALANCE_POS_RATIO = 0.08
EFF_NET = 6
LOSS_TYPE = 'BCE'
LOSS_PARAMS = dict(label_smoothing=0.05)
 BATCH_SIZE = 32
EPOCHS = 12
TBM = 6
TTA = 15
VALID_FREQ = 1
N_SWA = 3
SWA_DECAY = 0.9<train_on_grid>
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'] )
DEVICE = "TPU"
print("connecting to TPU...")
 try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
print('Running on TPU ', tpu.master())
 except ValueError:
print("Could not connect to TPU")
 tpu = None
if tpu:
try:
print("initializing TPU...")
 tf.config.experimental_connect_to_cluster(tpu)
 tf.tpu.experimental.initialize_tpu_system(tpu)
 strategy = tf.distribute.experimental.TPUStrategy(tpu)
 print("TPU initialized")
 except _:
print("failed to initialize TPU")
 else:
DEVICE = "GPU"
if DEVICE != "TPU":
print("Using default strategy for CPU and single GPU")
 strategy = tf.distribute.get_strategy()
if DEVICE == "GPU":
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
 AUTO = tf.data.experimental.AUTOTUNE
REPLICAS = strategy.num_replicas_in_sync
GLOBAL_BATCH_SIZE = BATCH_SIZE * REPLICAS
print("REPLICAS: %d" % REPLICAS )<define_variables>
outcomes = train[['GameId','PlayId','Yards']].drop_duplicates()
IMG_READ_SIZE = 512
IMG_SIZE = 512<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 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, deploy=deploy):
df = pd.merge(relative_to_back,defense,on=['GameId','PlayId'],how='inner')
 df = pd.merge(df,static,on=['GameId','PlayId'],how='inner')
 if not deploy:
df = pd.merge(df, outcomes, on=['GameId','PlayId'], how='inner')
 return df
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, deploy=deploy)
 return basetable
GCS_PATH1 = KaggleDatasets().get_gcs_path('melanoma-%ix%i' %(IMG_READ_SIZE, IMG_READ_SIZE))
GCS_PATH2 = KaggleDatasets().get_gcs_path('isic2019-%ix%i' %(IMG_READ_SIZE, IMG_READ_SIZE))
GCS_PATH3 = KaggleDatasets().get_gcs_path('malignant-v2-%ix%i' %(IMG_READ_SIZE, IMG_READ_SIZE))<load_from_csv>
%time train_basetable = create_features(train, False )
df_base_train = pd.read_csv(".. /input/siim-isic-melanoma-classification/train.csv")
 df_base_test = pd.read_csv(".. /input/siim-isic-melanoma-classification/test.csv" )<define_variables>
X = train_basetable.copy()
yards = X.Yards
y = np.zeros(( yards.shape[0], 199))
for idx, target in enumerate(list(yards)) :
y[idx][99 + target] = 1
X.drop(['GameId','PlayId','Yards'], axis=1, inplace=True )
train_files = tf.io.gfile.glob(os.path.join(GCS_PATH1, "train*.tfrec"))
if INCLUDE_2019:
train_files += tf.io.gfile.glob([os.path.join(GCS_PATH2, "train%.2i*.tfrec" % i)for i in range(1, 30, 2)])
 if INCLUDE_2018:
train_files += tf.io.gfile.glob([os.path.join(GCS_PATH2, "train%.2i*.tfrec" % i)for i in range(0, 30, 2)])
 if INCLUDE_MALIGNANT:
train_files += tf.io.gfile.glob([os.path.join(GCS_PATH3, "train%.2i*.tfrec" % i)for i in range(15, 30, 1)])
 print("%d train files found" % len(train_files))<train_model>
scaler = StandardScaler()
X = scaler.fit_transform(X )
test_files = tf.io.gfile.glob(os.path.join(GCS_PATH1, "test*.tfrec"))
print("%d test files found" % len(test_files))<prepare_x_and_y>
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.15, random_state=12345 )
def read_labeled_tfrecord(example):
tfrec_format = {
'image' : tf.io.FixedLenFeature([], tf.string),
'image_name' : tf.io.FixedLenFeature([], tf.string),
'target' : tf.io.FixedLenFeature([], tf.int64)
 }
example = tf.io.parse_single_example(example, tfrec_format)
 return example['image'], example['target']
def read_unlabeled_tfrecord(example, return_image_name=True):
tfrec_format = {
'image' : tf.io.FixedLenFeature([], tf.string),
'image_name' : tf.io.FixedLenFeature([], tf.string),
}
example = tf.io.parse_single_example(example, tfrec_format)
 return example['image'], example['image_name'] if return_image_name else 0
def prepare_image(img):
img = tf.image.decode_jpeg(img, channels=3)
 img = tf.cast(img, tf.float32)/ 255.0
return img
def count_data_items(filenames):
n = [int(re.compile(r"-([0-9]*)\." ).search(filename ).group(1))
for filename in filenames]
return np.sum(n )<categorify>
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):
X_train, y_train = self.data[0][0], self.data[0][1]
y_pred = self.model.predict(X_train)
 y_true = np.clip(np.cumsum(y_train, axis=1), 0, 1)
 y_pred = np.clip(np.cumsum(y_pred, axis=1), 0, 1)
 tr_s =(( y_true - y_pred)** 2 ).sum(axis=1 ).sum(axis=0)/(199 * X_train.shape[0])
 tr_s = np.round(tr_s, 6)
 logs['tr_CRPS'] = tr_s
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', tr_s, 'val CRPS', val_s)
 for callback in self.callbacks:
callback.on_epoch_end(batch, logs )
def dropout(image, DIM=256, PROBABILITY = 0.75, CT = 8, SZ = 0.2):
P = tf.cast(tf.random.uniform([],0,1)<PROBABILITY, tf.int32)
 if(P==0)|(CT==0)|(SZ==0):
return image
for k in range(CT):
x = tf.cast(tf.random.uniform([],0,DIM),tf.int32)
 y = tf.cast(tf.random.uniform([],0,DIM),tf.int32)
 WIDTH = tf.cast(SZ*DIM,tf.int32)* P
ya = tf.math.maximum(0,y-WIDTH//2)
 yb = tf.math.minimum(DIM,y+WIDTH//2)
 xa = tf.math.maximum(0,x-WIDTH//2)
 xb = tf.math.minimum(DIM,x+WIDTH//2)
 one = image[ya:yb,0:xa,:]
two = tf.zeros([yb-ya,xb-xa,3])
 three = image[ya:yb,xb:DIM,:]
middle = tf.concat([one,two,three],axis=1)
 image = tf.concat([image[0:ya,:,:],middle,image[yb:DIM,:,:]],axis=0)
 image = tf.reshape(image,[DIM,DIM,3])
 return image
def ClasswiseMixup(probability: float=1.0, batch_size: int = 16, alpha: float=1.0, beta: float=1.0):
def classwise_mixup(img, tar):
do = tf.cast(tf.random.uniform([batch_size], 0, 1)< probability, tf.float32)
 gamma = tf.reshape(tf.random.uniform([batch_size], 0, 1)* do, [-1, 1, 1, 1])
 shuffled_img = tf.random.shuffle(img)
 img_new =(1 - gamma)* img + gamma * shuffled_img
return img_new
return classwise_mixup<statistical_test>

 model = Sequential()
model.add(Dense(512, input_dim=X.shape[1], activation='relu'))
model.add(BatchNormalization())
 model.add(Dropout(0.5))
model.add(Dense(256, activation='relu'))
model.add(BatchNormalization())
 model.add(Dropout(0.5))
model.add(Dense(199, activation='softmax'))
AUG_BS = 64
def base_aug(img):
img = tf.image.random_flip_left_right(img)
 img = tf.image.random_saturation(img, 0.7, 1.3)
 img = tf.image.random_contrast(img, 0.8, 1.2)
 img = tf.image.random_brightness(img, 0.1)
 return img
dropout_aug = lambda img, o: dropout(img, DIM=IMG_READ_SIZE, PROBABILITY=0.75, CT=8, SZ=0.15)
 transform_aug = imgaug.Transform(dim=IMG_READ_SIZE, hzoom_mult=10.0, wzoom_mult=10.0)
 cw_mixup_aug = ClasswiseMixup(probability=0.1, batch_size=AUG_BS)
 def basic_augmentation_pipeline(ds: tf.data.Dataset, dim=None, batch_size=None)-> tf.data.Dataset:
ds = ds.map(lambda i, o:(transform_aug(i), o), num_parallel_calls=AUTO)
 ds = ds.map(lambda i, o:(base_aug(i), o), num_parallel_calls=AUTO)
 return ds<create_dataframe>
model.compile(optimizer='Adam', loss='categorical_crossentropy', metrics=[] )
def get_dataset(files, augment=False, repeat=False, shuffle=False, labeled=True, batch_size=16, drop_remainder=False,
dim=256, read_dim=None 
)-> tf.data.Dataset:
if read_dim is None:
read_dim = dim
ds = tf.data.TFRecordDataset(files, num_parallel_reads=AUTO)
 ds = ds.cache()
if repeat:
ds = ds.repeat()
if shuffle:
ds = ds.shuffle(1024 * 8)
 opt = tf.data.Options()
opt.experimental_deterministic = False
ds = ds.with_options(opt)
 if labeled:
ds = ds.map(read_labeled_tfrecord, num_parallel_calls=AUTO)
 else:
ds = ds.map(read_unlabeled_tfrecord, num_parallel_calls=AUTO)
 ds = ds.map(lambda i, o:(prepare_image(i), o), num_parallel_calls=AUTO)
 if augment:
ds = basic_augmentation_pipeline(ds, batch_size=8 * batch_size, dim=read_dim)
 if isinstance(augment, list):
for a in augment:
ds = ds.map(lambda i, o:(a(i, o), o), num_parallel_calls=AUTO)
 ds = ds.map(lambda i, o:(tf.image.resize(i, [dim, dim]), o), num_parallel_calls=AUTO)
 ds = ds.batch(batch_size, drop_remainder=drop_remainder)
 ds = ds.prefetch(AUTO)
 return ds
def get_balanced_dataset(files, augment=False, cw_augment=False, repeat=False, shuffle=False, batch_size=16, drop_remainder=False,
dim=256, read_dim=None, pos_ratio=False)-> tf.data.Dataset:
if read_dim is None:
read_dim = dim
ds = tf.data.TFRecordDataset(files, num_parallel_reads=AUTO)
 ds = ds.cache()
if repeat:
ds = ds.repeat()
ds = ds.map(read_labeled_tfrecord, num_parallel_calls=AUTO)
 ds0, ds1 = balance.separate_by_target(ds)
 ds0 = ds.map(lambda i, o:(prepare_image(i), o), num_parallel_calls=AUTO)
 ds1 = ds.map(lambda i, o:(prepare_image(i), o), num_parallel_calls=AUTO)
 if cw_augment:
ds0 = ds0.batch(AUG_BS, drop_remainder=drop_remainder); ds1 = ds1.batch(AUG_BS, drop_remainder=drop_remainder)
 for a in cw_augment:
ds0 = ds0.map(lambda i, o:(a(i, o), o), num_parallel_calls=AUTO)
 ds1 = ds1.map(lambda i, o:(a(i, o), o), num_parallel_calls=AUTO)
 ds0 = ds0.unbatch() ; ds1 = ds1.unbatch()
ds = balance.merge_ds(ds0, ds1, pos_ratio)
 if shuffle:
ds = ds.shuffle(1024)
 opt = tf.data.Options()
opt.experimental_deterministic = False
ds = ds.with_options(opt)
 if augment:
ds = basic_augmentation_pipeline(ds, batch_size=8 * batch_size, dim=read_dim)
 if isinstance(augment, list):
for a in augment:
ds = ds.map(lambda i, o:(a(i, o), o), num_parallel_calls=AUTO)
 ds = ds.map(lambda i, o:(tf.image.resize(i, [dim, dim]), o), num_parallel_calls=AUTO)
 ds = ds.batch(batch_size, drop_remainder=drop_remainder)
 ds = ds.prefetch(AUTO)
 return ds<prepare_x_and_y>
es = EarlyStopping(monitor='val_CRPS',
mode='min',
restore_best_weights=True,
verbose=2,
patience=5)
 es.set_model(model )
def show_dataset(thumb_size, cols, rows, ds):
mosaic = PIL.Image.new(mode='RGB', size=(thumb_size*cols +(cols-1),
thumb_size*rows +(rows-1)))
 for idx, data in enumerate(iter(ds)) :
img, target_or_imgid = data
ix = idx % cols
iy = idx // cols
img = np.clip(img.numpy() * 255, 0, 255 ).astype(np.uint8)
 img = PIL.Image.fromarray(img)
 img = img.resize(( thumb_size, thumb_size), resample=PIL.Image.BILINEAR)
 mosaic.paste(img,(ix*thumb_size + ix,
iy*thumb_size + iy))
display(mosaic)
 pass<create_dataframe>
metric = Metric(model, [es], [(X_train,y_train),(X_val,y_val)] )
show_dataset(128, 8, 2, get_balanced_dataset(train_files, augment=[dropout_aug], cw_augment=[cw_mixup_aug] ).take(10 ).unbatch() )<choose_model_class>
%%time
model.fit(X_train, y_train, callbacks=[metric], epochs=100, batch_size=1024 )
def build_model(dim=128, ef=0):
inp = keras.layers.Input(shape=(dim,dim,3))
base = getattr(efnet, 'EfficientNetB%d' % ef )(input_shape=(dim, dim, 3), weights='imagenet', include_top=False)
 x = base(inp)
 x = keras.layers.GlobalAveragePooling2D()(x)
 x = keras.layers.Dense(1 )(x)
 x = keras.layers.Activation('sigmoid', dtype='float32' )(x)
 model = keras.Model(inputs=inp,outputs=x)
 opt = keras.optimizers.Adam(learning_rate=1e-3)
 if LOSS_TYPE.upper() == 'BCE':
loss = keras.losses.BinaryCrossentropy(**LOSS_PARAMS)
 elif LOSS_TYPE.upper() == 'FOCAL':
loss = losses.BinaryFocalLoss(**LOSS_PARAMS)
 model.compile(optimizer=opt, loss=loss, metrics=['AUC'])
 return model<init_hyperparams>
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]))))
<load_from_csv><EOS> 
warnings.filterwarnings("ignore")
 env = nflrush.make_env()
iter_test = env.iter_test()
gp = GP()
for(test_df, sample_prediction_df)in iter_test:
basetable = create_features(test_df, deploy=True)
 basetable.drop(['GameId','PlayId'], axis=1, inplace=True)
 scaled_basetable = scaler.transform(basetable)
 y_pred_nn = model.predict(scaled_basetable)
 y_pred_gp = np.zeros(( test_df.shape[0],199))
ans = gp.GrabPredictions(scaled_basetable)
 y_pred_gp[:,96:96+20] = ans
y_pred = (.6*y_pred_nn+.4*y_pred_gp)
 y_pred = np.clip(np.cumsum(y_pred, axis=1), 0, 1 ).tolist() [0]
preds_df = pd.DataFrame(data=[y_pred], columns=sample_prediction_df.columns)
 env.predict(preds_df)
 env.write_submission_file()