Skip to content

Instantly share code, notes, and snippets.

@dacamo76
dacamo76 / AttributeRepresentation.java
Created October 28, 2019 04:54
Medium blog article
interface AttributeRepresentation {
List<Attribute> newAttributeList();
}
@dacamo76
dacamo76 / attributes.json
Last active October 28, 2019 04:56
RapidMiner Attributes snippet
[
{
"teamID": {
"type": "nominal",
"role": "id"
}
},
{
"size": {
"type": "integer"
final class JSONAttributeRepresentation implements AttributeRepresentation {
private final List<Attribute> attributes;
public JSONAttributeRepresentation(Reader JSONReader) {
// Read in json however you want
// Get name, type, and role for each
// for each create attribute with the name and type
// Attribute att = AttributeFactory.createAttribute(name, type)
// atributes.add(att);
AttributeRepresentation rep = new JSONAttributeRepresentation(Reader jsonReader);
List<Attributes> attributes = rep.newAttributeList();
Map<Attribute, String> roles = new HashMap<Attribute, String>();
Attribute id = attributes.get(0);
roles.put(id, Attributes.ID_NAME);