Java Code Examples for com.typesafe.config.Config#getDoubleList()

The following examples show how to use com.typesafe.config.Config#getDoubleList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LossParams.java    From ytk-learn with MIT License 6 votes vote down vote up
public Regularization(Config config, String prefix) {
    List<Double> l1List = config.getDoubleList(prefix + KEY + "l1");
    l1 = new double[l1List.size()];
    for (int i = 0; i < l1List.size(); i++) {
        l1[i] = l1List.get(i);
    }
    List<Double> l2List = config.getDoubleList(prefix + KEY + "l2");
    l2 = new double[l2List.size()];
    for (int i = 0; i < l2List.size(); i++) {
        l2[i] = l2List.get(i);
    }

    CheckUtils.check(l1.length == l2.length,
            "%sl1 lenght must be equal to %sl2 lenght",
            prefix + KEY,
            prefix + KEY);

}
 
Example 2
Source File: HyperParams.java    From ytk-learn with MIT License 6 votes vote down vote up
public Hoag(Config config, String prefix) {
    init_step = config.getDouble(prefix + KEY + "init_step");
    step_decr_factor = config.getDouble(prefix + KEY + "step_decr_factor");
    test_loss_reduce_limit = config.getDouble(prefix + KEY + "test_loss_reduce_limit");
    outer_iter = config.getInt(prefix + KEY + "outer_iter");
    List<Double> l1List = config.getDoubleList(prefix + KEY + "l1");
    List<Double> l2List = config.getDoubleList(prefix + KEY + "l2");
    l1 = new double[l1List.size()];
    l2 = new double[l2List.size()];
    for (int i = 0; i < l2.length; i ++) {
        l1[i] = l1List.get(i);
        l2[i] = l2List.get(i);
    }

    CheckUtils.check(step_decr_factor < 1.0, "%sstep_decr_factor:%f must < 1.0",
            prefix + KEY, step_decr_factor);
    CheckUtils.check(l1.length == l2.length,
            "%sl1 lenght must be equal to %sl2 lenght",
            prefix + KEY,
            prefix + KEY);
}
 
Example 3
Source File: HyperParams.java    From ytk-learn with MIT License 6 votes vote down vote up
public Grid(Config config, String prefix) {
    List<Double> l1List = config.getDoubleList(prefix + KEY + "l1");
    List<Double> l2List = config.getDoubleList(prefix + KEY + "l2");

    CheckUtils.check(l1List.size() == l2List.size(),
            "%sl1 length must be equal to %sl2 length",
            prefix + KEY,
            prefix + KEY);

    l1 = new double[l1List.size() / 3][3];
    l2 = new double[l2List.size() / 3][3];

    for (int i = 0; i < l1.length; i++) {
        for (int j = 0; j < 3; j++) {
            l1[i][j] = l1List.get(i * 3 + j);
            l2[i][j] = l2List.get(i * 3 + j);
        }
    }


}
 
Example 4
Source File: GBSDTDataFlow.java    From ytk-learn with MIT License 5 votes vote down vote up
public GBSDTDataFlow(IFileSystem fs,
                     Config config,
                     ThreadCommSlave comm,
                     int threadNum,
                     boolean needPyTransform,
                     String pyTransformScript) throws Exception {
    super(fs, config, comm, threadNum, needPyTransform, pyTransformScript);
    this.leafRange = config.getDoubleList("leaf_random_init_range");
    LOG_UTILS.importantInfo("leaf_random_init_range:" + leafRange);
}
 
Example 5
Source File: ConfigBeanImpl.java    From mpush with Apache License 2.0 5 votes vote down vote up
private static Object getListValue(Class<?> beanClass, Type parameterType, Class<?> parameterClass, Config config, String configPropName) {
    Type elementType = ((ParameterizedType) parameterType).getActualTypeArguments()[0];

    if (elementType == Boolean.class) {
        return config.getBooleanList(configPropName);
    } else if (elementType == Integer.class) {
        return config.getIntList(configPropName);
    } else if (elementType == Double.class) {
        return config.getDoubleList(configPropName);
    } else if (elementType == Long.class) {
        return config.getLongList(configPropName);
    } else if (elementType == String.class) {
        return config.getStringList(configPropName);
    } else if (elementType == Duration.class) {
        return config.getDurationList(configPropName);
    } else if (elementType == ConfigMemorySize.class) {
        return config.getMemorySizeList(configPropName);
    } else if (elementType == Object.class) {
        return config.getAnyRefList(configPropName);
    } else if (elementType == Config.class) {
        return config.getConfigList(configPropName);
    } else if (elementType == ConfigObject.class) {
        return config.getObjectList(configPropName);
    } else if (elementType == ConfigValue.class) {
        return config.getList(configPropName);
    } else {
        throw new ConfigException.BadBean("Bean property '" + configPropName + "' of class " + beanClass.getName() + " has unsupported list element type " + elementType);
    }
}