[pos_loader, bin_loader, chr_loader], [five_p_loader, three_p_loader, ref_loader, alt_loader, strand_loader], ] # set y label y_label = np.log( sample_df['non_syn_counts'].values / (panels.loc[panels['Panel'] == 'Agilent_kit']['cds'].values[0] / 1e6) + 1)[:, np.newaxis] y_strat = np.argmax(samples['histology'], axis=-1) losses = [Losses.QuantileLoss()] metrics = [Metrics.QuantileLoss()] encoders = [ InstanceModels.PassThrough(shape=(1, )), InstanceModels.VariantPositionBin(24, 100), InstanceModels.VariantSequence(6, 4, 2, [16, 16, 8, 8], fusion_dimension=32) ] all_weights = [ pickle.load( open( cwd / 'figures' / 'tmb' / 'tcga' / 'VICC_01_R2' / 'results' / 'run_naive.pkl', 'rb')), pickle.load( open( cwd / 'figures' / 'tmb' / 'tcga' / 'VICC_01_R2' / 'results' /
runs = 3 initial_weights = [] losses = [Losses.QuantileLoss()] metrics = [Metrics.QuantileLoss()] callbacks = [ tf.keras.callbacks.EarlyStopping(monitor='val_QL', min_delta=0.0001, patience=40, mode='min', restore_best_weights=True) ] ##for sequence for i in range(runs): pass_encoder = InstanceModels.PassThrough(shape=(1, )) # position_encoder = InstanceModels.VariantPositionBin(24, 100) # sequence_encoder = InstanceModels.VariantSequence(6, 4, 2, [16, 16, 8, 8], fusion_dimension=32) mil = RaggedModels.MIL(instance_encoders=[pass_encoder.model], output_dim=1, pooling='sum', mil_hidden=(64, 32, 16), output_type='quantiles', regularization=0) # mil = RaggedModels.MIL(instance_encoders=[position_encoder.model], output_dim=1, pooling='sum', mil_hidden=(64, 32, 16), output_type='quantiles', regularization=0) # mil = RaggedModels.MIL(instance_encoders=[sequence_encoder.model], output_dim=1, pooling='sum', mil_hidden=(64, 32, 16), output_type='quantiles', regularization=0) mil.model.compile(loss=losses, metrics=metrics, optimizer=tf.keras.optimizers.Adam(learning_rate=0.001)) initial_weights.append(mil.model.get_weights())