@@ -99,15 +99,9 @@ def d2_absolute_error_score_anon_sproc(session: snowpark.Session) -> bytes:
9999 multioutput = multioutput ,
100100 )
101101 result_module = cloudpickle .loads (pickled_snowflake_result )
102- result_object = result_module .SnowflakeResult (session , score )
103-
104- return result_object .serialize () # type: ignore[no-any-return]
105-
106- sproc_result = d2_absolute_error_score_anon_sproc (session )
107- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
108- if result_object_filepath is not None :
109- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
102+ return result_module .serialize (session , score ) # type: ignore[no-any-return]
110103
104+ result_object = result .deserialize (session , d2_absolute_error_score_anon_sproc (session ))
111105 score : Union [float , npt .NDArray [np .float_ ]] = result_object
112106 return score
113107
@@ -192,14 +186,9 @@ def d2_pinball_score_anon_sproc(session: snowpark.Session) -> bytes:
192186 multioutput = multioutput ,
193187 )
194188 result_module = cloudpickle .loads (pickled_result_module )
195- result_object = result_module .SnowflakeResult (session , score )
196-
197- return result_object .serialize () # type: ignore[no-any-return]
189+ return result_module .serialize (session , score ) # type: ignore[no-any-return]
198190
199- sproc_result = d2_pinball_score_anon_sproc (session )
200- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
201- if result_object_filepath is not None :
202- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
191+ result_object = result .deserialize (session , d2_pinball_score_anon_sproc (session ))
203192
204193 score : Union [float , npt .NDArray [np .float_ ]] = result_object
205194 return score
@@ -301,15 +290,9 @@ def explained_variance_score_anon_sproc(session: snowpark.Session) -> bytes:
301290 force_finite = force_finite ,
302291 )
303292 result_module = cloudpickle .loads (pickled_result_module )
304- result_object = result_module .SnowflakeResult (session , score )
305-
306- return result_object .serialize () # type: ignore[no-any-return]
307-
308- sproc_result = explained_variance_score_anon_sproc (session )
309- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
310- if result_object_filepath is not None :
311- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
293+ return result_module .serialize (session , score ) # type: ignore[no-any-return]
312294
295+ result_object = result .deserialize (session , explained_variance_score_anon_sproc (session ))
313296 score : Union [float , npt .NDArray [np .float_ ]] = result_object
314297 return score
315298
@@ -389,15 +372,9 @@ def mean_absolute_error_anon_sproc(session: snowpark.Session) -> bytes:
389372 )
390373
391374 result_module = cloudpickle .loads (pickled_result_module )
392- result_object = result_module .SnowflakeResult (session , loss )
393-
394- return result_object .serialize () # type: ignore[no-any-return]
395-
396- sproc_result = mean_absolute_error_anon_sproc (session )
397- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
398- if result_object_filepath is not None :
399- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
375+ return result_module .serialize (session , loss ) # type: ignore[no-any-return]
400376
377+ result_object = result .deserialize (session , mean_absolute_error_anon_sproc (session ))
401378 loss : Union [float , npt .NDArray [np .float_ ]] = result_object
402379 return loss
403380
@@ -485,15 +462,9 @@ def mean_absolute_percentage_error_anon_sproc(session: snowpark.Session) -> byte
485462 multioutput = multioutput ,
486463 )
487464 result_module = cloudpickle .loads (pickled_result_module )
488- result_object = result_module .SnowflakeResult (session , loss )
489-
490- return result_object .serialize () # type: ignore[no-any-return]
491-
492- sproc_result = mean_absolute_percentage_error_anon_sproc (session )
493- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
494- if result_object_filepath is not None :
495- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
465+ return result_module .serialize (session , loss ) # type: ignore[no-any-return]
496466
467+ result_object = result .deserialize (session , mean_absolute_percentage_error_anon_sproc (session ))
497468 loss : Union [float , npt .NDArray [np .float_ ]] = result_object
498469 return loss
499470
@@ -571,15 +542,9 @@ def mean_squared_error_anon_sproc(session: snowpark.Session) -> bytes:
571542 squared = squared ,
572543 )
573544 result_module = cloudpickle .loads (pickled_result_module )
574- result_object = result_module .SnowflakeResult (session , loss )
575-
576- return result_object .serialize () # type: ignore[no-any-return]
577-
578- sproc_result = mean_squared_error_anon_sproc (session )
579- result_object , result_object_filepath = cloudpickle .loads (sproc_result )
580- if result_object_filepath is not None :
581- result_object = result .SnowflakeResult .load_result_from_filepath (session , result_object_filepath )
545+ return result_module .serialize (session , loss ) # type: ignore[no-any-return]
582546
547+ result_object = result .deserialize (session , mean_squared_error_anon_sproc (session ))
583548 loss : Union [float , npt .NDArray [np .float_ ]] = result_object
584549 return loss
585550
0 commit comments