@Test public void testGetSettings() { TrainingParameters tp = build("k1=v1,n1.k2=v2,n2.k3=v3,n1.k4=v4"); assertEquals(buildMap("k1=v1"), tp.getSettings()); assertEquals(buildMap("k2=v2,k4=v4"), tp.getSettings("n1")); assertEquals(buildMap("k3=v3"), tp.getSettings("n2")); Assert.assertTrue(tp.getSettings("n3").isEmpty()); }
public Map<String, String> getSettings(String namespace) { Map<String, String> trainingParams = new HashMap<>(); String prefix = namespace + "."; for (Map.Entry<String, Object> entry : parameters.entrySet()) { String key = entry.getKey(); if (namespace != null) { if (key.startsWith(prefix)) { trainingParams.put(key.substring(prefix.length()), getStringValue(entry.getValue())); } } else { if (!key.contains(".")) { trainingParams.put(key, getStringValue(entry.getValue())); } } } return Collections.unmodifiableMap(trainingParams); }
TrainingParameters { public Map<String, String> getSettings(String namespace) { Map<String, String> trainingParams = new HashMap<>(); String prefix = namespace + "."; for (Map.Entry<String, Object> entry : parameters.entrySet()) { String key = entry.getKey(); if (namespace != null) { if (key.startsWith(prefix)) { trainingParams.put(key.substring(prefix.length()), getStringValue(entry.getValue())); } } else { if (!key.contains(".")) { trainingParams.put(key, getStringValue(entry.getValue())); } } } return Collections.unmodifiableMap(trainingParams); } }
TrainingParameters { public Map<String, String> getSettings(String namespace) { Map<String, String> trainingParams = new HashMap<>(); String prefix = namespace + "."; for (Map.Entry<String, Object> entry : parameters.entrySet()) { String key = entry.getKey(); if (namespace != null) { if (key.startsWith(prefix)) { trainingParams.put(key.substring(prefix.length()), getStringValue(entry.getValue())); } } else { if (!key.contains(".")) { trainingParams.put(key, getStringValue(entry.getValue())); } } } return Collections.unmodifiableMap(trainingParams); } TrainingParameters();  TrainingParameters(TrainingParameters trainingParameters);  TrainingParameters(Map<String,String> map);  TrainingParameters(InputStream in); }
TrainingParameters { public Map<String, String> getSettings(String namespace) { Map<String, String> trainingParams = new HashMap<>(); String prefix = namespace + "."; for (Map.Entry<String, Object> entry : parameters.entrySet()) { String key = entry.getKey(); if (namespace != null) { if (key.startsWith(prefix)) { trainingParams.put(key.substring(prefix.length()), getStringValue(entry.getValue())); } } else { if (!key.contains(".")) { trainingParams.put(key, getStringValue(entry.getValue())); } } } return Collections.unmodifiableMap(trainingParams); } TrainingParameters();  TrainingParameters(TrainingParameters trainingParameters);  TrainingParameters(Map<String,String> map);  TrainingParameters(InputStream in); String algorithm(String namespace); String algorithm(); Map<String, String> getSettings(String namespace); Map<String, String> getSettings(); Map<String, Object> getObjectSettings(String namespace); Map<String, Object> getObjectSettings(); TrainingParameters getParameters(String namespace); void putIfAbsent(String namespace, String key, String value); void putIfAbsent(String key, String value); void putIfAbsent(String namespace, String key, int value); void putIfAbsent(String key, int value); void putIfAbsent(String namespace, String key, double value); void putIfAbsent(String key, double value); void putIfAbsent(String namespace, String key, boolean value); void putIfAbsent(String key, boolean value); void put(String namespace, String key, String value); void put(String key, String value); void put(String namespace, String key, int value); void put(String key, int value); void put(String namespace, String key, double value); void put(String key, double value); void put(String namespace, String key, boolean value); void put(String key, boolean value); void serialize(OutputStream out); String getStringParameter(String key, String defaultValue); String getStringParameter(String namespace, String key, String defaultValue); int getIntParameter(String key, int defaultValue); int getIntParameter(String namespace, String key, int defaultValue); double getDoubleParameter(String key, double defaultValue); double getDoubleParameter(String namespace, String key, double defaultValue); boolean getBooleanParameter(String key, boolean defaultValue); boolean getBooleanParameter(String namespace, String key, boolean defaultValue); static TrainingParameters defaultParams(); }
TrainingParameters { public Map<String, String> getSettings(String namespace) { Map<String, String> trainingParams = new HashMap<>(); String prefix = namespace + "."; for (Map.Entry<String, Object> entry : parameters.entrySet()) { String key = entry.getKey(); if (namespace != null) { if (key.startsWith(prefix)) { trainingParams.put(key.substring(prefix.length()), getStringValue(entry.getValue())); } } else { if (!key.contains(".")) { trainingParams.put(key, getStringValue(entry.getValue())); } } } return Collections.unmodifiableMap(trainingParams); } TrainingParameters();  TrainingParameters(TrainingParameters trainingParameters);  TrainingParameters(Map<String,String> map);  TrainingParameters(InputStream in); String algorithm(String namespace); String algorithm(); Map<String, String> getSettings(String namespace); Map<String, String> getSettings(); Map<String, Object> getObjectSettings(String namespace); Map<String, Object> getObjectSettings(); TrainingParameters getParameters(String namespace); void putIfAbsent(String namespace, String key, String value); void putIfAbsent(String key, String value); void putIfAbsent(String namespace, String key, int value); void putIfAbsent(String key, int value); void putIfAbsent(String namespace, String key, double value); void putIfAbsent(String key, double value); void putIfAbsent(String namespace, String key, boolean value); void putIfAbsent(String key, boolean value); void put(String namespace, String key, String value); void put(String key, String value); void put(String namespace, String key, int value); void put(String key, int value); void put(String namespace, String key, double value); void put(String key, double value); void put(String namespace, String key, boolean value); void put(String key, boolean value); void serialize(OutputStream out); String getStringParameter(String key, String defaultValue); String getStringParameter(String namespace, String key, String defaultValue); int getIntParameter(String key, int defaultValue); int getIntParameter(String namespace, String key, int defaultValue); double getDoubleParameter(String key, double defaultValue); double getDoubleParameter(String namespace, String key, double defaultValue); boolean getBooleanParameter(String key, boolean defaultValue); boolean getBooleanParameter(String namespace, String key, boolean defaultValue); static TrainingParameters defaultParams(); static final String ALGORITHM_PARAM; static final String TRAINER_TYPE_PARAM; static final String ITERATIONS_PARAM; static final String CUTOFF_PARAM; static final String THREADS_PARAM; }