@Test public void test() throws ModelLoadingException { final DatasetSchema datasetSchema = new DatasetSchema(0, ImmutableList.of( new FieldSchema("field1", 0, new CategoricalValueSchema(false, ImmutableSet.of("fraud", "notfraud"))), new FieldSchema("field2", 1, new NumericValueSchema(false)), new FieldSchema("field3", 2, new NumericValueSchema(false)) )); final MachineLearningProvider<MachineLearningModelLoader<? extends ClassificationMLModel>> provider = new ExampleMLProvider(); assertThat(provider.getAlgorithms()) .as("The description of the algorithms provided") .hasSize(2); testProviderFor(datasetSchema, provider, 0, ExampleMLProvider.PREDICT_FIRST); testProviderFor(datasetSchema, provider, 1, ExampleMLProvider.PREDICT_SECOND); }
@Override public Set<MLAlgorithmDescriptor> getAlgorithms() { final URL documentation; try { documentation = new URL("http: } catch (final MalformedURLException e) { throw new RuntimeException(e); } final Set<ModelParameter> parameterList = ImmutableSet.of(new ModelParameter( "Not used Parameter", "This parameter is not really used at all.", "You can fill any number you wish, it is not relevant.", true, NumericFieldType.range(0, Double.MAX_VALUE, NumericFieldType.ParameterConfigType.DOUBLE, 42.0) )); return ImmutableSet.of( new MLAlgorithmDescriptor( PREDICT_FIRST, parameterList, MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION, documentation ), new MLAlgorithmDescriptor( PREDICT_SECOND, parameterList, MachineLearningAlgorithmType.MULTI_CLASSIFICATION, documentation ) ); }
ExampleMLProvider implements MachineLearningProvider<MachineLearningModelLoader<? extends ClassificationMLModel>> { @Override public Set<MLAlgorithmDescriptor> getAlgorithms() { final URL documentation; try { documentation = new URL("http: } catch (final MalformedURLException e) { throw new RuntimeException(e); } final Set<ModelParameter> parameterList = ImmutableSet.of(new ModelParameter( "Not used Parameter", "This parameter is not really used at all.", "You can fill any number you wish, it is not relevant.", true, NumericFieldType.range(0, Double.MAX_VALUE, NumericFieldType.ParameterConfigType.DOUBLE, 42.0) )); return ImmutableSet.of( new MLAlgorithmDescriptor( PREDICT_FIRST, parameterList, MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION, documentation ), new MLAlgorithmDescriptor( PREDICT_SECOND, parameterList, MachineLearningAlgorithmType.MULTI_CLASSIFICATION, documentation ) ); } }
ExampleMLProvider implements MachineLearningProvider<MachineLearningModelLoader<? extends ClassificationMLModel>> { @Override public Set<MLAlgorithmDescriptor> getAlgorithms() { final URL documentation; try { documentation = new URL("http: } catch (final MalformedURLException e) { throw new RuntimeException(e); } final Set<ModelParameter> parameterList = ImmutableSet.of(new ModelParameter( "Not used Parameter", "This parameter is not really used at all.", "You can fill any number you wish, it is not relevant.", true, NumericFieldType.range(0, Double.MAX_VALUE, NumericFieldType.ParameterConfigType.DOUBLE, 42.0) )); return ImmutableSet.of( new MLAlgorithmDescriptor( PREDICT_FIRST, parameterList, MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION, documentation ), new MLAlgorithmDescriptor( PREDICT_SECOND, parameterList, MachineLearningAlgorithmType.MULTI_CLASSIFICATION, documentation ) ); }  }
ExampleMLProvider implements MachineLearningProvider<MachineLearningModelLoader<? extends ClassificationMLModel>> { @Override public Set<MLAlgorithmDescriptor> getAlgorithms() { final URL documentation; try { documentation = new URL("http: } catch (final MalformedURLException e) { throw new RuntimeException(e); } final Set<ModelParameter> parameterList = ImmutableSet.of(new ModelParameter( "Not used Parameter", "This parameter is not really used at all.", "You can fill any number you wish, it is not relevant.", true, NumericFieldType.range(0, Double.MAX_VALUE, NumericFieldType.ParameterConfigType.DOUBLE, 42.0) )); return ImmutableSet.of( new MLAlgorithmDescriptor( PREDICT_FIRST, parameterList, MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION, documentation ), new MLAlgorithmDescriptor( PREDICT_SECOND, parameterList, MachineLearningAlgorithmType.MULTI_CLASSIFICATION, documentation ) ); }  @Override String getName(); @Override Set<MLAlgorithmDescriptor> getAlgorithms(); @Override Optional<MachineLearningModelLoader<? extends ClassificationMLModel>> getModelCreator(final String algorithmName); }
ExampleMLProvider implements MachineLearningProvider<MachineLearningModelLoader<? extends ClassificationMLModel>> { @Override public Set<MLAlgorithmDescriptor> getAlgorithms() { final URL documentation; try { documentation = new URL("http: } catch (final MalformedURLException e) { throw new RuntimeException(e); } final Set<ModelParameter> parameterList = ImmutableSet.of(new ModelParameter( "Not used Parameter", "This parameter is not really used at all.", "You can fill any number you wish, it is not relevant.", true, NumericFieldType.range(0, Double.MAX_VALUE, NumericFieldType.ParameterConfigType.DOUBLE, 42.0) )); return ImmutableSet.of( new MLAlgorithmDescriptor( PREDICT_FIRST, parameterList, MachineLearningAlgorithmType.SUPERVISED_BINARY_CLASSIFICATION, documentation ), new MLAlgorithmDescriptor( PREDICT_SECOND, parameterList, MachineLearningAlgorithmType.MULTI_CLASSIFICATION, documentation ) ); }  @Override String getName(); @Override Set<MLAlgorithmDescriptor> getAlgorithms(); @Override Optional<MachineLearningModelLoader<? extends ClassificationMLModel>> getModelCreator(final String algorithmName); static final String NAME; static final String PREDICT_FIRST; static final String PREDICT_SECOND; }