play.inject.Injector Java Examples
The following examples show how to use
play.inject.Injector.
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: SQLBasedRetrieverConfig.java From samantha with MIT License | 6 votes |
private SQLBasedRetrieverConfig(String setCursorKey, Integer limit, Integer offset, String selectSqlKey, List<String> matchFields, List<String> greaterFields, List<String> lessFields, List<String> matchFieldTypes, List<String> greaterFieldTypes, List<String> lessFieldTypes, String db, List<String> selectFields, Map<String, String> renameMap, String table, Map<String, Boolean> orderByFields, Injector injector, Configuration config) { super(config); this.injector = injector; this.setCursorKey = setCursorKey; this.limit = limit; this.offset = offset; this.selectSqlKey = selectSqlKey; this.matchFields = matchFields; this.greaterFields = greaterFields; this.lessFields = lessFields; this.matchFieldTypes = matchFieldTypes; this.greaterFieldTypes = greaterFieldTypes; this.lessFieldTypes = lessFieldTypes; this.db = db; this.selectFields = selectFields; this.table = table; this.orderByFields = orderByFields; this.renameMap = renameMap; }
Example #2
Source File: XGBoostPredictorConfig.java From samantha with MIT License | 6 votes |
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 round = predictorConfig.getInt("numTrees"); return new XGBoostPredictorConfig(predictorConfig.getString("modelName"), feaExtConfigs, predictorConfig.getStringList("features"), predictorConfig.getString("labelName"), predictorConfig.getString("weightName"), daoConfigs, expanders, injector, new XGBoostMethod(predictorConfig.getConfig("methodConfig").asMap(), round), predictorConfig.getString("modelFile"), predictorConfig.getString("daoConfigKey"), predictorConfig); }
Example #3
Source File: ServerGlobal.java From samantha with MIT License | 6 votes |
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(); } } } }
Example #4
Source File: MAPLossConfig.java From samantha with MIT License | 6 votes |
static public ObjectiveFunction getObjectiveFunction(Configuration objectiveConfig, Injector injector, RequestContext requestContext) { double sigma = 1.0; int N = RankerUtilities.defaultPageSize; double threshold = 0.5; if (objectiveConfig.asMap().containsKey("sigma")) { sigma = objectiveConfig.getDouble("sigma"); } if (objectiveConfig.asMap().containsKey("N")) { N = objectiveConfig.getInt("N"); } if (objectiveConfig.asMap().containsKey("threshold")) { threshold = objectiveConfig.getDouble("threshold"); } return new MAPLoss(N, sigma, threshold); }
Example #5
Source File: PercentileExpander.java From samantha with MIT License | 6 votes |
public static EntityExpander getExpander(Configuration expanderConfig, Injector injector, RequestContext requestContext) { JsonNode reqBody = requestContext.getRequestBody(); String modelName = expanderConfig.getString("modelName"); String modelFile = expanderConfig.getString("modelFile"); List<String> attrNames = JsonHelpers.getOptionalStringList(reqBody, expanderConfig.getString("attrNamesKey"), expanderConfig.getStringList("attrNames")); Configuration daoConfigs = expanderConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get()); double sampleRate = 1.0; if (expanderConfig.asMap().containsKey("sampleRate")) { sampleRate = expanderConfig.getDouble("sampleRate"); } int maxNumValues = 100; if (expanderConfig.asMap().containsKey("maxNumValues")) { maxNumValues = expanderConfig.getInt("maxNumValues"); } ModelManager modelManager = new PercentileModelManager(modelName, modelFile, injector, attrNames, maxNumValues, sampleRate, expanderConfig.getConfig("attrName2Config"), expanderConfig.getString("daoConfigKey"), daoConfigs); PercentileModel model = (PercentileModel) modelManager.manage(requestContext); return new PercentileExpander(expanderConfig.getStringList("attrNames"), model); }
Example #6
Source File: AggregateIndexerConfig.java From samantha with MIT License | 6 votes |
public static IndexerConfig getIndexerConfig(Configuration indexerConfig, Injector injector) { return new AggregateIndexerConfig(indexerConfig, injector, indexerConfig.getConfig(ConfigKey.ENTITY_DAOS_CONFIG.get()), indexerConfig.getString("daoConfigKey"), indexerConfig.getStringList("otherFields"), indexerConfig.getString("daoNameKey"), indexerConfig.getString("daoName"), indexerConfig.getString("filesKey"), indexerConfig.getString("filePathKey"), indexerConfig.getString("separatorKey"), indexerConfig.getString("dependedGroupIndexer"), indexerConfig.getStringList("groupKeys"), indexerConfig.getString("filePath"), indexerConfig.getString("separator"), indexerConfig.getString("aggCntName"), indexerConfig.getString("aggSumAppendix"), indexerConfig.getStringList("aggFields") ); }
Example #7
Source File: GBCentLearningMethodConfig.java From samantha with MIT License | 6 votes |
public static LearningMethod getLearningMethod(Configuration methodConfig, Injector injector, RequestContext requestContext) { double minTreeGain = 0.0; if (methodConfig.asMap().containsKey("minTreeGain")) { minTreeGain = methodConfig.getDouble("minTreeGain"); } GBCentLearningMethod method = new GBCentLearningMethod( (OnlineOptimizationMethod) PredictorUtilities.getLearningMethod(methodConfig .getConfig("onlineOptimizationMethod"), injector, requestContext), (TreeLearningMethod) PredictorUtilities.getLearningMethod(methodConfig .getConfig("treeLearningMethod"), injector, requestContext), methodConfig.getInt("minSupport"), methodConfig.getBoolean("learnSvdfea"), minTreeGain ); return method; }
Example #8
Source File: TensorFlowMethodConfig.java From samantha with MIT License | 6 votes |
public static LearningMethod getLearningMethod(Configuration methodConfig, Injector injector, RequestContext requestContext) { double tol = 5.0; if (methodConfig.asMap().containsKey("tol")) { tol = methodConfig.getDouble("tol"); } int minIter = 2; if (methodConfig.asMap().containsKey("minIter")) { minIter = methodConfig.getInt("minIter"); } int maxIter = 50; if (methodConfig.asMap().containsKey("maxIter")) { maxIter = methodConfig.getInt("maxIter"); } Integer num = Runtime.getRuntime().availableProcessors(); if (methodConfig.getInt("numProcessors") != null) { num = methodConfig.getInt("numProcessors"); } TensorFlowMethod method = new TensorFlowMethod(tol, maxIter, minIter, num); return method; }
Example #9
Source File: DisplayActionGroupExtractorConfig.java From samantha with MIT License | 6 votes |
public static FeatureExtractorConfig getFeatureExtractorConfig(Configuration extractorConfig, Injector injector) { Boolean normalize = extractorConfig.getBoolean("normalize"); if (normalize == null) { normalize = true; } return new DisplayActionGroupExtractorConfig( extractorConfig.getString("index"), extractorConfig.getString("sizeFeaIndex"), extractorConfig.getString("attr"), extractorConfig.getString("inGrpRank"), extractorConfig.getString("fea"), extractorConfig.getString("sizeFea"), extractorConfig.getStringList("actionIndices"), extractorConfig.getStringList("actionAttrs"), extractorConfig.getStringList("actionFeas"), extractorConfig.getBooleanList("extractBools"), extractorConfig.getString("displayActionIndex"), extractorConfig.getString("displayActionFea"), extractorConfig.getString("separator"), normalize, extractorConfig.getInt("maxGrpNum"), extractorConfig.getInt("grpSize")); }
Example #10
Source File: ESQueryBasedRetriever.java From samantha with MIT License | 6 votes |
public ESQueryBasedRetriever(ElasticSearchService elasticSearchService, String elasticSearchScoreName, String elasticSearchReqKey, boolean defaultMatchAll, String setScrollKey, String elasticSearchIndex, String retrieveType, List<String> retrieveFields, Configuration config, List<String> matchFields, String queryKey, RequestContext requestContext, Injector injector) { super(config, requestContext, injector); this.elasticSearchService = elasticSearchService; this.elasticSearchScoreName= elasticSearchScoreName; this.elasticSearchIndex = elasticSearchIndex; this.elasticSearchReqKey = elasticSearchReqKey; this.setScrollKey = setScrollKey; this.retrieveFields = retrieveFields; this.retrieveType = retrieveType; this.defaultMatchAll = defaultMatchAll; if (matchFields != null) { this.matchFields = matchFields.toArray(new String[matchFields.size()]); } else { this.matchFields = new String[0]; } this.queryKey = queryKey; }
Example #11
Source File: RegressionTreePredictorConfig.java From samantha with MIT License | 6 votes |
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); }
Example #12
Source File: SQLBasedIndexerConfig.java From samantha with MIT License | 6 votes |
private SQLBasedIndexerConfig(Injector injector, Configuration config, Configuration daoConfigs, String daoConfigKey, String db, String tableKey, String table, List<String> matchFields, List<String> matchFieldTypes, List<String> fields, List<String> fieldTypes, String retrieverName, String setCursorKey, String daoNameKey, String daoName, String cacheJsonFile, String filePathKey, String separatorKey) { this.injector = injector; this.config = config; this.daoConfigKey = daoConfigKey; this.daoConfigs = daoConfigs; this.db = db; this.table = table; this.tableKey = tableKey; this.fields = fields; this.fieldTypes = fieldTypes; this.matchFields = matchFields; this.matchFieldTypes = matchFieldTypes; this.retrieverName = retrieverName; this.setCursorKey = setCursorKey; this.daoName = daoName; this.daoNameKey = daoNameKey; this.cacheJsonFile = cacheJsonFile; this.filePathKey = filePathKey; this.separatorKey = separatorKey; }
Example #13
Source File: UserReturnIndexer.java From samantha with MIT License | 6 votes |
public UserReturnIndexer(SamanthaConfigService configService, Configuration config, Injector injector, Configuration daoConfigs, String daoConfigKey, String filePathKey, String timestampField, List<String> dataFields, String separator, String daoNameKey, String daoName, String filesKey, String rewardKey, List<String> groupKeys, String sessionIdKey, String filePath, String separatorKey, GroupedIndexer indexer, int maxTime, int reinforceThreshold, String usedGroupsFilePath, int batchSize, RequestContext requestContext) { super(config, configService, daoConfigs, daoConfigKey, batchSize, requestContext, injector); this.indexer = indexer; this.filePathKey = filePathKey; this.timestampField = timestampField; this.dataFields = dataFields; this.daoName = daoName; this.daoNameKey = daoNameKey; this.filesKey = filesKey; this.separatorKey = separatorKey; this.separator = separator; this.rewardKey = rewardKey; this.groupKeys = groupKeys; this.sessionIdKey = sessionIdKey; this.filePath = filePath; this.maxTime = maxTime; this.reinforceThreshold = reinforceThreshold; this.usedGroupsFilePath = usedGroupsFilePath; }
Example #14
Source File: RegressionTreePredictorConfig.java From samantha with MIT License | 6 votes |
private RegressionTreePredictorConfig(String modelName, List<FeatureExtractorConfig> feaExtConfigs, List<String> features, String labelName, String weightName, Configuration daoConfigs, List<Configuration> expandersConfig, Injector injector, TreeLearningMethod method, String modelFile, String daoConfigKey, Configuration config) { this.modelName = modelName; this.feaExtConfigs = feaExtConfigs; this.features = features; this.labelName = labelName; this.weightName = weightName; this.daoConfigs = daoConfigs; this.expandersConfig = expandersConfig; this.injector = injector; this.method = method; this.modelFile = modelFile; this.daoConfigKey = daoConfigKey; this.config = config; }
Example #15
Source File: RegressionTreeGBCentPredictorConfig.java From samantha with MIT License | 6 votes |
private RegressionTreeGBCentPredictorConfig(String modelName, String svdfeaModelName, String svdfeaPredictorName, List<String> treeFeatures, List<String> groupKeys, List<FeatureExtractorConfig> treeExtractorsConfig, Configuration daosConfig, List<Configuration> expandersConfig, Configuration methodConfig, Injector injector, String modelFile, String daoConfigKey, Configuration config) { this.daosConfig = daosConfig; this.expandersConfig = expandersConfig; this.modelName = modelName; this.svdfeaModelName = svdfeaModelName; this.svdfeaPredictorName = svdfeaPredictorName; this.injector = injector; this.methodConfig = methodConfig; this.groupKeys = groupKeys; this.treeExtractorsConfig = treeExtractorsConfig; this.treeFeatures = treeFeatures; this.modelFile = modelFile; this.daoConfigKey = daoConfigKey; this.config = config; }
Example #16
Source File: UserKnnRetriever.java From samantha with MIT License | 6 votes |
public UserKnnRetriever(String weightAttr, String scoreAttr, List<String> userAttrs, List<String> itemAttrs, Retriever retriever, KnnModelTrigger trigger, Configuration config, RequestContext requestContext, Injector injector) { super(config, requestContext, injector); this.weightAttr = weightAttr; this.scoreAttr = scoreAttr; this.itemAttrs = itemAttrs; this.userAttrs = userAttrs; this.retriever = retriever; this.trigger = trigger; }
Example #17
Source File: ESBasedIndexer.java From samantha with MIT License | 6 votes |
public ESBasedIndexer(ElasticSearchService elasticSearchService, SamanthaConfigService configService, Configuration daoConfigs, String elasticSearchIndex, String indexTypeKey, String indexType, List<String> uniqueFields, Injector injector, String daoConfigKey, Configuration config, int batchSize, RequestContext requestContext) { super(config, configService, daoConfigs, daoConfigKey, batchSize, requestContext, injector); this.elasticSearchService = elasticSearchService; this.indexTypeKey = indexTypeKey; this.elasticSearchIndex = elasticSearchIndex; this.indexType = indexType; this.uniqueFields = uniqueFields; this.dataFields = new ArrayList<>(); for (String field : this.uniqueFields) { this.dataFields.add(field.replace(".raw", "")); } }
Example #18
Source File: EntityFieldRankerConfig.java From samantha with MIT License | 6 votes |
public static RankerConfig getRankerConfig(Configuration rankerConfig, Injector injector) { int pageSize = 24; if (rankerConfig.asMap().containsKey(ConfigKey.RANKER_PAGE_SIZE.get())) { pageSize = rankerConfig.getInt(ConfigKey.RANKER_PAGE_SIZE.get()); } boolean whetherOrder = true; if (rankerConfig.asMap().containsKey("whetherOrder")) { whetherOrder = rankerConfig.getBoolean("whetherOrder"); } Boolean ascending = rankerConfig.getBoolean("ascending"); if (ascending == null) { ascending = false; } return new EntityFieldRankerConfig(rankerConfig, injector, pageSize, rankerConfig.getString("orderField"), whetherOrder, ascending); }
Example #19
Source File: CSVFileIndexer.java From samantha with MIT License | 6 votes |
public CSVFileIndexer(SamanthaConfigService configService, FileWriterService dataService, Configuration config, Injector injector, Configuration daoConfigs, String daoConfigKey, String timestampField, List<String> dataFields, String beginTimeKey, String beginTime, String endTimeKey, String endTime, String daoNameKey, String daoName, String filesKey, String separatorKey, String indexType, String subDaoName, String subDaoConfigKey, int batchSize, RequestContext requestContext) { super(config, configService, daoConfigs, daoConfigKey, batchSize, requestContext, injector); this.dataService = dataService; this.indexType = indexType; this.timestampField = timestampField; this.dataFields = dataFields; this.beginTime = beginTime; this.beginTimeKey = beginTimeKey; this.endTime = endTime; this.endTimeKey = endTimeKey; this.daoName = daoName; this.daoNameKey = daoNameKey; this.filesKey = filesKey; this.separatorKey = separatorKey; this.subDaoConfigKey = subDaoConfigKey; this.subDaoName = subDaoName; }
Example #20
Source File: NDCGConfig.java From samantha with MIT License | 6 votes |
public static MetricConfig getMetricConfig(Configuration metricConfig, Injector injector) { double minValue = 0.0; if (metricConfig.asMap().containsKey("minValue")) { minValue = metricConfig.getDouble("minValue"); } List<String> itemKeys = metricConfig.getStringList("itemKeys"); List<String> recKeys = metricConfig.getStringList("recKeys"); if (recKeys == null) { recKeys = itemKeys; } return new NDCGConfig(metricConfig.getIntList("N"), itemKeys, recKeys, metricConfig.getString("relevanceKey"), metricConfig.getString("separator"), minValue); }
Example #21
Source File: PrecisionConfig.java From samantha with MIT License | 6 votes |
public static MetricConfig getMetricConfig(Configuration metricConfig, Injector injector) { double threshold = 0.0; if (metricConfig.asMap().containsKey("threshold")) { threshold = metricConfig.getDouble("threshold"); } double minValue = 0.0; if (metricConfig.asMap().containsKey("minValue")) { minValue = metricConfig.getDouble("minValue"); } List<String> itemKeys = metricConfig.getStringList("itemKeys"); List<String> recKeys = metricConfig.getStringList("recKeys"); if (recKeys == null) { recKeys = itemKeys; } return new PrecisionConfig(metricConfig.getIntList("N"), itemKeys, recKeys, metricConfig.getString("relevanceKey"), threshold, minValue, metricConfig.getString("separator")); }
Example #22
Source File: NegativeSamplingExpander.java From samantha with MIT License | 6 votes |
public static EntityExpander getExpander(Configuration expanderConfig, Injector injector, RequestContext requestContext) { ModelService modelService = injector.instanceOf(ModelService.class); SamanthaConfigService configService = injector.instanceOf(SamanthaConfigService.class); configService.getPredictor(expanderConfig.getString("predictorName"), requestContext); AbstractLearningModel model = (AbstractLearningModel) modelService.getModel( requestContext.getEngineName(), expanderConfig.getString("modelName")); String keyPrefix = expanderConfig.getString("keyPrefix"); if (keyPrefix == null) { keyPrefix = expanderConfig.getString("itemAttr"); } return new NegativeSamplingExpander( expanderConfig.getString("itemAttr"), expanderConfig.getString("itemIndex"), keyPrefix, expanderConfig.getString("labelAttr"), expanderConfig.getStringList("fillInAttrs"), expanderConfig.getString("separator"), expanderConfig.getString("joiner"), expanderConfig.getInt("maxIdx"), expanderConfig.getInt("maxNumSample"), model); }
Example #23
Source File: XGBoostGBCentPredictorConfig.java From samantha with MIT License | 5 votes |
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 XGBoostGBCentPredictorConfig(predictorConfig.getString("modelName"), predictorConfig.getString("svdfeaModelName"), predictorConfig.getString("svdfeaPredictorName"), predictorConfig.getStringList("treeFeatures"), feaExtConfigs, daosConfig, expanders, predictorConfig.getConfig("methodConfig"), injector, predictorConfig.getString("modelFile"), predictorConfig.getString("daoConfigKey"), predictorConfig); }
Example #24
Source File: EntityFieldRankerConfig.java From samantha with MIT License | 5 votes |
private EntityFieldRankerConfig(Configuration config, Injector injector, int pageSize, String orderField, boolean whetherOrder, boolean ascending) { this.pageSize = pageSize; this.injector = injector; this.orderField = orderField; this.whetherOrder = whetherOrder; this.ascending = ascending; this.config = config; }
Example #25
Source File: TimeFilteredDAOConfig.java From samantha with MIT License | 5 votes |
private TimeFilteredDAOConfig(Configuration daosConfig, Injector injector, String beginTime, String endTime, String timestampField, String beginTimeKey, String endTimeKey, String subDaoConfigKey) { this.daosConfig = daosConfig; this.injector = injector; this.beginTime = beginTime; this.endTime = endTime; this.beginTimeKey = beginTimeKey; this.endTimeKey = endTimeKey; this.subDaoConfigKey = subDaoConfigKey; this.timestampField = timestampField; }
Example #26
Source File: SVDFeaturePredictorConfig.java From samantha with MIT License | 5 votes |
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); }
Example #27
Source File: EnglishTokenizeExtractorConfig.java From samantha with MIT License | 5 votes |
public static FeatureExtractorConfig getFeatureExtractorConfig(Configuration extractorConfig, Injector injector) { Boolean sigmoid = extractorConfig.getBoolean("sigmoid"); if (sigmoid == null) { sigmoid = true; } return new EnglishTokenizeExtractorConfig( extractorConfig.getString("indexName"), extractorConfig.getStringList("attrNames"), extractorConfig.getString("feaName"), extractorConfig.getString("vocabularyName"), sigmoid ); }
Example #28
Source File: PredictorUtilities.java From samantha with MIT License | 5 votes |
static public ObjectiveFunction getObjectiveFunction(Configuration config, Injector injector, RequestContext requestContext) { String objectiveClass = config.getString(ConfigKey.OBJECTIVE_CLASS.get()); try { Method method = Class.forName(objectiveClass) .getMethod("getObjectiveFunction", Configuration.class, Injector.class, RequestContext.class); return (ObjectiveFunction) method.invoke(null, config, injector, requestContext); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) { throw new BadRequestException(e); } }
Example #29
Source File: SeparatedIdentityExtractorConfig.java From samantha with MIT License | 5 votes |
public static FeatureExtractorConfig getFeatureExtractorConfig(Configuration extractorConfig, Injector injector) { return new SeparatedIdentityExtractorConfig( extractorConfig.getString("indexName"), extractorConfig.getString("attrName"), extractorConfig.getString("feaName"), extractorConfig.getString("separator"), extractorConfig.getInt("maxFeatures") ); }
Example #30
Source File: FeatureKnnModelManager.java From samantha with MIT License | 5 votes |
public FeatureKnnModelManager(String modelName, String modelFile, Injector injector, String svdfeaPredictorName, String svdfeaModelName, List<String> itemAttrs, int numMatch, int numNeighbors, boolean reverse, int minSupport) { super(injector, modelName, modelFile, new ArrayList<>()); this.svdfeaModelName = svdfeaModelName; this.svdfeaPredictorName = svdfeaPredictorName; this.itemAttrs = itemAttrs; this.numNeighbors = numNeighbors; this.reverse = reverse; this.minSupport = minSupport; this.numMatch = numMatch; }