@Test public void testVoidClassificationMLModel() { assertThatThrownBy( () -> ClassificationValidationUtils.validateClassificationModel( SCHEMA, null )) .isInstanceOf(NullPointerException.class) .hasMessageContaining(NULL_ERROR_MSG); }
public static void validateClassificationModel(final DatasetSchema schema, final ClassificationMLModel model) throws ModelLoadingException { Preconditions.checkNotNull(schema, "schema cannot be null"); Preconditions.checkNotNull(model, "model cannot be null"); final MockDataset mockDataset = new MockDataset(schema, 1, new Random(0)); try { model.classify(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = String.format("Model classification is not compatible with the given schema %s.", schema); logger.error(msg, e); throw new ModelLoadingException(msg, e); } try { model.getClassDistribution(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = "Model does not support class distribution."; logger.error(msg, e); throw new ModelLoadingException(msg, e); } }
ClassificationValidationUtils { public static void validateClassificationModel(final DatasetSchema schema, final ClassificationMLModel model) throws ModelLoadingException { Preconditions.checkNotNull(schema, "schema cannot be null"); Preconditions.checkNotNull(model, "model cannot be null"); final MockDataset mockDataset = new MockDataset(schema, 1, new Random(0)); try { model.classify(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = String.format("Model classification is not compatible with the given schema %s.", schema); logger.error(msg, e); throw new ModelLoadingException(msg, e); } try { model.getClassDistribution(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = "Model does not support class distribution."; logger.error(msg, e); throw new ModelLoadingException(msg, e); } } }
ClassificationValidationUtils { public static void validateClassificationModel(final DatasetSchema schema, final ClassificationMLModel model) throws ModelLoadingException { Preconditions.checkNotNull(schema, "schema cannot be null"); Preconditions.checkNotNull(model, "model cannot be null"); final MockDataset mockDataset = new MockDataset(schema, 1, new Random(0)); try { model.classify(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = String.format("Model classification is not compatible with the given schema %s.", schema); logger.error(msg, e); throw new ModelLoadingException(msg, e); } try { model.getClassDistribution(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = "Model does not support class distribution."; logger.error(msg, e); throw new ModelLoadingException(msg, e); } } private  ClassificationValidationUtils(); }
ClassificationValidationUtils { public static void validateClassificationModel(final DatasetSchema schema, final ClassificationMLModel model) throws ModelLoadingException { Preconditions.checkNotNull(schema, "schema cannot be null"); Preconditions.checkNotNull(model, "model cannot be null"); final MockDataset mockDataset = new MockDataset(schema, 1, new Random(0)); try { model.classify(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = String.format("Model classification is not compatible with the given schema %s.", schema); logger.error(msg, e); throw new ModelLoadingException(msg, e); } try { model.getClassDistribution(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = "Model does not support class distribution."; logger.error(msg, e); throw new ModelLoadingException(msg, e); } } private  ClassificationValidationUtils(); static void validateClassificationModel(final DatasetSchema schema,
                                                   final ClassificationMLModel model); static void validateParamsModelToLoad(final MachineLearningModelLoader modelLoader,
                                                 final Path modelPath,
                                                 final DatasetSchema schema,
                                                 final Map<String, String> params); }
ClassificationValidationUtils { public static void validateClassificationModel(final DatasetSchema schema, final ClassificationMLModel model) throws ModelLoadingException { Preconditions.checkNotNull(schema, "schema cannot be null"); Preconditions.checkNotNull(model, "model cannot be null"); final MockDataset mockDataset = new MockDataset(schema, 1, new Random(0)); try { model.classify(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = String.format("Model classification is not compatible with the given schema %s.", schema); logger.error(msg, e); throw new ModelLoadingException(msg, e); } try { model.getClassDistribution(mockDataset.instance(0)); } catch (final RuntimeException e) { final String msg = "Model does not support class distribution."; logger.error(msg, e); throw new ModelLoadingException(msg, e); } } private  ClassificationValidationUtils(); static void validateClassificationModel(final DatasetSchema schema,
                                                   final ClassificationMLModel model); static void validateParamsModelToLoad(final MachineLearningModelLoader modelLoader,
                                                 final Path modelPath,
                                                 final DatasetSchema schema,
                                                 final Map<String, String> params);  }