Package org.jamesii.asf.spdm

Examples of org.jamesii.asf.spdm.Features


  @Override
  protected Features extractFeatures(ParameterBlock parameters) {

    IModel model = ModelFeatureExtractor.getModelRuntime(parameters);
    Features features = new Features();

    // Look up registry for all model feature extractors
    List<FeatureExtractorFactory> featExtractFactories =
        SimSystem.getRegistry().getFactories(FeatureExtractorFactory.class);

    for (FeatureExtractorFactory featExtractFactory : featExtractFactories) {
      // Test each if applicable to this model
      if (featExtractFactory instanceof ModelFeatureExtractorFactory<?>
          && featExtractFactory.supportsParametersRuntime(parameters)) {
        ModelFeatureExtractor<?> featureExtractor =
            ((ModelFeatureExtractorFactory<?>) featExtractFactory).create(null, SimSystem.getRegistry().createContext());
        // If applicable, use it to generate features
        features.putAll(featureExtractor.extractModelFeaturesRuntime(model));
      }
    }
    return features;
  }
View Full Code Here


   *          the parameters
   *
   * @return the list< configuration>
   */
  public List<SelectionTree> useSelector(ParameterBlock parameters) {
    Features features = extractFeatures(parameters);
    List<Configuration> configurations =
        selector.selectConfigurations(features);
    return retrieveTrees(configurations);
  }
View Full Code Here

   */
  public static <T extends PerformanceTuple> Map<Features, List<T>> sortToFeatureMap(
      List<T> perfTuples) {
    Map<Features, List<T>> featureMap = new HashMap<>();
    for (T perfTuple : perfTuples) {
      Features features = perfTuple.getFeatures();
      if (featureMap.containsKey(features)) {
        featureMap.get(features).add(perfTuple);
      } else {
        List<T> perfTupleList = new ArrayList<>();
        perfTupleList.add(perfTuple);
View Full Code Here

    BufferedReader br = null;
    try {
      br = new BufferedReader(new FileReader(file));
      String currentLine;
      while ((currentLine = br.readLine()) != null) {
        Features features = new Features();
        features.putAll(modelFeatures);
        results.add(generatePerformanceTuple(features, splitLine(currentLine)));
      }
    } catch (IOException ex) {
      SimSystem.report(Level.SEVERE,
          "Problem while reading file '" + file.getName() + "'.", ex);
View Full Code Here

   */
  protected Features createOrReadFeatures(IApplication application) {
    if (isApplyingFeatureExtraction()) {
      createFeatures(application);
    }
    Features features = new Features();
    for (IFeature feature : perfDB.getAllFeatures(application)) {
      features.putAll(feature.getValue());
    }
    return features;
  }
View Full Code Here

    Integer newFeatureSize = null;
    Integer numOfPerformanceTuples = null;

    for (Entry<Long, Features> features : featuresByProblem.entrySet()) {
      Long problemID = features.getKey();
      Features aggregatedFeatures = features.getValue();

      // Initialize size
      if (newFeatureSize == null) {
        newFeatureSize = aggregatedFeatures.size();
        numOfPerformanceTuples = tuplesByProblem.get(problemID).size();
        continue;
      }

      // Check size
      int featureSize = aggregatedFeatures.size();
      int perfTupleSetSize = tuplesByProblem.get(problemID).size();
      if (newFeatureSize != featureSize) {
        SimSystem.report(Level.WARNING, "For some problems there are "
            + newFeatureSize
            + " (new) features, but for the problem with features '"
View Full Code Here

      Map<Long, Features> oldFeaturesByProblem) {
    if (featuresByProblem.containsKey(perfTuple.getProblemDefinitionID())) {
      return false;
    }

    Features newFeatures = filterFeaturesToAggregate(perfTuple.getFeatures());
    featuresByProblem.put(perfTuple.getProblemDefinitionID(), newFeatures);
    oldFeaturesByProblem.put(perfTuple.getProblemDefinitionID(),
        perfTuple.getFeatures());
    return true;
  }
View Full Code Here

   * @param originalFeatures
   *          the original problem features
   * @return the filtered features
   */
  private Features filterFeaturesToAggregate(Features originalFeatures) {
    Features filteredFeatures = new Features();
    for (Entry<String, Serializable> feature : originalFeatures.entrySet()) {
      if (featureIsPermissible(feature.getKey())) {
        filteredFeatures.put(feature.getKey(), feature.getValue());
      }
    }
    return filteredFeatures;
  }
View Full Code Here

  /** Performance tuple to be tested. */
  PerformanceTuple perfTuple;

  @Override
  public void setUp() {
    Features features = new Features();
    features.put(TEST_FEATURE, TEST_FEATURE_VALUE);
    Configuration configuration = new Configuration(null);
    configuration.put(TEST_CONFIG, TEST_CONFIG_VALUE);
    perfTuple =
        new PerformanceTuple(features, configuration,
            TotalRuntimePerfMeasurerFactory.class, 10);
View Full Code Here

   * Tests generation of performance tuple.
   */
  public void testGeneratePerformanceTuple() {
    String sampleLine = "word__work_rng\t1.23\t5.00\t6.67";
    PerformanceTuple perfTuple =
        FileImportManager.generatePerformanceTuple(new Features(),
            FileImportManager.splitLine(sampleLine));
    assertEquals("word", perfTuple.getConfiguration()
        .get(FileImportManager.SIM));
    assertNull(perfTuple.getConfiguration().get(FileImportManager.SIMPARAMS));
    assertEquals("work", perfTuple.getConfiguration().get(FileImportManager.EQ));
View Full Code Here

TOP

Related Classes of org.jamesii.asf.spdm.Features

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.