Kaggle competition: Similarity Search Project
<SOS> metric: rmse Kaggle data source: similarity-search-project<import_modules>
inputFolderPath = '/kaggle/input/similarity-search-project/'
outputFolderPath = '/kaggle/working/'
inputFilePath_synthetic = inputFolderPath + 'synthetic_size50k_len256_znorm.bin'
inputFilePath_seismic = inputFolderPath + 'seismic_size50k_len256_znorm.bin'
queryFilePath_synthetic = inputFolderPath + 'synthetic-query_size100_len256_znorm.bin'
queryFilePath_seismic = inputFolderPath + 'seismic-query_size100_len256_znorm'
print("Read in libraries")
<load_from_csv>
def sum32(inputFilePath):

 summary_filepath = outputFolderPath + filename + '_sum32'
time_series50k = np.fromfile(inputFilePath, dtype=np.float32 ).reshape(-1, 256)
 summary50k = []
for time_series in time_series50k:
summary50k.append(time_series[0])
 summary50knp = np.array(summary50k,dtype=np.float32)
 summary50knp.tofile(summary_filepath)
 return summary_filepath
def rec32(summary_filepath):

 reconstructed_filepath = summary_filepath + '_rec32'
summary50k = np.fromfile(summary_filepath, dtype=np.float32)
 reconstructed50k = []
for summary in summary50k:
reconstructed50k.append([summary]*256)
 reconstructed50knp = np.array(reconstructed50k,dtype=np.float32)
 reconstructed50knp.tofile(reconstructed_filepath)
 return reconstructed_filepath
def sum64(inputFilePath):

 summary_filepath = outputFolderPath + filename + '_sum64'
time_series50k = np.fromfile(inputFilePath, dtype=np.float32 ).reshape(-1, 256)
 summary50k = []
for time_series in time_series50k:
summary50k.append(time_series[0])
 summary50k.append(time_series[0])
 summary50knp = np.array(summary50k,dtype=np.float32)
 summary50knp.tofile(summary_filepath)
 return summary_filepath
def rec64(summary_filepath):

 reconstructed_filepath = summary_filepath + '_rec64'
summary50k = np.fromfile(summary_filepath, dtype=np.float32 ).reshape(-1, 2)
 reconstructed50k = []
for summary in summary50k:
reconstructed50k.append([summary[0]]*256)
 reconstructed50knp = np.array(reconstructed50k,dtype=np.float32)
 reconstructed50knp.tofile(reconstructed_filepath)
 return reconstructed_filepath
def sum128(inputFilePath):

 summary_filepath = outputFolderPath + filename + '_sum128'
time_series50k = np.fromfile(inputFilePath, dtype=np.float32 ).reshape(-1, 256)
 summary50k = []
for time_series in time_series50k:
summary50k.append(time_series[0])
 summary50k.append(time_series[0])
 summary50k.append(time_series[0])
 summary50k.append(time_series[0])
 summary50knp = np.array(summary50k,dtype=np.float32)
 summary50knp.tofile(summary_filepath)
 return summary_filepath
def rec128(summary_filepath):

 reconstructed_filepath = summary_filepath + '_rec128'
summary50k = np.fromfile(summary_filepath, dtype=np.float32 ).reshape(-1, 4)
 reconstructed50k = []
for summary in summary50k:
reconstructed50k.append([summary[0]]*256)
 reconstructed50knp = np.array(reconstructed50k,dtype=np.float32)
 reconstructed50knp.tofile(reconstructed_filepath)
 return reconstructed_filepath
print("read in train file")
 df=pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/train.csv",
usecols=['Province_State','Country_Region','Date','ConfirmedCases','Fatalities'])
<drop_column>
def similarity() :

 average_prune_ratio = 0
return average_prune_ratio
<load_from_csv><EOS> 
average_prune_ratio = similarity()
with open('submission.csv', 'w', newline='')as file:
writer = csv.writer(file)
 writer.writerow(['id','expected'])
 writer.writerow(['1',average_prune_ratio] )