• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Extension类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.dmg.pmml.Extension的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: unmarshal

import org.dmg.pmml.Extension; //导入依赖的package包/类
@Test
public void unmarshal() throws Exception {
	PMML pmml;

	System.setProperty("javax.xml.accessExternalDTD", "file");

	try(InputStream is = ResourceUtil.getStream(XXEAttackTest.class);){
		pmml = JAXBUtil.unmarshalPMML(new StreamSource(is));
	} finally {
		System.clearProperty("javax.xml.accessExternalDTD");
	}

	List<Extension> extensions = pmml.getExtensions();
	assertEquals(1, extensions.size());

	Extension extension = extensions.get(0);
	assertEquals(Arrays.asList("lol"), extension.getContent());
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:19,代码来源:XXEAttackTest.java


示例2: read

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * Quite manually parse our fake model representation in PMML.
 */
private static ALSModelDescription read(InputStream in) throws JAXBException, SAXException {

  PMML pmml = IOUtil.unmarshal(in);
  List<Extension> extensions = pmml.getExtensions();
  Preconditions.checkNotNull(extensions);
  Preconditions.checkArgument(!extensions.isEmpty());

  ALSModelDescription model = new ALSModelDescription();

  for (Extension extension : extensions) {
    String name  = extension.getName();
    String value = extension.getValue();
    Preconditions.checkNotNull(name);
    Preconditions.checkNotNull(value);
    model.getPathByKey().put(name, value);
  }

  return model;
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:23,代码来源:ALSModelDescription.java


示例3: addExtensionContent

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * @param pmml PMML model to add extension to, with a single {@code String} content and no value.
 *  The content is encoded as if they were being added to a PMML {@link Array} and are
 *  space-separated with PMML quoting rules
 * @param key extension key
 * @param content list of values to add as a {@code String}
 */
public static void addExtensionContent(PMML pmml, String key, Collection<?> content) {
  if (content.isEmpty()) {
    return;
  }
  String joined = TextUtils.joinPMMLDelimited(content);
  pmml.addExtensions(new Extension().setName(key).addContent(joined));
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:15,代码来源:AppPMMLUtils.java


示例4: createExtension

import org.dmg.pmml.Extension; //导入依赖的package包/类
static
private Extension createExtension(String content){
	Extension extension = new Extension()
		.addContent(content);

	return extension;
}
 
开发者ID:jpmml,项目名称:jpmml-r,代码行数:8,代码来源:FormulaUtil.java


示例5: getAlgorithm

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * Retrieves the {@link com.feedzai.fos.impl.weka.utils.pmml.PMMLConversionCommons.Algorithm} represented
 * as a PMML extension named {@link com.feedzai.fos.impl.weka.utils.pmml.PMMLConversionCommons#ALGORITHM_EXTENSION_ELEMENT}.
 *
 * @param pmml The {@link PMML}.
 * @return The {@link com.feedzai.fos.impl.weka.utils.pmml.PMMLConversionCommons.Algorithm} in the PMML.
 * @throws PMMLConversionException If it fails to retrieve the algorithm from the given PPML.
 */
private static Algorithm getAlgorithm(PMML pmml) throws PMMLConversionException {
    for (Extension extension : pmml.getExtensions()) {
        if (ALGORITHM_EXTENSION_ELEMENT.equals(extension.getName())) {
            return Algorithm.valueOf(extension.getValue());
        }
    }

    throw new PMMLConversionException("Couldn't find '" + ALGORITHM_EXTENSION_ELEMENT + "' extension element in PMML.");
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:18,代码来源:PMMLConsumers.java


示例6: parseBayesInputs

import org.dmg.pmml.Extension; //导入依赖的package包/类
static
private List<BayesInput> parseBayesInputs(NaiveBayesModel naiveBayesModel){
	BayesInputs bayesInputs = naiveBayesModel.getBayesInputs();

	if(!bayesInputs.hasExtensions()){
		return bayesInputs.getBayesInputs();
	}

	List<BayesInput> result = new ArrayList<>(bayesInputs.getBayesInputs());

	// The support for continuous fields using the TargetValueStats element was officially introduced in PMML schema version 4.2.
	// However, it is possible to encounter this feature in older PMML schema version documents (most notably, produced by R's "pmml" package),
	// where the offending BayesInput element is surrounded by an Extension element:
	// <BayesInputs>
	//   <BayesInput>
	//     <PairCounts/>
	//   </BayesInput>
	//   <Extension>
	//     <BayesInput>
	//       <TargetValueStats/>
	//     </BayesInput>
	//   </Extension>
	// </BayesInputs>
	List<Extension> extensions = bayesInputs.getExtensions();
	for(Extension extension : extensions){
		List<?> objects = extension.getContent();

		for(Object object : objects){

			if(object instanceof BayesInput){
				BayesInput bayesInput = (BayesInput)object;

				result.add(bayesInput);
			}
		}
	}

	return result;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:40,代码来源:NaiveBayesModelEvaluator.java


示例7: write

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * Quite manually write our fake model representation in PMML.
 */
private static void write(OutputStream out, ALSModelDescription model) throws JAXBException {
  PMML pmml = new PMML(null, null, "4.1");
  for (Map.Entry<String,String> entry : model.getPathByKey().entrySet()) {
    Extension extension = new Extension();
    extension.setName(entry.getKey());
    extension.setValue(entry.getValue());
    pmml.getExtensions().add(extension);
  }
  IOUtil.marshal(pmml, out);
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:14,代码来源:ALSModelDescription.java


示例8: getExtensionValue

import org.dmg.pmml.Extension; //导入依赖的package包/类
public static String getExtensionValue(PMML pmml, String name) {
  return pmml.getExtensions().stream().filter(extension -> name.equals(extension.getName())).findFirst().
      map(Extension::getValue).orElse(null);
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:5,代码来源:AppPMMLUtils.java


示例9: getDeepContent

import org.dmg.pmml.Extension; //导入依赖的package包/类
static
private List<?> getDeepContent(Object object){
	Extension extension = (Extension)object;

	return extension.getContent();
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:7,代码来源:MixedContentTest.java


示例10: checkExtension

import org.dmg.pmml.Extension; //导入依赖的package包/类
static
private void checkExtension(String name, String value, Extension extension){
	assertEquals(name, extension.getName());
	assertEquals(value, extension.getValue());
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:6,代码来源:ValidationTest.java


示例11: addAlgorithm

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * Adds a {@link org.dmg.pmml.Extension} element to the {@link org.dmg.pmml.PMML} with the
 * algorithm used to build the classifier.
 * <p/>
 * The name of the extension is {@link com.feedzai.fos.impl.weka.utils.pmml.PMMLConversionCommons#ALGORITHM_EXTENSION_ELEMENT}.
 *
 * @param pmml      The {@link PMML} to which add the algorithm.
 * @param algorithm The algorithm used to build the classifier.
 */
private static void addAlgorithm(PMML pmml, Algorithm algorithm) {
    Extension extension = new Extension();
    extension.withName(ALGORITHM_EXTENSION_ELEMENT);
    extension.withValue(algorithm.name());

    pmml.withExtensions(extension);
}
 
开发者ID:feedzai,项目名称:fos-weka,代码行数:17,代码来源:PMMLProducers.java


示例12: getContent

import org.dmg.pmml.Extension; //导入依赖的package包/类
static
public List<?> getContent(HasExtensions<?> hasExtensions){
	List<Extension> extensions = hasExtensions.getExtensions();

	assertEquals(1, extensions.size());

	Extension extension = extensions.get(0);

	return extension.getContent();
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:11,代码来源:ExtensionUtil.java


示例13: addExtension

import org.dmg.pmml.Extension; //导入依赖的package包/类
/**
 * @param pmml PMML model to add extension to, with no content. It may possibly duplicate
 *  existing extensions.
 * @param key extension key
 * @param value extension value
 */
public static void addExtension(PMML pmml, String key, Object value) {
  pmml.addExtensions(new Extension().setName(key).setValue(value.toString()));
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:10,代码来源:AppPMMLUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnRecordChangeListener类代码示例发布时间:1970-01-01
下一篇:
Java ServiceManager类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap