private AttributeDataset createDataset(List<Sampler<LinkNeighborhood>> instances,
            String[] features, List<String> classValues, LinkNeighborhoodWrapper wrapper) {
        
        List<Attribute> attributes = new ArrayList<>();
        for(String featureName : features) {
            NumericAttribute attribute = new NumericAttribute(featureName);
            attributes.add(attribute);
        }

        Attribute[] attributesArray = attributes.toArray(new Attribute[attributes.size()]);
        String[] classValuesArray = classValues.toArray(new String[classValues.size()]);
        String description = "If link leads to relevant page or not.";
        Attribute response = new NominalAttribute("y", description, classValuesArray);
        AttributeDataset dataset = new AttributeDataset("link_classifier", attributesArray, response);

        for (int level = 0; level < instances.size(); level++) {
            Sampler<LinkNeighborhood> levelSamples = instances.get(level);
            for (LinkNeighborhood ln : levelSamples.getSamples()) {
                Instance instance;
                try {
                    instance = wrapper.extractToInstance(ln, features);
                } catch (MalformedURLException e) {
                    logger.warn("Failed to process instance: "+ln.getLink().toString(), e);
                    continue;
                }
                double[] values = instance.getValues(); // the instance's feature vector
                int y = level; // the class we're trying to predict
                dataset.add(values, y);
            }
        }
        return dataset;
    }
Converts the input instances into an AttributeDataset object that can be used to train a
SMILE classifier.
ache/src/main/java/achecrawler/link/classifier/builder/LinkClassifierTrainer.java