15 Apr 2025 15:49:13 [] [main]…
- User
15 Apr 2025 15:49:13 [] [main] (com.tcs.dss.cip.transformation.ModelScoringNodeProcessor-ModelScoringNodeProcessor.java:310) - Error in model execution. Details message from cdms: CDMS1016 : TypeError : Model execution error for the requested job with projcode=PROJ27 , modelcode=MC4 , model_version=V1 and jobrunid=MC4_1744732147 with exception Traceback (most recent call last): File "/u01/Homedir/cipuser/model/cdms_ins/com/tcs/serv/service/cdms_rt_async_service.py", line 334, in invoke_model getattr(prediction_class, invoking_method_name)(request_data[constants.INPUT_DATA]) File "/u01/Homedir/cipuser/model/cdms_ins/com/tcs/serv/utils/../../../../../cdms/custom_models/PROJ27_MC4_V1/custom_model.py", line 198, in get_prediction encoded_new_data = pd.DataFrame(encoder.transform(input_df[categorical_cols]), File "/u01/Homedir/cipuser/model/venv_ins/lib/python3.10/site-packages/sklearn/preprocessing/_encoders.py", line 882, in transform X_int, X_mask = self._transform( File "/u01/Homedir/cipuser/model/venv_ins/lib/python3.10/site-packages/sklearn/preprocessing/_encoders.py", line 152, in _transform diff, valid_mask = check_unknown(Xi, self.categories[i], return_mask=True) File "/u01/Homedir/cipuser/model/venv_ins/lib/python3.10/site-packages/sklearn/utils/_encode.py", line 303, in _check_unknown if np.isnan(known_values).any(): TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' . Please help debug this
- Assistant
- User
categorical_cols = ['pi_iteration_name','story_type'] # One-hot encode categorical columns for the test data
codewith open(os.path.join(model_path, 'encoded_categorical.pkl'), 'rb') as features_in: encoder=pickle.load(features_in) #new_data_scaled = scaler.transform(new_data_encoded) # Check if the encoder is fitted by verifying its 'categories_' attribute logger.info("encoded_categorical", encoder.categories_) if not hasattr(encoder, 'categories_'): raise ValueError("The OneHotEncoder instance is not fitted.") input_df[categorical_cols] = input_df[categorical_cols].astype(str).fillna('missing') encoded_new_data = pd.DataFrame(encoder.transform(input_df[categorical_cols]), columns=encoder.get_feature_names_out(categorical_cols))Now got error - Found unknown categories ['6', '1', '3'] in column 1 during transform
- Assistant