Project: s41467-024-47334-0 | Function: classify_test_cells (python)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Extreme Learning Machine (ELM) implementation for cell type classification, using single-step non-iterative learning with random input weights and Moore-Penrose pseudoinverse for output weight calculation

**KEY TERMS:** {
  "input_weights": "W (randomly initialized input weights)",
  "biases": "b (randomly initialized biases)",
  "hidden_nodes": "H (hidden layer output matrix)",
  "output_weights": "β (output weights calculated via pseudoinverse)",
  "relu": "ReLU activation function"
}

**CONTEXT CODE:**         markers_pos  = list(set(markers) - set(markers_neg_ ))
        data_slice= pd.concat([imc_forSSC[markers_pos],   imc_forSSC[markers_neg].max()-imc_forSSC[markers_neg] ], axis=1)
        
        celltype_scores=data_slice.prod(axis=1) 

        adaptive_th=adaptive_th_vec[i]
        th0=np.percentile(celltype_scores, adaptive_th)
        th1=np.percentile(celltype_scores, float(th[1]) )
        good_cells_ind= ( ( celltype_scores > th0 ) & (celltype_scores < th1 ) )
        
        indices=good_cells_ind[good_cells_ind].index

        assigned_centroids[ good_cells_ind ]=i

        good_cells=imc_forSSC.loc[  indices ]
        centroids[i] = good_cells.mean(axis=0)

        good_cells_ind_allcts_list=good_cells_ind_allcts_list+ list(  indices  )

    return (assigned_centroids,centroids,good_cells_ind_allcts_list)


import pandas as pd
def process_cell_labels(assigned_labels,dict_celltypes,original_index):
    labels_ssc= pd.DataFrame(assigned_labels).replace( dict_celltypes ).assign(item=original_index)
    labels_ssc.rename( columns={0:'label'}, inplace=True)
    labels_ssc = labels_ssc[['item','label']]

    labels_numericLabels= pd.DataFrame(assigned_labels)
    labels_numericLabels=labels_numericLabels.assign(item=original_index)
    labels_numericLabels.rename( columns={0:'label'}, inplace=True)
    labels_numericLabels = labels_numericLabels[['item','label']]

    return (labels_ssc,labels_numericLabels)


def predictNsave(classifier,suffix, op_dir, te_labels, te_original_index ,tr_labels_ssc,tr_labels_numericLabels, tr_original_index, dict_celltypes):
    (te_labels_ssc,te_labels_numericLabels) = process_cell_labels(te_labels,dict_celltypes,te_original_index)
    
    trte_labels = pd.concat([tr_labels_ssc, te_labels_ssc], axis= 0)
    trte_labels.sort_values(by=['item']).to_csv(op_dir+'/trte_labels_'+classifier+suffix+'.csv', index=False)
    trte_labels_numericLabels = pd.concat([tr_labels_numericLabels, te_labels_numericLabels], axis= 0)
    trte_labels_numericLabels.sort_values(by=['item']).to_csv(op_dir+'/trte_labels_numericLabels_'+classifier+suffix+'.csv', index=False)
    

import time
import os
import pickle
from sklearn import preprocessing
from sklearn.metrics.pairwise import euclidean_distances
def classify_test_cells(classifier,data_tr, labels_tr, data_te,suffix=[],data_dir=[] ): #, use_trained_model
    raise NotImplementedError("This function is intentionally masked for testing purposes.")






def write_initial_labels(assigned_centroids, raw_data_tr_index,raw_data_te_index,op_dir, suffix):
    initial_labels=pd.DataFrame(assigned_centroids, index=raw_data_tr_index)
    initial_labels=initial_labels.assign(item=raw_data_tr_index)
    initial_labels.rename( columns={0:'label'}, inplace=True)
    initial_labels = initial_labels[['item','label']]
    
    df_te = pd.DataFrame( np.zeros((len(raw_data_te_index)))-1   ).astype(int)
    df_te.rename( columns={0:'label'}, inplace=True)
    df_te['item'] = raw_data_te_index
    initial_labels_trte = pd.concat([initial_labels ,df_te])
    
    
    initial_labels_trte.to_csv(op_dir+'/initiallabels_numericLabels'+suffix+'.csv', index=False)
    
    
    
def scale_normalize(df):
    result = df.copy()
    for feature_name in df.columns:
        max_value = np.percentile(df[feature_name],99.99)
        min_value = np.percentile(df[feature_name],0.01)
        result[feature_name] = (df[feature_name] - min_value) / (max_value - min_value)
        result[result > 1]=1
    return result


        
        
        






Complete the function implementation replacing "raise NotImplementedError".