当前位置: 首页>>代码示例>>Java>>正文


Java Injector.instanceOf方法代码示例

本文整理汇总了Java中play.inject.Injector.instanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java Injector.instanceOf方法的具体用法?Java Injector.instanceOf怎么用?Java Injector.instanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在play.inject.Injector的用法示例。


在下文中一共展示了Injector.instanceOf方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
public static PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector) {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    double alpha = 0.1;
    if (predictorConfig.asMap().containsKey("alpha")) {
        alpha = predictorConfig.getDouble("alpha");
    }
    double lambda = 1.0;
    if (predictorConfig.asMap().containsKey("lambda")) {
        lambda = predictorConfig.getDouble("lambda");
    }
    return new LinearUCBPredictorConfig(predictorConfig.getString("modelName"),
            feaExtConfigs, predictorConfig.getStringList("features"),
            predictorConfig.getInt("numMainFeatures"),
            predictorConfig.getString("labelName"),
            predictorConfig.getString("weightName"), daoConfigs, expanders, injector,
            predictorConfig.getConfig("onlineOptimizationMethod"),
            predictorConfig.getString("modelFile"),
            predictorConfig.getString("daoConfigKey"), lambda, alpha,
            predictorConfig.getStringList("evaluatorNames"), predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:27,代码来源:LinearUCBPredictorConfig.java

示例2: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
public static PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector) {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    int maxIter = predictorConfig.getInt("maxNumTrees");
    StandardBoostingMethod boostingMethod = new StandardBoostingMethod(maxIter);
    return new GBDTPredictorConfig(predictorConfig.getString("modelName"),
            feaExtConfigs, predictorConfig.getStringList("features"),
            predictorConfig.getString("labelName"),
            predictorConfig.getString("weightName"), daoConfigs, expanders, injector,
            injector.instanceOf(TreeLearningMethod.class),
            predictorConfig.getStringList("groupKeys"),
            predictorConfig.getString("modelFile"),
            predictorConfig.getConfig("objectiveConfig"), boostingMethod,
            predictorConfig.getString("daoConfigKey"),
            predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:22,代码来源:GBDTPredictorConfig.java

示例3: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
public static PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector) {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    return new RegressionTreePredictorConfig(predictorConfig.getString("modelName"),
            feaExtConfigs, predictorConfig.getStringList("features"),
            predictorConfig.getString("labelName"),
            predictorConfig.getString("weightName"), daoConfigs, expanders, injector,
            injector.instanceOf(TreeLearningMethod.class),
            predictorConfig.getString("modelFile"),
            predictorConfig.getString("daoConfigKey"), predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:17,代码来源:RegressionTreePredictorConfig.java

示例4: beforeStart

import play.inject.Injector; //导入方法依赖的package包/类
public void beforeStart(Application application) {
    Injector injector = application.injector();
    Configuration configuration = application.configuration();
    SamanthaConfigService configService = injector.instanceOf(SamanthaConfigService.class);
    List<String> enabledEngines = configuration.getStringList(ConfigKey.ENGINES_ENABLED.get());
    Configuration samanthaConfig = configuration.getConfig(ConfigKey.SAMANTHA_BASE.get());
    for (String engine : enabledEngines) {
        Configuration engineConfig = samanthaConfig.getConfig(engine);
        List<String> schedulerNames = engineConfig.getStringList(ConfigKey.ENGINE_BEFORE_START_SCHEDULERS.get());
        if (schedulerNames != null) {
            for (String scheduler : schedulerNames) {
                RequestContext peudoReq = new RequestContext(Json.newObject(), engine);
                configService.getSchedulerConfig(scheduler, peudoReq).runJobs();
            }
        }
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:18,代码来源:ServerGlobal.java

示例5: getIndexerConfig

import play.inject.Injector; //导入方法依赖的package包/类
static public IndexerConfig getIndexerConfig(Configuration indexerConfig,
                                             Injector injector) {
    ElasticSearchService elasticSearchService = injector
            .instanceOf(ElasticSearchService.class);
    String elasticSearchIndex = indexerConfig.getString("elasticSearchIndex");
    Configuration settingConfig = indexerConfig.getConfig("elasticSearchSetting");
    if (!elasticSearchService.existsIndex(elasticSearchIndex).isExists()) {
        elasticSearchService.createIndex(elasticSearchIndex, settingConfig);
    }
    Configuration mappingConfig = indexerConfig.getConfig("elasticSearchMapping");
    for (String typeName : mappingConfig.subKeys()) {
        if (!elasticSearchService.existsType(elasticSearchIndex, typeName)
                .isExists()) {
            elasticSearchService.putMapping(elasticSearchIndex, typeName,
                    mappingConfig.getConfig(typeName));
        }
    }
    return new ESBasedIndexerConfig(indexerConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get()),
            elasticSearchIndex, indexerConfig.getString("indexTypeKey"),
            indexerConfig.getString("indexType"),
            indexerConfig.getStringList("uniqueFields"),
            injector, indexerConfig.getString("daoConfigKey"),
            indexerConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:25,代码来源:ESBasedIndexerConfig.java

示例6: getExpander

import play.inject.Injector; //导入方法依赖的package包/类
public static EntityExpander getExpander(Configuration expanderConfig,
                                  Injector injector, RequestContext requestContext) {
    String predictorName = expanderConfig.getString("predictorName");
    SamanthaConfigService configService = injector.instanceOf(SamanthaConfigService.class);
    Predictor predictor = configService.getPredictor(predictorName, requestContext);
    return new PredictorBasedExpander(predictor, expanderConfig.getString("scoreAttr"),
            expanderConfig.getString("scoresAttr"));
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:9,代码来源:PredictorBasedExpander.java

示例7: getExpander

import play.inject.Injector; //导入方法依赖的package包/类
public static EntityExpander getExpander(Configuration expanderConfig,
                                         Injector injector, RequestContext requestContext) {
    String retrieverName = expanderConfig.getString("retrieverName");
    SamanthaConfigService configService = injector.instanceOf(SamanthaConfigService.class);
    Retriever retriever = configService.getRetriever(retrieverName, requestContext);
    boolean exclude = true;
    if (expanderConfig.asMap().containsKey("exclude")) {
        exclude = expanderConfig.getBoolean("exclude");
    }
    return new RetrieverBasedItemFilterExpander(retriever, expanderConfig.getStringList("itemAttrs"),
            exclude);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:13,代码来源:RetrieverBasedItemFilterExpander.java

示例8: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
public static PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector) {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daosConfig = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    return new RegressionTreeGBCentPredictorConfig(predictorConfig.getString("modelName"),
            predictorConfig.getString("svdfeaModelName"), predictorConfig.getString("svdfeaPredictorName"),
            predictorConfig.getStringList("treeFeatures"), predictorConfig.getStringList("groupKeys"),
            feaExtConfigs, daosConfig, expanders,
            predictorConfig.getConfig("methodConfig"), injector, predictorConfig.getString("modelFile"),
            predictorConfig.getString("daoConfigKey"), predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:16,代码来源:RegressionTreeGBCentPredictorConfig.java

示例9: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
static public PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector)
        throws ConfigurationException {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    List<String> evaluatorNames = new ArrayList<>();
    if (predictorConfig.asMap().containsKey("evaluatorNames")) {
        evaluatorNames = predictorConfig.getStringList("evaluatorNames");
    }
    return new TensorFlowPredictorConfig(
            predictorConfig.getStringList("groupKeys"),
            predictorConfig.getStringList("indexKeys"),
            evaluatorNames,
            predictorConfig.getString("modelFile"),
            predictorConfig.getString("modelName"),
            feaExtConfigs, daoConfigs,
            predictorConfig.getConfig("methodConfig"),
            predictorConfig.getConfig("onlineMethodConfig"),
            injector, expanders,
            predictorConfig.getString("daoConfigKey"),
            predictorConfig.getString("outputOperationName"),
            predictorConfig.getString("updateOperationName"),
            predictorConfig.getString("lossOperationName"),
            predictorConfig.getString("initOperationName"),
            predictorConfig.getString("graphDefFilePath"),
            predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:32,代码来源:TensorFlowPredictorConfig.java

示例10: getPredictorConfig

import play.inject.Injector; //导入方法依赖的package包/类
static public PredictorConfig getPredictorConfig(Configuration predictorConfig,
                                                 Injector injector)
        throws ConfigurationException {
    FeaturizerConfigParser parser = injector.instanceOf(
            FeatureExtractorListConfigParser.class);
    Configuration daoConfigs = predictorConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get());
    String dependPredictorName = null, dependPredictorModelName = null;
    if (predictorConfig.asMap().containsKey("dependPredictorName")) {
        dependPredictorName = predictorConfig.getString("dependPredictorName");
        dependPredictorModelName = predictorConfig.getString("dependPredictorModelName");
    }
    List<FeatureExtractorConfig> feaExtConfigs = parser.parse(predictorConfig
            .getConfig(ConfigKey.PREDICTOR_FEATURIZER_CONFIG.get()));
    List<Configuration> expanders = ExpanderUtilities.getEntityExpandersConfig(predictorConfig);
    List<String> evaluatorNames = new ArrayList<>();
    if (predictorConfig.asMap().containsKey("evaluatorNames")) {
        evaluatorNames = predictorConfig.getStringList("evaluatorNames");
    }
    return new SVDFeaturePredictorConfig(
            predictorConfig.getStringList("biasFeas"),
            predictorConfig.getStringList("ufactFeas"),
            predictorConfig.getStringList("ifactFeas"),
            predictorConfig.getStringList("groupKeys"),
            evaluatorNames,
            predictorConfig.getString("modelFile"),
            predictorConfig.getString("modelName"),
            predictorConfig.getString("labelName"),
            predictorConfig.getString("weightName"),
            predictorConfig.getInt("factDim"),
            predictorConfig.getConfig("onlineOptimizationMethod"),
            predictorConfig.getConfig("optimizationMethod"),
            predictorConfig.getConfig("objectiveConfig"),
            feaExtConfigs, daoConfigs,
            dependPredictorName,
            dependPredictorModelName, injector, expanders,
            predictorConfig.getString("daoConfigKey"),
            predictorConfig);
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:39,代码来源:SVDFeaturePredictorConfig.java

示例11: getRetrieverConfig

import play.inject.Injector; //导入方法依赖的package包/类
static public RetrieverConfig getRetrieverConfig(Configuration retrieverConfig,
                                                 Injector injector)
        throws ConfigurationException {
    ElasticSearchService elasticSearchService = injector
            .instanceOf(ElasticSearchService.class);
    String elasticSearchIndex = retrieverConfig.getString("elasticSearchIndex");
    Configuration settingConfig = retrieverConfig.getConfig("elasticSearchSetting");
    if (!elasticSearchService.existsIndex(elasticSearchIndex).isExists()) {
        elasticSearchService.createIndex(elasticSearchIndex, settingConfig);
    }
    String elasticSearchScoreName = retrieverConfig.getString("elasticSearchScoreName");
    List<String> retrieveFields = retrieverConfig.getStringList("retrieveFields");
    Configuration mappingConfig = retrieverConfig.getConfig("elasticSearchMapping");
    for (String typeName : mappingConfig.subKeys()) {
        if (!elasticSearchService.existsType(elasticSearchIndex, typeName)
                .isExists()) {
            elasticSearchService.putMapping(elasticSearchIndex, typeName,
                    mappingConfig.getConfig(typeName));
        }
    }
    Boolean defaultMatchAll = retrieverConfig.getBoolean("defaultMatchAll", false);
    return new ESQueryBasedRetrieverConfig(retrieverConfig.getString("elasticSearchIndex"),
            elasticSearchScoreName, retrieverConfig.getString("retrieveType"),
            retrieveFields, retrieverConfig.getString("elasticSearchReqKey"),
            retrieverConfig.getString("setScrollKey"), defaultMatchAll,
            injector, retrieverConfig, retrieverConfig.getString("queryKey"),
            retrieverConfig.getStringList("matchFields"));
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:29,代码来源:ESQueryBasedRetrieverConfig.java

示例12: getExpander

import play.inject.Injector; //导入方法依赖的package包/类
public static EntityExpander getExpander(Configuration expanderConfig,
                                         Injector injector, RequestContext requestContext) {
    return new ESBasedJoinExpander(injector.instanceOf(ElasticSearchService.class),
            expanderConfig.getString("elasticSearchIndex"),
            expanderConfig.getConfigList("expandFields"));
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:7,代码来源:ESBasedJoinExpander.java

示例13: getExpander

import play.inject.Injector; //导入方法依赖的package包/类
public static EntityExpander getExpander(Configuration expanderConfig,
                                         Injector injector,
                                         RequestContext requestContext) {
    return new RedisBasedJoinExpander(expanderConfig.getConfigList("expandFields"),
            injector.instanceOf(RedisService.class));
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:7,代码来源:RedisBasedJoinExpander.java


注:本文中的play.inject.Injector.instanceOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。