本文整理了Java中eu.amidst.core.datastream.Attributes.getListOfNonSpecialAttributes()
方法的一些代码示例,展示了Attributes.getListOfNonSpecialAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.getListOfNonSpecialAttributes()
方法的具体详情如下:
包路径:eu.amidst.core.datastream.Attributes
类名称:Attributes
方法名:getListOfNonSpecialAttributes
暂无
代码示例来源:origin: amidst/toolbox
/**
* Creates a new DynamicVariables object given a set of {@link Attributes}.
* @param atts a set of {@link Attributes}.
*/
public DynamicVariables(Attributes atts) {
this.nonInterfaceVariables = new ArrayList<>();
this.interfaceVariables = new ArrayList<>();
this.mapping = new ConcurrentHashMap<>();
for (Attribute att : atts.getListOfNonSpecialAttributes()) {
VariableBuilder builder = new VariableBuilder(att);
VariableImplementation var = new VariableImplementation(builder, nonInterfaceVariables.size());
if (mapping.containsKey(var.getName())) {
throw new IllegalArgumentException("Attribute list contains duplicated names");
}
this.mapping.put(var.getName(), var.getVarID());
nonInterfaceVariables.add(var.getVarID(), var);
VariableImplementation interfaceVariable = VariableImplementation.newInterfaceVariable(var);
var.setInterfaceVariable(interfaceVariable);
interfaceVariables.add(var.getVarID(), interfaceVariable);
}
}
代码示例来源:origin: amidst/toolbox
/**
* Creates a new DynamicVariables object given a list of Attributes and their corresponding distribution types.
* @param atts a set of {@link Attributes}.
* @param typeDists a {@link java.util.HashMap} object that maps the Attributes to their distribution types.
*/
public DynamicVariables(Attributes atts, Map<Attribute, DistributionTypeEnum> typeDists) {
this.nonInterfaceVariables = new ArrayList<>();
this.interfaceVariables = new ArrayList<>();
for (Attribute att : atts.getListOfNonSpecialAttributes()) {
VariableBuilder builder;
if (typeDists.containsKey(att)) {
builder = new VariableBuilder(att, typeDists.get(att));
}else{
builder = new VariableBuilder(att);
}
VariableImplementation var = new VariableImplementation(builder, nonInterfaceVariables.size());
if (mapping.containsKey(var.getName())) {
throw new IllegalArgumentException("Attribute list contains duplicated names");
}
this.mapping.put(var.getName(), var.getVarID());
nonInterfaceVariables.add(var.getVarID(), var);
VariableImplementation interfaceVariable = VariableImplementation.newInterfaceVariable(var);
var.setInterfaceVariable(interfaceVariable);
interfaceVariables.add(var.getVarID(), interfaceVariable);
}
}
代码示例来源:origin: amidst/toolbox
/**
* Builds the DAG over the set of variables given with the structure of the model
*/
@Override
protected void buildDAG() {
String className = atts.getFullListOfAttributes().get(classIndex).getName();
hiddenVars = new ArrayList<Variable>();
for (int i = 0; i < this.numberOfGlobalVars ; i++) {
hiddenVars.add(vars.newGaussianVariable("GlobalHidden_"+i));
}
Variable classVariable = vars.getVariableByName(className);
dag = new DAG(vars);
for (Attribute att : atts.getListOfNonSpecialAttributes()) {
if (att.getName().equals(className))
continue;
Variable variable = vars.getVariableByName(att.getName());
dag.getParentSet(variable).addParent(classVariable);
if (this.globalHidden) {
for (int i = 0; i < this.numberOfGlobalVars ; i++) {
dag.getParentSet(variable).addParent(hiddenVars.get(i));
}
}
}
}
代码示例来源:origin: amidst/toolbox
/**
* Builds the DAG structure of a Naive Bayes classifier with a global hidden Gaussian variable.
*/
private void buildGlobalDAG(){
Variables variables = new Variables(attributes);
String className = attributes.getFullListOfAttributes().get(classIndex).getName();
hiddenVars = new ArrayList<Variable>();
for (int i = 0; i < this.numberOfGlobalVars ; i++) {
hiddenVars.add(variables.newGaussianVariable("GlobalHidden_"+i));
}
Variable classVariable = variables.getVariableByName(className);
this.globalDAG = new DAG(variables);
for (Attribute att : attributes.getListOfNonSpecialAttributes()) {
if (att.getName().equals(className))
continue;
Variable variable = variables.getVariableByName(att.getName());
globalDAG.getParentSet(variable).addParent(classVariable);
for (int i = 0; i < this.numberOfGlobalVars ; i++) {
globalDAG.getParentSet(variable).addParent(hiddenVars.get(i));
}
}
System.out.println(globalDAG.toString());
}
代码示例来源:origin: amidst/toolbox
@Override
public void mapPartition(Iterable<DynamicDataInstance> values, Collector<DynamicDataInstance> out) throws Exception {
values.forEach(d -> {
HashMapAssignment pastAssignment = new HashMapAssignment();
for (Attribute att : d.getAttributes().getListOfNonSpecialAttributes()){
pastAssignment.setValue(bn.getVariables().getVariableByName(att.getName()+ DynamicVariables.INTERFACE_SUFFIX),d.getValue(att));
}
Assignment assignment = sample(bn, causalOrder, random, pastAssignment);
hiddenVars.keySet().stream().forEach(var -> assignment.setValue(bn.getVariables().getVariableByName(var.getName()),Utils.missingValue()));
marVars.entrySet().forEach(e -> {
if (random.nextDouble()<e.getValue())
assignment.setValue(bn.getVariables().getVariableByName(e.getKey().getName()),Utils.missingValue());
});
DataInstance dataInstanceNew = new DataStreamFromStreamOfAssignments.DataInstanceFromAssignment(assignment,attributes, bn.getVariables().getListOfVariables());
DynamicDataInstanceWrapper wrapper = new DynamicDataInstanceWrapper(dataInstanceNew,attributes,d.getSequenceID(), d.getTimeID()+1);
out.collect(wrapper);
});
}
代码示例来源:origin: amidst/toolbox
for (Attribute att : attributes.getListOfNonSpecialAttributes()) {
if (att.getName().equals(className))
continue;
代码示例来源:origin: amidst/toolbox
DataInstance dataInstance = (DataInstance)assignment;
dataInstance.getAttributes().getListOfNonSpecialAttributes().stream()
.forEach(att -> {
try {
内容来源于网络,如有侵权,请联系作者删除!