jacklangerman commited on
Commit
718a478
1 Parent(s): 9b881d9
Files changed (1) hide show
  1. script.py +17 -2
script.py CHANGED
@@ -124,6 +124,18 @@ def download_package(package_name, path_to_save='packages'):
124
 
125
  ### The part below is used to define and test your solution.
126
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  if __name__ == "__main__":
128
  from handcrafted_solution import predict
129
  print ("------------ Loading dataset------------ ")
@@ -139,7 +151,10 @@ if __name__ == "__main__":
139
  'wf_edges': pred_edges,
140
  'edge_semantics': semantics,
141
  })
 
 
 
 
142
  print('------------ Saving results ---------------')
143
- sub = pd.DataFrame(solution, columns=["__key__", "wf_vertices", "wf_edges", "edge_semantics"])
144
- sub.to_parquet(Path(params['output_path']) / "submission.parquet")
145
  print("------------ Done ------------ ")
 
124
 
125
  ### The part below is used to define and test your solution.
126
 
127
+ def save_submission(submission, path):
128
+ """
129
+ Saves the submission to a specified path.
130
+
131
+ Parameters:
132
+ submission (List[Dict[]]): The submission to save.
133
+ path (str): The path to save the submission to.
134
+ """
135
+ sub = pd.DataFrame(submission, columns=["__key__", "wf_vertices", "wf_edges", "edge_semantics"])
136
+ sub.to_parquet(path)
137
+ print(f"Submission saved to {path}")
138
+
139
  if __name__ == "__main__":
140
  from handcrafted_solution import predict
141
  print ("------------ Loading dataset------------ ")
 
151
  'wf_edges': pred_edges,
152
  'edge_semantics': semantics,
153
  })
154
+ if i % 100 == 0:
155
+ # incrementally save the results in case we run out of time
156
+ print(f"Processed {i} samples")
157
+ # save_submission(solution, Path(params['output_path']) / "submission.parquet")
158
  print('------------ Saving results ---------------')
159
+ save_submission(solution, Path(params['output_path']) / "submission.parquet")
 
160
  print("------------ Done ------------ ")